Skip to main content

SettlementAttestation

Struct SettlementAttestation 

Source
pub struct SettlementAttestation {
    pub issuer_did: String,
    pub settlement_id: String,
    pub unit: UnitRef,
    pub destination_did: String,
    pub amount_minor: u128,
    pub grant_cid: Option<Vec<u8>>,
    pub settled_at: u64,
    pub signature: Vec<u8>,
}
Expand description

A settlement attestation: the signed, self-contained claim that a specific settlement committed, and therefore that a specific issuance is owed.

Fields§

§issuer_did: String

DID of the party that signed this attestation (the settlement authority). Verification resolves key material from this, so it is part of the signed body rather than supplied alongside it.

§settlement_id: String

The settlement row this attests to. Bound into the signed body so an attestation cannot be presented under a different id.

§unit: UnitRef

The credit unit to be issued.

§destination_did: String

The pseudonymous destination identity for the issued credits.

§amount_minor: u128

Amount in minor units.

§grant_cid: Option<Vec<u8>>

The allocation grant this settlement backs, if any.

§settled_at: u64

When the settlement committed (unix seconds).

§signature: Vec<u8>

COSE composite signature (EdDSA + ML-DSA-65) over Self::signing_input.

Implementations§

Source§

impl SettlementAttestation

Source

pub fn signing_input(&self) -> Result<Vec<u8>, PayError>

The exact bytes a signature must cover: the canonical body without the signature element.

Source

pub fn encode(&self) -> Result<Vec<u8>, PayError>

The canonical wire bytes, signature included. This is what travels in the capnp attestation :Data field and what a future exchange record embeds verbatim.

Source

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

Parse canonical wire bytes.

Rejects any input that is not already canonical. Accepting a non-canonical encoding and normalizing it would give the same logical attestation two different CIDs, which defeats content-addressing it.

Source

pub fn cid(&self) -> Result<[u8; 32], PayError>

Content address: blake3 over the canonical bytes.

Stable across processes and round-trips, so an exchange record can carry the attestation and its CID together and any peer can re-derive one from the other.

Trait Implementations§

Source§

impl Clone for SettlementAttestation

Source§

fn clone(&self) -> SettlementAttestation

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 SettlementAttestation

Source§

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

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

impl<'de> Deserialize<'de> for SettlementAttestation

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 PartialEq for SettlementAttestation

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SettlementAttestation

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 Eq for SettlementAttestation

Source§

impl StructuralPartialEq for SettlementAttestation

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,