#pragma once #include "core/common.h" #include #include #include #include #include namespace vn { using PublicKey = std::array; using Signature = std::array; using FingerprintBytes = std::array; std::optional ed25519_public_from_seed(Bytes seed); std::optional ed25519_sign(Bytes seed, Bytes message); bool ed25519_verify(const PublicKey& public_key, Bytes message, Bytes signature); FingerprintBytes key_fingerprint_bytes(const PublicKey& public_key); std::string key_fingerprint(const PublicKey& public_key); // RFC 4648 base32 with no padding. The reference implementation emits // fingerprints in uppercase, so this matches it. std::string base32_text(Bytes raw); // Unpadded base64url. std::string base64url_encode(Bytes raw); std::optional> base64url_decode(std::string_view text); std::string format_public_key(const PublicKey& public_key); std::optional parse_public_key(std::string_view text); std::vector secure_random(std::size_t count); } // namespace vn