Skip to main content

KeyAttestation

Struct KeyAttestation 

Source
pub struct KeyAttestation {
    pub attestation_version: String,
    pub controller: String,
    pub identity: WorkloadIdentity,
    pub org_wide: bool,
    pub key_id: String,
    pub algorithm: String,
    pub public_key_jwk: Jwk,
    pub key_fingerprint: String,
    pub not_before: DateTime<Utc>,
    pub not_after: DateTime<Utc>,
    pub token_hash: String,
}
Expand description

The acdp-key-attestation/1 metadata of an acdp:key-attestation body (§5.3). Closed at every level; build it with KeyAttestation::from_metadata or KeyAttestation::from_body, which also check the rules the schema cannot express.

Fields§

§attestation_version: String§controller: String

The controller’s did:web DID.

§identity: WorkloadIdentity

The verified workload identity.

§org_wide: bool

Copied from the controller’s DID-document entry.

§key_id: String

<controller>#acdp-kl-<hex> (§6.1).

§algorithm: String

ed25519 or ecdsa-p256.

§public_key_jwk: Jwk

The attested key.

§key_fingerprint: String

The attested key’s RFC-ACDP-0010 §6 fingerprint.

§not_before: DateTime<Utc>

Start of the window, inclusive.

§not_after: DateTime<Utc>

End of the window, exclusive.

§token_hash: String

sha256: + hex SHA-256 of the token.

Implementations§

Source§

impl KeyAttestation

Source

pub fn from_metadata(metadata: &Value) -> Result<Self, AcdpError>

Parse the metadata object and check §5.3: the closed schema, the fingerprint of public_key_jwk, the key_id derived from it, the algorithm matching the key type, and the window bound.

Source

pub fn from_body(body: &Body) -> Result<Self, AcdpError>

Check an attestation body against §5.3 and return its metadata: the body shape (type, public, version 1, no lineage or links), agent_id equal to did:web: plus the ctx_id authority, the schema_uri, acdp_version ≥ 0.5.0 and the metadata rules.

The body’s own hash, signature and receipt are the caller’s to verify (§8.1 step 1).

Source

pub fn binds(&self, agent_id: &AgentDid, signature: &Signature) -> bool

§6.2 / §8.1 step 3: agent_id, signature.key_id and signature.algorithm match this attestation.

Source

pub fn window_contains(&self, t: DateTime<Utc>) -> bool

True when t lies in [not_before, not_after).

Source

pub fn signer(&self) -> KeylessSigner

The signer this attestation makes of a body (§7).

Trait Implementations§

Source§

impl Clone for KeyAttestation

Source§

fn clone(&self) -> Self

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 Debug for KeyAttestation

Source§

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

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

impl<'de> Deserialize<'de> for KeyAttestation

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for KeyAttestation

Source§

impl PartialEq for KeyAttestation

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
Source§

impl Serialize for KeyAttestation

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for KeyAttestation

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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, !>

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.