Skip to main content

MintedKey

Struct MintedKey 

Source
pub struct MintedKey {
    pub key_id: KeyId,
    pub principal: Principal,
    pub digest: [u8; 32],
    pub secret: Zeroizing<Vec<u8>>,
}
Expand description

A freshly minted credential, returned exactly once.

The secret is Zeroizing, so the only copy the process holds is wiped when this value drops. The digest is suitable for durable storage; debug output exposes only the non-secret identifiers.

Nothing can recover the secret from the record. That is the point of storing digests, and it is also the constraint on issuance ordering: the record must be durable before the secret is disclosed, because a crash between the two leaves a credential the server has never heard of and no reconciliation can repair it.

Fields§

§key_id: KeyId

The non-secret identifier for this credential, used to revoke it.

§principal: Principal

The principal it authenticates as: the digest’s leading 128 bits.

§digest: [u8; 32]

HMAC-SHA256 of the secret under the server secret. This is what a tollgate_store::KeyDirectory stores.

§secret: Zeroizing<Vec<u8>>

The credential: 64 lowercase hexadecimal characters, exactly the bytes the digest covers. It is what is disclosed, what a customer presents (for example after Bearer ), and what a verifier is handed, with no encoding step anywhere between them. Hand it to its owner and drop it; it cannot be derived again from anything retained.

Trait Implementations§

Source§

impl Debug for MintedKey

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.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.