Struct identity_iota::credential::Credential
source · [−]pub struct Credential<T = BTreeMap<String, Value, Global>> {Show 15 fields
pub context: OneOrMany<Context>,
pub id: Option<Url>,
pub types: OneOrMany<String>,
pub credential_subject: OneOrMany<Subject>,
pub issuer: Issuer,
pub issuance_date: Timestamp,
pub expiration_date: Option<Timestamp>,
pub credential_status: Option<Status<BTreeMap<String, Value, Global>>>,
pub credential_schema: OneOrMany<Schema>,
pub refresh_service: OneOrMany<RefreshService>,
pub terms_of_use: OneOrMany<Policy>,
pub evidence: OneOrMany<Evidence>,
pub non_transferable: Option<bool>,
pub properties: T,
pub proof: Option<Proof>,
}
Expand description
Represents a set of claims describing an entity.
Fields
context: OneOrMany<Context>
The JSON-LD context(s) applicable to the Credential
.
id: Option<Url>
A unique URI
that may be used to identify the Credential
.
types: OneOrMany<String>
One or more URIs defining the type of the Credential
.
credential_subject: OneOrMany<Subject>
One or more Object
s representing the Credential
subject(s).
issuer: Issuer
A reference to the issuer of the Credential
.
issuance_date: Timestamp
A timestamp of when the Credential
becomes valid.
expiration_date: Option<Timestamp>
A timestamp of when the Credential
should no longer be considered valid.
credential_status: Option<Status<BTreeMap<String, Value, Global>>>
Information used to determine the current status of the Credential
.
credential_schema: OneOrMany<Schema>
Information used to assist in the enforcement of a specific Credential
structure.
refresh_service: OneOrMany<RefreshService>
Service(s) used to refresh an expired Credential
.
terms_of_use: OneOrMany<Policy>
Terms-of-use specified by the Credential
issuer.
evidence: OneOrMany<Evidence>
Human-readable evidence used to support the claims within the Credential
.
non_transferable: Option<bool>
Indicates that the Credential
must only be contained within a
Presentation
with a proof issued from the Credential
subject.
properties: T
Miscellaneous properties.
proof: Option<Proof>
Proof(s) used to verify a Credential
Implementations
sourceimpl<T> Credential<T>
impl<T> Credential<T>
sourcepub fn base_context() -> &'static Context
pub fn base_context() -> &'static Context
Returns the base JSON-LD context.
sourcepub fn builder(properties: T) -> CredentialBuilder<T>
pub fn builder(properties: T) -> CredentialBuilder<T>
Creates a new CredentialBuilder
to configure a Credential
.
This is the same as CredentialBuilder::new.
sourcepub fn from_builder(
builder: CredentialBuilder<T>
) -> Result<Credential<T>, Error>
pub fn from_builder(
builder: CredentialBuilder<T>
) -> Result<Credential<T>, Error>
Returns a new Credential
based on the CredentialBuilder
configuration.
sourcepub fn check_structure(&self) -> Result<(), Error>
pub fn check_structure(&self) -> Result<(), Error>
Validates the semantic structure of the Credential
.
Trait Implementations
sourceimpl<T> Clone for Credential<T> where
T: Clone,
impl<T> Clone for Credential<T> where
T: Clone,
sourcefn clone(&self) -> Credential<T>
fn clone(&self) -> Credential<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> Debug for Credential<T> where
T: Debug,
impl<T> Debug for Credential<T> where
T: Debug,
sourceimpl<'de, T> Deserialize<'de> for Credential<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Credential<T> where
T: Deserialize<'de>,
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Credential<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Credential<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T> Display for Credential<T> where
T: Serialize,
impl<T> Display for Credential<T> where
T: Serialize,
sourceimpl<T> GetSignature for Credential<T>
impl<T> GetSignature for Credential<T>
sourceimpl<T> GetSignatureMut for Credential<T>
impl<T> GetSignatureMut for Credential<T>
sourcefn signature_mut(&mut self) -> Option<&mut Proof>
fn signature_mut(&mut self) -> Option<&mut Proof>
Returns a mutable reference to the Proof
object, if any.
sourceimpl<T> PartialEq<Credential<T>> for Credential<T> where
T: PartialEq<T>,
impl<T> PartialEq<Credential<T>> for Credential<T> where
T: PartialEq<T>,
sourcefn eq(&self, other: &Credential<T>) -> bool
fn eq(&self, other: &Credential<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Credential<T>) -> bool
fn ne(&self, other: &Credential<T>) -> bool
This method tests for !=
.
sourceimpl<T> Serialize for Credential<T> where
T: Serialize,
impl<T> Serialize for Credential<T> where
T: Serialize,
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl<T> SetSignature for Credential<T>
impl<T> SetSignature for Credential<T>
sourcefn set_signature(&mut self, value: Proof)
fn set_signature(&mut self, value: Proof)
Sets the Proof
object of self
.
sourceimpl<T> TryMethod for Credential<T>
impl<T> TryMethod for Credential<T>
sourceconst TYPE: MethodUriType = MethodUriType::Absolute
const TYPE: MethodUriType = MethodUriType::Absolute
Flag that determines whether absolute or rleative URI
sourcefn method<D, U>(method: &VerificationMethod<D, U>) -> Option<String> where
D: DID,
fn method<D, U>(method: &VerificationMethod<D, U>) -> Option<String> where
D: DID,
Returns an absolute or relative method URI, if any, depending on the MethodUriType
. Read more
sourcefn try_method<D, U>(method: &VerificationMethod<D, U>) -> Result<String, Error> where
D: DID,
fn try_method<D, U>(method: &VerificationMethod<D, U>) -> Result<String, Error> where
D: DID,
Returns String representation of absolute or relative method URI. Read more
impl<T> StructuralPartialEq for Credential<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Credential<T> where
T: RefUnwindSafe,
impl<T> Send for Credential<T> where
T: Send,
impl<T> Sync for Credential<T> where
T: Sync,
impl<T> Unpin for Credential<T> where
T: Unpin,
impl<T> UnwindSafe for Credential<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FromJson for T where
T: for<'de> Deserialize<'de>,
impl<T> FromJson for T where
T: for<'de> Deserialize<'de>,
sourcefn from_json(json: &impl AsRef<str>) -> Result<Self, Error>
fn from_json(json: &impl AsRef<str>) -> Result<Self, Error>
Deserialize Self
from a string of JSON text.
sourcefn from_json_slice(json: &impl AsRef<[u8]>) -> Result<Self, Error>
fn from_json_slice(json: &impl AsRef<[u8]>) -> Result<Self, Error>
Deserialize Self
from bytes of JSON text.
sourcefn from_json_value(json: Value) -> Result<Self, Error>
fn from_json_value(json: Value) -> Result<Self, Error>
Deserialize Self
from a [serde_json::Value
].
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToJson for T where
T: Serialize,
impl<T> ToJson for T where
T: Serialize,
sourcefn to_json_value(&self) -> Result<Value, Error>
fn to_json_value(&self) -> Result<Value, Error>
Serialize self
as a [serde_json::Value
].
sourcefn to_json_pretty(&self) -> Result<String, Error>
fn to_json_pretty(&self) -> Result<String, Error>
Serialize self
as a pretty-printed string of JSON.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more