feat(provenance,daemon): add Ed25519 signing primitives and bounded daemon describe op
This commit is contained in:
1 parent
0bde74f739
commit
21babb8c31
16 files changed
+1232
-20
No files matched your search
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Functional/Error.hpp>
|
||||
#include <Void/Functional/Result.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace Void::Build::Provenance {
|
||||
|
||||
// Ed25519 package-signing primitives. Every operation fails closed with an
|
||||
// explicit error when Void::Crypto was built without its OpenSSL backend.
|
||||
[[nodiscard]] bool signing_available() noexcept;
|
||||
|
||||
// Writes a fresh random 32-byte Ed25519 seed as 64 lowercase hex characters
|
||||
// plus a trailing newline, creating the file owner read/write only (0600).
|
||||
[[nodiscard]] Void::Result::Result<void, Void::Result::Error>
|
||||
generate_signing_seed(const std::filesystem::path &seed_path);
|
||||
|
||||
// Derives the 32-byte Ed25519 public key (64 lowercase hex characters) from a
|
||||
// seed file holding exactly 64 hex characters plus optional trailing whitespace.
|
||||
[[nodiscard]] Void::Result::Result<std::string, Void::Result::Error>
|
||||
public_key_from_seed(const std::filesystem::path &seed_path);
|
||||
|
||||
// Canonical package message signed by vbs:
|
||||
// "vbs-package-v1\n<name>@<version>\nsha256:<digest-hex>\n"
|
||||
[[nodiscard]] std::string canonical_package_message(std::string_view name, std::string_view version,
|
||||
std::string_view sha256_hex);
|
||||
|
||||
// Detached Ed25519 signature (128 lowercase hex characters) over the canonical message.
|
||||
[[nodiscard]] Void::Result::Result<std::string, Void::Result::Error>
|
||||
sign_package(std::string_view name, std::string_view version, std::string_view sha256_hex,
|
||||
const std::filesystem::path &seed_path);
|
||||
|
||||
// Verifies a detached signature over the canonical message. Well-formed but invalid
|
||||
// signatures return false; malformed hex, key, or signature sizes return an error.
|
||||
[[nodiscard]] Void::Result::Result<bool, Void::Result::Error>
|
||||
verify_package(std::string_view name, std::string_view version, std::string_view sha256_hex,
|
||||
std::string_view signature_hex, std::string_view public_key_hex);
|
||||
|
||||
} // namespace Void::Build::Provenance
|
||||
Reference in new issue
Block a user