pub trait Credential: MaybeIdentified {
type Subject;
type Issuer: Identified;
type Status: MaybeIdentified + Typed;
type Schema: Identified + Typed;
type RelatedResource: RelatedResource;
type RefreshService: Typed;
type TermsOfUse: MaybeIdentified + Typed;
type Evidence: MaybeIdentified + Typed;
Show 16 methods
// Required method
fn issuer(&self) -> &Self::Issuer;
// Provided methods
fn id(&self) -> Option<&Uri> { ... }
fn additional_types(&self) -> &[String] { ... }
fn types(&self) -> CredentialTypes<'_> ⓘ { ... }
fn name(&self) -> Option<impl AnyInternationalString> { ... }
fn description(&self) -> Option<impl AnyInternationalString> { ... }
fn credential_subjects(&self) -> &[Self::Subject] { ... }
fn valid_from(&self) -> Option<DateTimeStamp> { ... }
fn valid_until(&self) -> Option<DateTimeStamp> { ... }
fn credential_status(&self) -> &[Self::Status] { ... }
fn credential_schemas(&self) -> &[Self::Schema] { ... }
fn related_resources(&self) -> &[Self::RelatedResource] { ... }
fn refresh_services(&self) -> &[Self::RefreshService] { ... }
fn terms_of_use(&self) -> &[Self::TermsOfUse] { ... }
fn evidence(&self) -> &[Self::Evidence] { ... }
fn validate_credential<E>(&self, env: &E) -> ClaimsValidity
where E: DateTimeProvider { ... }
}Expand description
Verifiable Credential.
Required Associated Types§
Sourcetype Issuer: Identified
type Issuer: Identified
Return type of the issuer method.
type Status: MaybeIdentified + Typed
type Schema: Identified + Typed
type RelatedResource: RelatedResource
Sourcetype RefreshService: Typed
type RefreshService: Typed
Refresh service.
Sourcetype TermsOfUse: MaybeIdentified + Typed
type TermsOfUse: MaybeIdentified + Typed
Terms of Use type.
Terms of use can be utilized by an issuer or a holder to communicate the terms under which a verifiable credential or verifiable presentation was issued.
Sourcetype Evidence: MaybeIdentified + Typed
type Evidence: MaybeIdentified + Typed
Evidence type.
Can be included by an issuer to provide the verifier with additional supporting information in a verifiable credential.
Required Methods§
Sourcefn issuer(&self) -> &Self::Issuer
fn issuer(&self) -> &Self::Issuer
Issuer.
It is recommended that the URL be one which, if dereferenced, results in a controller document, as defined in VC-DATA-INTEGRITY or VC-JOSE-COSE, about the issuer that can be used to verify the information expressed in the credential.
Provided Methods§
Sourcefn additional_types(&self) -> &[String]
fn additional_types(&self) -> &[String]
Types that are not VerifiableCredential.
Since the VerifiableCredential type is required, it is omitted from
the value returned by this function. If you need to iterate over
all the credential types, including VerifiableCredential, use the
Self::types method.
fn types(&self) -> CredentialTypes<'_> ⓘ
Sourcefn name(&self) -> Option<impl AnyInternationalString>
fn name(&self) -> Option<impl AnyInternationalString>
Name of the credential.
Ideally, the name of a credential is concise, human-readable, and could enable an individual to quickly differentiate one credential from any other credentials that they might hold.
See: https://www.w3.org/TR/vc-data-model-2.0/#names-and-descriptions
Sourcefn description(&self) -> Option<impl AnyInternationalString>
fn description(&self) -> Option<impl AnyInternationalString>
Details about the credential.
Ideally, the description of a credential is no more than a few sentences in length and conveys enough information about the credential to remind an individual of its contents without their having to look through the entirety of the claims.
See: https://www.w3.org/TR/vc-data-model-2.0/#names-and-descriptions
Sourcefn credential_subjects(&self) -> &[Self::Subject]
fn credential_subjects(&self) -> &[Self::Subject]
Credential subject.
See: https://www.w3.org/TR/vc-data-model-2.0/#credential-subject
Sourcefn valid_from(&self) -> Option<DateTimeStamp>
fn valid_from(&self) -> Option<DateTimeStamp>
Date and time the credential becomes valid.
Could be a date and time in the future or in the past.
Note that this value represents the earliest point in time at which the
information associated with the
credential_subject property becomes
valid.
If a valid_until value also exists, the
valid_from value must express a datetime
that is temporally the same or earlier than the datetime expressed by
the valid_until value.
See: https://www.w3.org/TR/vc-data-model-2.0/#validity-period
Sourcefn valid_until(&self) -> Option<DateTimeStamp>
fn valid_until(&self) -> Option<DateTimeStamp>
Date and time the credential ceases to be valid.
Could be a date and time in the past or in the future.
Note that this value represents the latest point in time at which the
information associated with the
credential_subject property is
valid.
If a valid_from value also exists, the
valid_until value must express a datetime
that is temporally the same or later than the datetime expressed by the
valid_from value.
See: https://www.w3.org/TR/vc-data-model-2.0/#validity-period
Sourcefn credential_status(&self) -> &[Self::Status]
fn credential_status(&self) -> &[Self::Status]
Credential status.
Helps discover information related to the status of the verifiable credential, such as whether it is suspended or revoked.
Sourcefn credential_schemas(&self) -> &[Self::Schema]
fn credential_schemas(&self) -> &[Self::Schema]
Data schemas.
Data schemas are useful when enforcing a specific structure on a given collection of data.
Integrity metadata about each resource referenced by the verifiable credential.
fn refresh_services(&self) -> &[Self::RefreshService]
fn terms_of_use(&self) -> &[Self::TermsOfUse]
fn evidence(&self) -> &[Self::Evidence]
Sourcefn validate_credential<E>(&self, env: &E) -> ClaimsValiditywhere
E: DateTimeProvider,
fn validate_credential<E>(&self, env: &E) -> ClaimsValiditywhere
E: DateTimeProvider,
Validates the credential.
Validation consists in verifying that the claims themselves are consistent and valid with regard to the verification environment. For instance, checking that a credential’s expiration date is not in the past, or the issue date not in the future.
Validation may fail even if the credential proof is successfully verified.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.