Skip to main content

SecretId

Trait SecretId 

Source
pub trait SecretId {
    type PublicId: PublicId;

    // Required methods
    fn public_id(&self) -> &Self::PublicId;
    fn sign_detached(
        &self,
        data: &[u8],
    ) -> <Self::PublicId as PublicId>::Signature;
    fn encrypt<M: AsRef<[u8]>>(
        &self,
        to: &Self::PublicId,
        msg: M,
    ) -> Option<Vec<u8>>;
    fn decrypt(&self, from: &Self::PublicId, ct: &[u8]) -> Option<Vec<u8>>;

    // Provided method
    fn create_proof(&self, data: &[u8]) -> Proof<Self::PublicId> { ... }
}
Expand description

The secret identity of a node. It provides functionality to allow it to be used as an asymmetric signing secret key and to also yield the associated public identity.

Required Associated Types§

Source

type PublicId: PublicId

The associated public identity type.

Required Methods§

Source

fn public_id(&self) -> &Self::PublicId

Returns the associated public identity.

Source

fn sign_detached(&self, data: &[u8]) -> <Self::PublicId as PublicId>::Signature

Creates a detached Signature of data.

Source

fn encrypt<M: AsRef<[u8]>>( &self, to: &Self::PublicId, msg: M, ) -> Option<Vec<u8>>

Encrypts the message using own Rng to to

Source

fn decrypt(&self, from: &Self::PublicId, ct: &[u8]) -> Option<Vec<u8>>

Decrypt message from from.

Provided Methods§

Source

fn create_proof(&self, data: &[u8]) -> Proof<Self::PublicId>

Creates a Proof of data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§