pub struct SdJwtVc { /* private fields */ }Expand description
Builder for an SD-JWT-VC.
Implementations§
Source§impl SdJwtVc
impl SdJwtVc
Sourcepub fn new(vct: impl Into<String>, issuer: impl Into<String>) -> Self
pub fn new(vct: impl Into<String>, issuer: impl Into<String>) -> Self
vct = credential type (e.g. “Web4Presence”); issuer = the issuer DID.
pub fn typ(self, typ: impl Into<String>) -> Self
Sourcepub fn iat(self, iat: i64) -> Self
pub fn iat(self, iat: i64) -> Self
Override issued-at (unix seconds) — for reproducible issuance/tests.
Sourcepub fn holder_binding(self, holder_pubkey: &PublicKey) -> Self
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).
Sourcepub fn claim(self, name: impl Into<String>, value: Value) -> Self
pub fn claim(self, name: impl Into<String>, value: Value) -> Self
An always-disclosed claim (appears in cleartext in the JWT payload).
Sourcepub fn sd_claim(self, name: impl Into<String>, value: Value) -> Self
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).
Sourcepub fn sd_claim_salted(
self,
salt: impl Into<String>,
name: impl Into<String>,
value: Value,
) -> Self
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.
Sourcepub fn prepare(&self, kid: &str) -> UnsignedSdJwtVc
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).