pub struct Identity { /* private fields */ }Expand description
Identity struct is an abstraction of public & secret key related operations.
It is basically a wrapper of the keypair (which holds public & secret keys) and a context that will be used for signing.
Implementations§
Source§impl Identity
impl Identity
Sourcepub fn open_or_create<B: AsRef<Path>>(
base_directory: B,
) -> Result<Self, IdentityError>
pub fn open_or_create<B: AsRef<Path>>( base_directory: B, ) -> Result<Self, IdentityError>
Opens the existing identity, or creates a new one.
Sourcepub fn open<B: AsRef<Path>>(
base_directory: B,
) -> Result<Option<Self>, IdentityError>
pub fn open<B: AsRef<Path>>( base_directory: B, ) -> Result<Option<Self>, IdentityError>
Opens the existing identity, returns Ok(None) if it doesn’t exist.
Sourcepub fn create<B: AsRef<Path>>(base_directory: B) -> Result<Self, IdentityError>
pub fn create<B: AsRef<Path>>(base_directory: B) -> Result<Self, IdentityError>
Creates new identity, overrides identity that might already exist.
Sourcepub fn public_key(&self) -> Ed25519PublicKey
pub fn public_key(&self) -> Ed25519PublicKey
Returns the public key of the identity.
Sourcepub fn secret_key(&self) -> [u8; 32]
pub fn secret_key(&self) -> [u8; 32]
Returns the secret key of the identity.
Sourcepub fn sign_pre_seal_hash(&self, pre_seal_hash: &Blake3Hash) -> Ed25519Signature
pub fn sign_pre_seal_hash(&self, pre_seal_hash: &Blake3Hash) -> Ed25519Signature
Sign block’s pre-seal hash
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnwindSafe for Identity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more