Merge issue-36-ed25519: Ed25519 sign/verify (#36)

This commit is contained in:
faumaray committed 2026-12-03 15:46:14 +03:00
commit f146df97f4
3 files changed
+163

No files matched your search

+29
View File
@@ -166,6 +166,35 @@ namespace Void::Crypto
const Ed25519PublicKey& public_key,
const ProviderOptions& provider = {});
/// Convenience key pair returned by ed25519_keypair(). The secret seed is
/// a move-only, self-wiping handle; prefer the typed Ed25519PrivateKey APIs
/// when the key can stay inside an owning handle.
struct Ed25519KeyPair {
Ed25519Seed secret_key;
Ed25519PublicKey public_key;
};
/// Generate a fresh Ed25519 key pair. Requires the OpenSSL backend.
[[nodiscard]] Void::Result::Result<Ed25519KeyPair>
ed25519_keypair(const ProviderOptions& provider = {});
/// Sign exact message bytes with a 32-byte Ed25519 seed/secret key. The
/// temporary private-key handle is wiped when it goes out of scope; prefer
/// sign_ed25519() when the caller already owns an Ed25519PrivateKey.
[[nodiscard]] Void::Result::Result<Ed25519Signature>
ed25519_sign(std::span<const std::byte> secret_key,
std::span<const std::byte> message,
const ProviderOptions& provider = {});
/// Verify a detached Ed25519 signature over exact message bytes.
/// Malformed key/signature sizes are errors; a well-formed but invalid
/// signature returns false.
[[nodiscard]] Void::Result::Result<bool>
ed25519_verify(std::span<const std::byte> public_key,
std::span<const std::byte> message,
std::span<const std::byte> signature,
const ProviderOptions& provider = {});
/// Compute HMAC-SHA-256 into a caller-owned 32-byte buffer.
/// Wipes output on backend failure and rejects overlapping buffers.
[[nodiscard]] Void::Result::Result<void>