Skip to main content

Identity

Struct Identity 

Source
pub struct Identity<S: Subject>(/* private fields */);
Expand description

One identity this compiler derived, tagged by the subject it names.

Holding one means these thirty-two bytes came from a complete Transcript under the profile that transcript names, and would come out the same again from the same transcript on any machine.

§Authority

Collision resistance is claimed AS BLAKE3’s, for the transcript as Transcript specifies it, at the Version the deriving Profile declares — and nothing broader.

§Construction

The only road is Identity::derived, which takes a typed transcript; nothing wraps arbitrary bytes. S is a PhantomData parameter, so an identity naming one subject is a different type than one naming another regardless of bytes, and their derive-key contexts differ too — the separation is a runtime fact and not only a compile-time one.

§Nonclaims

It does not claim that two things this compiler considers different always have different transcripts; that is the transcript’s completeness, which each mint site owns and documents.

Implementations§

Source§

impl<S: Subject> Identity<S>

Source

pub fn derived(transcript: Transcript<'_>) -> Self

Derive one identity from its complete transcript. Deterministic and total: every transcript names an identity.

Source

pub fn derived_with_provenance(transcript: Transcript<'_>) -> (Self, Provenance)

Derive one identity and the record of how it was derived.

The record is for a value that is going to keep it — one whose identity a reader may be handed on its own and asked to account for. A caller with nowhere to put one takes Identity::derived, and the record is simply not made rather than made and carried by everything.

Source

pub const fn as_bytes(&self) -> &[u8; 32]

The identity’s thirty-two bytes, borrowed for comparison and for rendering.

Trait Implementations§

Source§

impl<S: Clone + Subject> Clone for Identity<S>

Source§

fn clone(&self) -> Identity<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S: Copy + Subject> Copy for Identity<S>

Source§

impl<S: Subject> Debug for Identity<S>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<S: Subject> Eq for Identity<S>

Source§

impl<S: Subject> Hash for Identity<S>

Source§

fn hash<H: Hasher>(&self, into: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<S: Subject> PartialEq for Identity<S>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Identity<S>
where PhantomData<S>: Freeze,

§

impl<S> RefUnwindSafe for Identity<S>

§

impl<S> Send for Identity<S>
where PhantomData<S>: Send,

§

impl<S> Sync for Identity<S>
where PhantomData<S>: Sync,

§

impl<S> Unpin for Identity<S>
where PhantomData<S>: Unpin,

§

impl<S> UnsafeUnpin for Identity<S>

§

impl<S> UnwindSafe for Identity<S>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <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.