pub struct NoteVerifierKey { /* private fields */ }Expand description
A parsed note verifier key: <name>+<hex keyid>+<base64(0x01 ‖ pubkey)>.
Holds only public material. Constructed either from its parts via
Self::new (which computes the key ID) or from the text form via
Self::from_spec (which validates the declared key ID against the
recomputed one).
Implementations§
Source§impl NoteVerifierKey
impl NoteVerifierKey
Sourcepub fn new(name: &str, public_key: [u8; 32]) -> TrustResult<Self>
pub fn new(name: &str, public_key: [u8; 32]) -> TrustResult<Self>
Builds a verifier key from a name and public key, computing the
key ID per the signed-note rule
SHA-256(name ‖ 0x0A ‖ 0x01 ‖ pubkey)[..4].
§Errors
Returns TrustError::VerifierKey if name violates the key-name
rules.
Sourcepub fn from_spec(spec: &str) -> TrustResult<Self>
pub fn from_spec(spec: &str) -> TrustResult<Self>
Parses the text form <name>+<hex keyid>+<base64(0x01 ‖ pubkey)>.
Splits at the first two '+' characters (the base64 part may itself
contain '+'), then validates: name rules, exactly 8 hex chars of
key ID (upper- or lowercase, like Go), base64 decoding to exactly
33 bytes, first byte 0x01 (the Ed25519 algorithm byte), and the
declared key ID equal to the one recomputed from (name, pubkey) —
Go NewVerifier validates identically.
§Errors
Returns TrustError::VerifierKey with a specific reason on any
violation — this is TRUSTED operator input, diagnostics are safe.
Sourcepub fn to_spec(&self) -> String
pub fn to_spec(&self) -> String
Emits the text form with a lowercase-hex key ID (Go emits %08x).
Sourcepub fn public_key(&self) -> [u8; 32]
pub fn public_key(&self) -> [u8; 32]
The 32-byte Ed25519 public key.