pub trait Credential {
type Subject;
type Issuer: ?Sized + Identified;
type Status: Identified + Typed;
type RefreshService: Identified + Typed;
type TermsOfUse: MaybeIdentified + Typed;
type Evidence: MaybeIdentified + Typed;
type Schema: Identified + Typed;
Show 13 methods
// Required methods
fn issuer(&self) -> &Self::Issuer;
fn issuance_date(&self) -> Option<DateTime>;
// Provided methods
fn id(&self) -> Option<&Uri> { ... }
fn additional_types(&self) -> &[String] { ... }
fn types(&self) -> CredentialTypes<'_> ⓘ { ... }
fn credential_subjects(&self) -> &[Self::Subject] { ... }
fn expiration_date(&self) -> Option<DateTime> { ... }
fn credential_status(&self) -> &[Self::Status] { ... }
fn refresh_services(&self) -> &[Self::RefreshService] { ... }
fn terms_of_use(&self) -> &[Self::TermsOfUse] { ... }
fn evidence(&self) -> &[Self::Evidence] { ... }
fn credential_schemas(&self) -> &[Self::Schema] { ... }
fn validate_credential<E>(&self, env: &E) -> ClaimsValidity
where E: DateTimeProvider { ... }
}Expand description
Credential trait.
Required Associated Types§
Sourcetype Issuer: ?Sized + Identified
type Issuer: ?Sized + Identified
Issuer type.
Sourcetype Status: Identified + Typed
type Status: Identified + Typed
Credential status type.
Sourcetype RefreshService: Identified + Typed
type RefreshService: Identified + 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.
Sourcetype Schema: Identified + Typed
type Schema: Identified + Typed
Credential Schemas (Zero-Knowledge Proofs).
See: https://www.w3.org/TR/vc-data-model//#zero-knowledge-proofs
Required Methods§
Sourcefn issuer(&self) -> &Self::Issuer
fn issuer(&self) -> &Self::Issuer
Issuer.
This property is required for the credential to be verifiable.
Sourcefn issuance_date(&self) -> Option<DateTime>
fn issuance_date(&self) -> Option<DateTime>
Issuance date.
This property is required for the credential to be verifiable.
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 credential_subjects(&self) -> &[Self::Subject]
fn credential_subjects(&self) -> &[Self::Subject]
Credential subject.
Sourcefn expiration_date(&self) -> Option<DateTime>
fn expiration_date(&self) -> Option<DateTime>
Expiration date.
Sourcefn credential_status(&self) -> &[Self::Status]
fn credential_status(&self) -> &[Self::Status]
Credential status.
Used for discovery of information about the current status of a verifiable credential, such as whether it is suspended or revoked.
Sourcefn refresh_services(&self) -> &[Self::RefreshService]
fn refresh_services(&self) -> &[Self::RefreshService]
Refresh services.
Sourcefn terms_of_use(&self) -> &[Self::TermsOfUse]
fn terms_of_use(&self) -> &[Self::TermsOfUse]
Terms of Use.
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.
Sourcefn evidence(&self) -> &[Self::Evidence]
fn evidence(&self) -> &[Self::Evidence]
Evidence.
Can be included by an issuer to provide the verifier with additional supporting information in a verifiable credential.
Sourcefn credential_schemas(&self) -> &[Self::Schema]
fn credential_schemas(&self) -> &[Self::Schema]
Credential Schemas (Zero-Knowledge Proofs).
See: https://www.w3.org/TR/vc-data-model//#zero-knowledge-proofs
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.