Credential

Trait Credential 

Source
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§

Source

type Subject

Credential subject type.

Source

type Issuer: Identified

Source

type Status: MaybeIdentified + Typed

Source

type Schema: Identified + Typed

Source

type RelatedResource: RelatedResource

Source

type RefreshService: Typed

Source

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.

See: https://www.w3.org/TR/vc-data-model-2.0/#terms-of-use

Source

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§

Source

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.

See: https://www.w3.org/TR/vc-data-model-2.0/#issuer

Provided Methods§

Source

fn id(&self) -> Option<&Uri>

Identifier.

Source

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.

Source

fn types(&self) -> CredentialTypes<'_>

Source

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

Source

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

Source

fn credential_subjects(&self) -> &[Self::Subject]

Source

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

Source

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

Source

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.

See: https://www.w3.org/TR/vc-data-model-2.0/#status

Source

fn credential_schemas(&self) -> &[Self::Schema]

Data schemas.

Data schemas are useful when enforcing a specific structure on a given collection of data.

See: https://www.w3.org/TR/vc-data-model-2.0/#data-schemas

Source

fn related_resources(&self) -> &[Self::RelatedResource]

Integrity metadata about each resource referenced by the verifiable credential.

Source

fn refresh_services(&self) -> &[Self::RefreshService]

Source

fn terms_of_use(&self) -> &[Self::TermsOfUse]

Source

fn evidence(&self) -> &[Self::Evidence]

Source

fn validate_credential<E>(&self, env: &E) -> ClaimsValidity

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.

Implementors§

Source§

impl<Subject, RequiredContext, RequiredType, Issuer: Identified, Status: MaybeIdentified + Typed, Evidence: MaybeIdentified + Typed, Schema: Identified + Typed, RefreshService: Typed, TermsOfUse: MaybeIdentified + Typed, ExtraProperties> Credential for SpecializedJsonCredential<Subject, RequiredContext, RequiredType, Issuer, Status, Evidence, Schema, RefreshService, TermsOfUse, ExtraProperties>

Source§

type Subject = Subject

Source§

type Issuer = Issuer

Source§

type Status = Status

Source§

type RefreshService = RefreshService

Source§

type TermsOfUse = TermsOfUse

Source§

type Evidence = Evidence

Source§

type Schema = Schema

Source§

type RelatedResource = RelatedResource