Skip to main content

DigestibleSecret

Trait DigestibleSecret 

Source
pub trait DigestibleSecret {
    // Required method
    fn as_bytes(&self) -> &[u8] ;

    // Provided methods
    fn update_digest<D: Digest>(&self, d: D, domain: impl AsRef<str>) -> D { ... }
    fn derive_scalar<D>(&self, d: D, domain: impl AsRef<str>) -> Scalar
       where D: Digest<OutputSize = U64> { ... }
    fn derive_bytes<D>(&self, d: D, domain: impl AsRef<str>) -> Vec<u8> 
       where D: Digest { ... }
    fn derive_id<D>(&self, d: D, domain: impl AsRef<str>) -> Id
       where D: Digest<OutputSize = U32> { ... }
    fn derive_hs256<D>(&self, d: D, domain: impl AsRef<str>) -> HS256
       where D: Digest { ... }
    fn derive_sealing_key<D>(&self, d: D, domain: impl AsRef<str>) -> SealingKey
       where D: Digest<OutputSize = U32> { ... }
}
Expand description

Secret bytes to derive secrets from via a hash

Required Methods§

Source

fn as_bytes(&self) -> &[u8]

Provided Methods§

Source

fn update_digest<D: Digest>(&self, d: D, domain: impl AsRef<str>) -> D

Inserts this secret in the given digest

Source

fn derive_scalar<D>(&self, d: D, domain: impl AsRef<str>) -> Scalar
where D: Digest<OutputSize = U64>,

Creates a Scalar from this secret

Source

fn derive_bytes<D>(&self, d: D, domain: impl AsRef<str>) -> Vec<u8>
where D: Digest,

Creates Vec<u8> from this secret.

Source

fn derive_id<D>(&self, d: D, domain: impl AsRef<str>) -> Id
where D: Digest<OutputSize = U32>,

Creates an Id from this secret.

Source

fn derive_hs256<D>(&self, d: D, domain: impl AsRef<str>) -> HS256
where D: Digest,

Creates a HS256 from this secret.

Source

fn derive_sealing_key<D>(&self, d: D, domain: impl AsRef<str>) -> SealingKey
where D: Digest<OutputSize = U32>,

Creates a (256-bit) crate::misc::crypto::SealingKey from this secret.

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.

Implementations on Foreign Types§

Source§

impl DigestibleSecret for &[u8]

Source§

fn as_bytes(&self) -> &[u8]

Implementors§