[][src]Module caelum_vcdm::verifiable_credential

Struct representing a verifiableCredential explained in w3's verifiable credentials data model documentation.

A credential is a set of one or more claims made by the same entity. Credentials might also include an identifier and metadata to describe properties of the credential, such as the issuer, the expiry date and time, a public key to use for verification purposes, the revocation mechanism, and so on. The metadata might be signed by the issuer. A verifiable credential is a set of tamper-evident claims and metadata that cryptographically prove who issued it.

Id

verifiableCredentials MUST have exactly one DID id. This attribute has to be a valid DID, and when registered, the registered DID MUST mathis this DID. This is why when constructing a new VerifiableCredential(id) a valid DID must be passed as argument. This value can be OVERWRITTEN using method self.set_id(id) passing a new valid DID as argument.

Context

verifiableCredentials MUST have exactly one top-level @context statement. This context must be given as a valid URL for the generic DID context. By default the following context is created when creating a new verifiableCredential:

"@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://www.w3.org/2018/credentials/examples/v1"
]

More contexts can be added to the array using method self.set_context(new_context).

Type

For the present usage of this crate, the type attribute is also set by default as follows:

"type": [
   "VerifiableCredential",
   "PersonalInformation"
 ]

As before, other types can be added to the array using method self.set_type(new_type). Being new_type the element to add to the array.

Proof

A proof on a DID Document is cryptographic proof of the integrity of the DID Document. Following the definition given in w3 documentation. A DID Document MAY have exactly one property representing a proof. To set a Proof to a VerifiableCredential method self.set_proof() must be used passing arguments:

  1. verificationMethod (String): argument is concatenated to variable self.issuer. (HAS TO CHANGE)
  2. type (String): A URI that identifies the digital signature suite that was used to create the signature. This attribute is not passed to the method and forced to be RSAsignature2018.
  3. created (String): date creation of the proof, with format YYYY-mm-ddThh:mm:ssZ.
  4. signatureValue (String): The value of the signature value generated by the type algorithm.

Structs

VerifiableCredential

Functions

sign_credential