pub struct DTGCommon {
pub context: Vec<String>,
pub type_: Vec<String>,
pub id: Option<String>,
pub issuer: String,
pub valid_from: DateTime<Utc>,
pub valid_until: Option<DateTime<Utc>>,
pub task_context: Option<String>,
pub credential_subject: CredentialSubject,
pub proof: Option<DataIntegrityProof>,
}Expand description
All DTG Credentials follow a common structure.
Fields§
§context: Vec<String>JSON-LD links to contexts Must contain at least:
type_: Vec<String>Credential type identifiers Must contain at least: DTGCredential VerifiableCredential
id: Option<String>OPTIONAL identifier for this specific credential, per the W3C VC Data Model.
When present it MUST be a single URL. A urn:uuid: URN is the usual choice for a
credential with no dereferenceable home.
This is the handle a holder or verifier stores the credential under, so it is what
makes re-delivery of the same credential idempotent and re-issuance of a different one
recognisable as a renewal rather than a duplicate. A counterparty that keys credentials
by id cannot accept one that has none — so issue with an id unless you know nobody
on the other side needs it.
§Set it before signing
A Data Integrity proof covers the credential minus its proof, which includes this
property. Set it while building — DTGCredential::with_id — never after
DTGCredential::sign, which would leave a document whose proof no longer verifies.
issuer: StringDID of the entity issuing this credential
valid_from: DateTime<Utc>ISO 8601 format of when this credentials become valid from
valid_until: Option<DateTime<Utc>>ISO 8601 format of when these credentials are valid to
task_context: Option<String>Identifier (threadId) of the trust task exchange in which this credential was issued.
REQUIRED for DTGCredentialType::Witness credentials, OPTIONAL for all other DTG
credential types. A DTG credential without a taskContext MUST be interpretable
standing alone, independent of any exchange.
NOTE: A verifier MUST NOT interpret a taskContext-bearing credential as proof that
the associated trust task completed unless the matching trust task outcome evidence is
also present and verified.
credential_subject: CredentialSubjectThe assertion between the entities involved
proof: Option<DataIntegrityProof>Cryptographic proof of credential authenticity
Implementations§
Source§impl DTGCommon
impl DTGCommon
Sourcepub fn signed(&self) -> bool
pub fn signed(&self) -> bool
Has this credential been signed? Returns true if a proof exists NOTE: This does NOT validate the proof itself
Sourcepub fn id(&self) -> Option<&str>
pub fn id(&self) -> Option<&str>
This credential’s own identifier, if it has one. See DTGCommon::id.
Sourcepub fn valid_from(&self) -> DateTime<Utc>
pub fn valid_from(&self) -> DateTime<Utc>
The credential is valid from this timestamp
Sourcepub fn valid_until(&self) -> Option<DateTime<Utc>>
pub fn valid_until(&self) -> Option<DateTime<Utc>>
The credential is valid until this timestamp, if set
Sourcepub fn task_context(&self) -> Option<&str>
pub fn task_context(&self) -> Option<&str>
The threadId of the trust task exchange this credential was issued in, if set