pub struct Registry { /* private fields */ }Expand description
Known public keys, indexed by actor id. This is the verification side’s whole world: an unregistered key is an unknown author.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn register(
&mut self,
public_key_bytes: &[u8; 32],
) -> Result<ContentHash, IdentityError>
pub fn register( &mut self, public_key_bytes: &[u8; 32], ) -> Result<ContentHash, IdentityError>
Registers a public key and returns the actor id it now answers to.
§Errors
Returns IdentityError::BadKey when the bytes are not a valid
ed25519 public key.
Sourcepub fn verify_entry(
&self,
entry: &OpEntry,
) -> Result<ContentHash, IdentityError>
pub fn verify_entry( &self, entry: &OpEntry, ) -> Result<ContentHash, IdentityError>
Verifies entry’s author signature and returns the author’s id.
§Errors
IdentityError::Unsigned for a missing signature,
IdentityError::UnknownKey for an unregistered author, and
IdentityError::BadSignature when the signature does not match
the entry (tampered entry or wrong key).
Sourcepub fn verify_submission(
&self,
channel: &str,
payload: &[u8],
sig: &Witness,
) -> Result<ContentHash, IdentityError>
pub fn verify_submission( &self, channel: &str, payload: &[u8], sig: &Witness, ) -> Result<ContentHash, IdentityError>
Verifies a signature over submission content — the sequencer-side check before a position is assigned. Returns the author’s id.
§Errors
Same failure modes as Registry::verify_entry, minus
IdentityError::Unsigned.
Sourcepub fn verify_signing_hash(
&self,
signing: &ContentHash,
sig: &Witness,
) -> Result<ContentHash, IdentityError>
pub fn verify_signing_hash( &self, signing: &ContentHash, sig: &Witness, ) -> Result<ContentHash, IdentityError>
Same check, for a caller that has already computed the submission’s
choir_oplog::signing_hash — an admission policy that indexes
submissions by it, for instance. Hashing the same bytes twice per
op is measurable on the write path, and the node’s allocation
budget is the test that says so.
§Errors
Same failure modes as Registry::verify_submission.