pub struct DTGCredential { /* private fields */ }Expand description
Defined DTG Credentials
Implementations§
Source§impl DTGCredential
impl DTGCredential
Sourcepub fn new_vmc(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
personhood: bool,
) -> Self
pub fn new_vmc( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, personhood: bool, ) -> Self
Creates a new Verified Memebrship Credential (VMC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until personhood: Whether this VMC can be used as a form of Personhood Credential - Adds PersonhoodCredential to the type array if true
Sourcepub fn new_vrc(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
) -> Self
pub fn new_vrc( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, ) -> Self
Creates a new Verified Relationship Credential (VRC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until
Sourcepub fn new_vic(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
) -> Self
pub fn new_vic( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, ) -> Self
Creates a new Verified Invitation Credential (VIC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until
Sourcepub fn new_vpc(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
) -> Self
pub fn new_vpc( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, ) -> Self
Creates a new Verified Persona Credential (VPC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until
Sourcepub fn new_vec(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
endorsement: Value,
) -> Self
pub fn new_vec( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, endorsement: Value, ) -> Self
Creates a new Verified Endorsement Credential (VEC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until endorsement: The endorsement details for this credential
Sourcepub fn new_vwc(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
digest: Option<String>,
witness_context: Option<WitnessContext>,
) -> Self
pub fn new_vwc( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, digest: Option<String>, witness_context: Option<WitnessContext>, ) -> Self
Creates a new Verified Witness Credential (VWC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until digest: Optional Witness cryptographic hash of the witnessed VRC (prevents misuse) witness_context: Optional Semantic context for the witness
Sourcepub fn new_rcard(
issuer: String,
subject: String,
valid_from: DateTime<Utc>,
valid_until: Option<DateTime<Utc>>,
card: Value,
) -> Self
pub fn new_rcard( issuer: String, subject: String, valid_from: DateTime<Utc>, valid_until: Option<DateTime<Utc>>, card: Value, ) -> Self
Creates a new Verified RCard Credential (VWC) issuer: The issuer DID of the credential subject: The DID of the subject of this credential valid_from: The datetime from which this credential is valid valid_until: Optional: The datetime this credential is valid until card: JSON Value representing a Jcard (RFC 7095) format
Source§impl DTGCredential
impl DTGCredential
Sourcepub fn credential(&self) -> &DTGCommon
pub fn credential(&self) -> &DTGCommon
get the raw credential
Sourcepub fn credential_mut(&mut self) -> &mut DTGCommon
pub fn credential_mut(&mut self) -> &mut DTGCommon
Get the raw credential as mutable
Sourcepub fn type_(&self) -> DTGCredentialType
pub fn type_(&self) -> DTGCredentialType
get the credential type
Sourcepub fn valid_from(&self) -> DateTime<Utc>
pub fn valid_from(&self) -> DateTime<Utc>
Returns the valid_from timestamp
Sourcepub fn valid_until(&self) -> Option<DateTime<Utc>>
pub fn valid_until(&self) -> Option<DateTime<Utc>>
Returns the valid until timestamp
Sourcepub fn proof_value(&self) -> Option<&str>
pub fn proof_value(&self) -> Option<&str>
Returns the proof value if signed else None
Sourcepub async fn sign(
&mut self,
signing_secret: &Secret,
create_time: Option<DateTime<Utc>>,
) -> Result<DataIntegrityProof, DTGCredentialError>
pub async fn sign( &mut self, signing_secret: &Secret, create_time: Option<DateTime<Utc>>, ) -> Result<DataIntegrityProof, DTGCredentialError>
Sign the credential using W3C Data Integrity Proof with JCS EdDSA 2022 signing_secret: The secret key to use to sign the credential create_time: Optional creation time for the proof, defaults to now if None
Sourcepub fn verify_proof_with_public_key(
&self,
public_key_bytes: &[u8],
) -> Result<VerificationProof, DTGCredentialError>
pub fn verify_proof_with_public_key( &self, public_key_bytes: &[u8], ) -> Result<VerificationProof, DTGCredentialError>
Verify the credential if you already know the public key bytes otherwise use the affinidi_tdk:verify_data() method public_key_bytes: The public key bytes to use to verify the credential
Sourcepub fn get_w3c_vc_version(&self) -> W3CVCVersion
pub fn get_w3c_vc_version(&self) -> W3CVCVersion
Is this credential a W3C VC Version 1.1 or 2.0 credential?
Sourcepub fn is_personhood_credential(&self) -> bool
pub fn is_personhood_credential(&self) -> bool
returns true if this credential a personhood credential (PHC)
Trait Implementations§
Source§impl Clone for DTGCredential
impl Clone for DTGCredential
Source§fn clone(&self) -> DTGCredential
fn clone(&self) -> DTGCredential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more