CredentialT

Trait CredentialT 

Source
pub trait CredentialT: CredentialSealed {
    type Properties;

    // Required methods
    fn context(&self) -> &OneOrMany<Context>;
    fn type_(&self) -> &OneOrMany<String>;
    fn subject(&self) -> &OneOrMany<Subject>;
    fn issuer(&self) -> &Issuer;
    fn valid_from(&self) -> Timestamp;
    fn valid_until(&self) -> Option<Timestamp>;
    fn status(&self) -> Option<&Status>;
    fn properties(&self) -> &Self::Properties;
    fn non_transferable(&self) -> bool;
    fn base_context(&self) -> &'static Context;
    fn serialize_jwt(
        &self,
        custom_claims: Option<BTreeMap<String, Value>>,
    ) -> Result<String, Error>;
}
Expand description

A VerifiableCredential type. This trait is implemented for Credential and for CredentialV2.

Required Associated Types§

Source

type Properties

The type of the custom claims.

Required Methods§

Source

fn context(&self) -> &OneOrMany<Context>

The Credential’s context.

Source

fn type_(&self) -> &OneOrMany<String>

The Credential’s types.

Source

fn subject(&self) -> &OneOrMany<Subject>

The Credential’s subjects.

Source

fn issuer(&self) -> &Issuer

The Credential’s issuer.

Source

fn valid_from(&self) -> Timestamp

The Credential’s issuance date.

Source

fn valid_until(&self) -> Option<Timestamp>

The Credential’s expiration date, if any.

Source

fn status(&self) -> Option<&Status>

The Credential’s validity status, if any.

Source

fn properties(&self) -> &Self::Properties

The Credential’s custom properties.

Source

fn non_transferable(&self) -> bool

Whether the Credential’s nonTransferable property is set.

Source

fn base_context(&self) -> &'static Context

The Credential’s base context.

Source

fn serialize_jwt( &self, custom_claims: Option<BTreeMap<String, Value>>, ) -> Result<String, Error>

Serializes this credential as a JWT payload encoded string.

Implementors§

Source§

impl<T> CredentialT for identity_iota::credential::Credential<T>
where T: ToOwned<Owned = T> + Serialize + DeserializeOwned,

Source§

impl<T> CredentialT for identity_iota::credential::CredentialV2<T>