pub struct Transcript<'material> { /* private fields */ }Expand description
The COMPLETE preimage one Identity is derived from.
A transcript is the exact byte string handed to the digest, and the specification is complete: an independent implementation needs what follows and nothing else.
Two primitives.
u32be(n) and u64be(n) are the integer in four or eight big-endian bytes; bytes(x) is u64be(x.len()) followed by the bytes of x, and every variable-length member is written that way, so no two member sequences can be cut at a different boundary and produce one byte string.
The members, in exactly this order, with no separators and no padding:
| # | member | encoding |
|---|---|---|
| 1 | profile stem | bytes(utf8) of Profile::stem |
| 2 | profile name | bytes(utf8) of Profile::name |
| 3 | profile version | u32be, that grammar’s own position |
| 4 | subject | bytes(utf8) of Subject::NAME |
| 5 | role | bytes(utf8) of Role::name |
| 6 | role slot | one byte, Role::slot |
| 7 | anchoring | one byte, Anchoring::slot |
| 8 | anchor | bytes(…) — empty when rooted, else the full thirty-two |
| 9 | material | bytes(…) — the full material, never a fold |
| 10 | position | u32be |
The derive-key context is Profile::context_for over the same subject and role, and the identity is blake3::derive_key(context, transcript).
The subject’s stem is a segment of that context and is not a member here, so two subjects spelled alike under different stems derive under different keys.
The generator is not a member either: it is carried for the derivation record (Transcript::provenance) and written into no preimage.
Implementations§
Source§impl Transcript<'_>
impl Transcript<'_>
Sourcepub fn encoded<S: Subject>(&self) -> Vec<u8> ⓘ
pub fn encoded<S: Subject>(&self) -> Vec<u8> ⓘ
The transcript’s bytes for one identity subject, exactly as the specification on Transcript states them.
§Authority
The subject is the TYPE’s and never an argument. Member four of the preimage is the subject’s declared name, and it is part of what separates one subject’s identities from another’s — so an encoder that took the name as text would let a caller write member four to any key space it could spell, and the typed identity above it would be a promise this road never had to keep.
Source§impl<'material> Transcript<'material>
impl<'material> Transcript<'material>
Sourcepub const fn under_profile(
profile: Profile,
role: Role,
anchoring: Anchoring,
material: &'material [u8],
position: u32,
) -> Self
pub const fn under_profile( profile: Profile, role: Role, anchoring: Anchoring, material: &'material [u8], position: u32, ) -> Self
Write a transcript under a grammar the caller names.
The road for a preimage whose grammar is the caller’s own; the four roads below name a role and take this compiler’s grammar for it.
Sourcepub const fn under(
role: Role,
anchoring: Anchoring,
material: &'material [u8],
position: u32,
) -> Self
pub const fn under( role: Role, anchoring: Anchoring, material: &'material [u8], position: u32, ) -> Self
Write a transcript under an anchoring the caller already decided.
The road for a mint site whose anchor depends on a typed posture rather than on which family of identity it holds — a plan hangs off whatever caused it, and what caused it is a sum type.
Sourcepub const fn rooted(
role: Role,
material: &'material [u8],
position: u32,
) -> Self
pub const fn rooted( role: Role, material: &'material [u8], position: u32, ) -> Self
Derive under no anchor at all — the root of one derivation chain.
Sourcepub const fn under_owner(
role: Role,
anchor: &OwnerIdentity,
material: &'material [u8],
position: u32,
) -> Self
pub const fn under_owner( role: Role, anchor: &OwnerIdentity, material: &'material [u8], position: u32, ) -> Self
Derive under an identity a CONSUMER minted.
Sourcepub fn under_projection<S: Subject>(
role: Role,
anchor: &Identity<S>,
material: &'material [u8],
position: u32,
) -> Self
pub fn under_projection<S: Subject>( role: Role, anchor: &Identity<S>, material: &'material [u8], position: u32, ) -> Self
Derive under another identity this compiler derived.
Sourcepub const fn generator(&self) -> GeneratorIdentity
pub const fn generator(&self) -> GeneratorIdentity
The generator this transcript records.
Recorded and never written: the encoding carries no member for it, and this road exists so the derivation record can.
Sourcepub fn provenance<S: Subject>(&self) -> Provenance
pub fn provenance<S: Subject>(&self) -> Provenance
The derivation record this transcript leaves for one identity subject.
Trait Implementations§
Source§impl<'material> Clone for Transcript<'material>
impl<'material> Clone for Transcript<'material>
Source§fn clone(&self) -> Transcript<'material>
fn clone(&self) -> Transcript<'material>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more