pub struct SeedHandle { /* private fields */ }Expand description
A handle to a cryptographic seed with TTL and memory security.
The seed is held in memory until the TTL expires (or indefinitely if None). On drop, the seed is zeroized. Sovereign tier uses mlock to prevent swapping.
Implementations§
Source§impl SeedHandle
impl SeedHandle
Sourcepub fn new(seed: &[u8], ttl: Option<Duration>) -> Self
pub fn new(seed: &[u8], ttl: Option<Duration>) -> Self
Create a new seed handle from raw seed bytes.
§Arguments
seed- Raw seed bytes (will be copied and zeroized on drop)ttl- Optional time-to-live. None = never expires.
Sourcepub fn with_tier(seed: &[u8], ttl: Option<Duration>, tier: MemoryTier) -> Self
pub fn with_tier(seed: &[u8], ttl: Option<Duration>, tier: MemoryTier) -> Self
Create with explicit memory tier.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this handle has expired.
Sourcepub fn as_bytes_unchecked(&self) -> &[u8] ⓘ
pub fn as_bytes_unchecked(&self) -> &[u8] ⓘ
Get seed bytes without TTL check (use with caution).
Sourcepub fn fingerprint(&self) -> [u8; 32]
pub fn fingerprint(&self) -> [u8; 32]
Compute a fingerprint (SHA3-256 of the seed).
This is safe to share publicly – it’s a one-way hash of the seed.
Sourcepub fn derive_key(
&self,
domain: &str,
info: &str,
len: usize,
) -> Option<Vec<u8>>
pub fn derive_key( &self, domain: &str, info: &str, len: usize, ) -> Option<Vec<u8>>
Derive a domain-specific key using HKDF-SHA3-256.
§Arguments
domain- Domain string (e.g., “signing”, “encryption”, “did:origin:abc”)info- Additional info for key separation Derive a domain-specific key using HKDF-SHA3-256.
Sourcepub fn tier(&self) -> MemoryTier
pub fn tier(&self) -> MemoryTier
Get the memory tier.
Trait Implementations§
Source§impl Clone for SeedHandle
impl Clone for SeedHandle
Source§fn clone(&self) -> SeedHandle
fn clone(&self) -> SeedHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SeedHandle
impl Debug for SeedHandle
Source§impl Drop for SeedHandle
impl Drop for SeedHandle
Auto Trait Implementations§
impl Freeze for SeedHandle
impl RefUnwindSafe for SeedHandle
impl Send for SeedHandle
impl Sync for SeedHandle
impl Unpin for SeedHandle
impl UnsafeUnpin for SeedHandle
impl UnwindSafe for SeedHandle
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,
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