Skip to main content

RestoreCode

Struct RestoreCode 

Source
pub struct RestoreCode {
    pub store: StoreId,
    pub member: MemberId,
    pub member_keys: MemberKeys,
    pub storage: SecretBytes,
}
Expand description

A person’s keys and the store’s identity and location (§13.1).

Fields§

§store: StoreId

The store’s id.

§member: MemberId

The stable member the private pair belongs to. Restore requires this id’s current pair; an old code cannot rebind it (D13).

§member_keys: MemberKeys

Crypto owns both member key pairs, their encoding and erasure.

§storage: SecretBytes

Storage location only, interpreted by storage; never credentials.

Implementations§

Source§

impl RestoreCode

Source

pub const TEXT_PREFIX: &'static str = "CVR1-"

How a restore code’s text starts: its kind and version.

Source

pub fn to_bytes(&self) -> Result<Zeroizing<Vec<u8>>, Error>

Encode a bounded frame into a buffer erased on drop, allocated once.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Decode a borrowed frame; every owned copy of private material erases on drop.

Source

pub fn to_text(&self) -> Result<Zeroizing<String>, Error>

Canonical uppercase base32, with CRC-32C, erased on drop.

Source

pub fn from_text(text: &str) -> Result<Self, Error>

Decode borrowed text without retaining any unerased private copies.

Trait Implementations§

Source§

impl Debug for RestoreCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,