pub struct MasterKey(/* private fields */);Expand description
A 32-byte account master key.
Implementations§
Source§impl MasterKey
impl MasterKey
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a fresh master key from the OS CSPRNG (client-side at account creation).
Sourcepub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn from_bytes(bytes: [u8; 32]) -> Self
Wrap raw key bytes (e.g. after unwrapping the escrow blob).
Sourcepub fn derive_default_album_id(&self) -> Uuid
pub fn derive_default_album_id(&self) -> Uuid
Derive the default album’s album_id deterministically. This derives an ID,
never a key — the default album has its own random per-epoch AMK like any album.
Sourcepub fn seal(&self, plaintext: &[u8]) -> Vec<u8> ⓘ
pub fn seal(&self, plaintext: &[u8]) -> Vec<u8> ⓘ
Symmetrically seal plaintext under the master key (AES-256-GCM, random nonce).
Used to wrap device identity private keys. Output is nonce(12) ‖ ciphertext+tag.
Sourcepub fn open(&self, blob: &[u8]) -> Result<Vec<u8>, CryptoError>
pub fn open(&self, blob: &[u8]) -> Result<Vec<u8>, CryptoError>
Open a blob produced by seal. Returns CryptoError::Auth on a
wrong key or tampered ciphertext.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MasterKey
impl RefUnwindSafe for MasterKey
impl Send for MasterKey
impl Sync for MasterKey
impl Unpin for MasterKey
impl UnsafeUnpin for MasterKey
impl UnwindSafe for MasterKey
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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