pub enum CredentialSubject {
Endorsement(CredentialSubjectEndorsement),
RCard(CredentialSubjectRCard),
Basic(CredentialSubjectBasic),
Witness(CredentialSubjectWitness),
Authority(CredentialSubjectAuthority),
Delegation(CredentialSubjectDelegation),
Membership(CredentialSubjectMembership),
}Expand description
This represents all possible credential subjects The order of the enum is important as it will match on first match
Variants§
Endorsement(CredentialSubjectEndorsement)
Verifiable Endorsement Credential subject
RCard(CredentialSubjectRCard)
The r-card is a verifiable data structure (VDS), not a DTGCredential subtype. See DTGCredentialType::RCard. This variant will be removed in a future release.
R-Card Credential subject
Basic(CredentialSubjectBasic)
Credential Subject of just id
Used by a community-issued VMC, and by VRC, VIC and VPC
Witness(CredentialSubjectWitness)
Verifiable Witness Credential subject
Authority(CredentialSubjectAuthority)
Verifiable Authority Credential subject.
Unambiguous under the untagged match: no other DTG subject carries an authority
member, and deny_unknown_fields keeps a subject that does not have one from
landing here.
Delegation(CredentialSubjectDelegation)
Verifiable Delegation Credential subject.
Unambiguous for the same reason as CredentialSubject::Authority: delegation is
carried by no other DTG subject.
Membership(CredentialSubjectMembership)
Membership Credential subject, carrying the OPTIONAL digest that a member-issued
VMC MUST set.
§Never selected by the untagged match, deliberately
This variant sits last because its two shapes are already claimed above: { id } is
CredentialSubject::Basic, and { id, digest } is indistinguishable from a VWC
subject with no witnessContext, which CredentialSubject::Witness takes first.
Nothing in the subject object itself separates a membership acknowledgement from a
witness attestation — only the credential’s type does.
So the shape is not decided here. TryFrom<DTGCommon> for DTGCredential normalizes
whichever variant the untagged match landed on into this one when type includes
MembershipCredential, the same way it already re-wraps a Basic subject as
Witness on a VWC. Deserialization is therefore deterministic rather than
order-dependent, and a Membership subject reaching a matcher has been through that
normalization.
Trait Implementations§
Source§impl Clone for CredentialSubject
impl Clone for CredentialSubject
Source§fn clone(&self) -> CredentialSubject
fn clone(&self) -> CredentialSubject
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more