Skip to main content

Registry

Struct Registry 

Source
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

Source

pub fn new() -> Self

Creates an empty registry.

Source

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.

Source

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).

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for Registry

Source§

fn default() -> Registry

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.