pub struct Key { /* private fields */ }Expand description
A 256-bit FLOE key that zeroizes its owned bytes on drop.
Use Key::generate for a fresh random key or Key::from_bytes when
importing existing key material.
Implementations§
Source§impl Key
impl Key
Sourcepub fn generate() -> Result<Self>
pub fn generate() -> Result<Self>
Generates a new 256-bit FLOE key with the build default provider.
§Errors
Returns Error::ProviderSelectionRequired when multiple providers
are compiled, or Error::RngFailure if the provider cannot obtain
secure randomness.
Sourcepub fn generate_with_provider(provider: Provider) -> Result<Self>
pub fn generate_with_provider(provider: Provider) -> Result<Self>
Generates a new 256-bit FLOE key bound to provider.
§Errors
Returns Error::RngFailure if the provider cannot obtain secure
randomness.
Sourcepub const fn from_bytes(bytes: [u8; 32]) -> Self
pub const fn from_bytes(bytes: [u8; 32]) -> Self
Imports an existing 256-bit key using the build default provider.
Provider resolution is deferred until Self::provider or the first
cryptographic operation.
Sourcepub const fn from_bytes_with_provider(
bytes: [u8; 32],
provider: Provider,
) -> Self
pub const fn from_bytes_with_provider( bytes: [u8; 32], provider: Provider, ) -> Self
Imports an existing 256-bit key bound to provider.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
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