Skip to main content

SdJwtVc

Struct SdJwtVc 

Source
pub struct SdJwtVc { /* private fields */ }
Expand description

Builder for an SD-JWT-VC.

Implementations§

Source§

impl SdJwtVc

Source

pub fn new(vct: impl Into<String>, issuer: impl Into<String>) -> Self

vct = credential type (e.g. “Web4Presence”); issuer = the issuer DID.

Source

pub fn typ(self, typ: impl Into<String>) -> Self

Source

pub fn iat(self, iat: i64) -> Self

Override issued-at (unix seconds) — for reproducible issuance/tests.

Source

pub fn holder_binding(self, holder_pubkey: &PublicKey) -> Self

Bind the credential to a holder key (cnf). The holder must later sign a Key-Binding JWT with the matching private key to present (see present). Emitted as a standard JWK (OKP/Ed25519).

Source

pub fn claim(self, name: impl Into<String>, value: Value) -> Self

An always-disclosed claim (appears in cleartext in the JWT payload).

Source

pub fn sd_claim(self, name: impl Into<String>, value: Value) -> Self

A selectively-disclosable claim (replaced by a digest; cleartext in a detached disclosure the holder may withhold).

Source

pub fn sd_claim_salted( self, salt: impl Into<String>, name: impl Into<String>, value: Value, ) -> Self

SD claim with a fixed salt — reproducible issuance/tests.

Source

pub fn prepare(&self, kid: &str) -> UnsignedSdJwtVc

Build the unsigned signing input (header + payload) and the disclosures, for issuance through an external signer (HSM, remote vault, the Web4 hub’s RemoteSigner) that never exposes a raw KeyPair. The signer EdDSA-signs UnsignedSdJwtVc::signing_bytes; the resulting signature is assembled via UnsignedSdJwtVc::into_compact. issue is the in-process convenience over this. kid is the issuer verification method id (e.g. <did>#key-0).

Source

pub fn issue(&self, issuer_key: &KeyPair, kid: &str) -> String

Issue: build + sign the JWS and emit the compact SD-JWT-VC. kid is the issuer verification method id (e.g. <did>#key-0).

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V