📖Credential Data Model

A deep dive into the credential data model

A Verifiable Credential (aka Credential) is a set of one or more (tamper-evident) claims made by someone or something. Credentials includes an identifier and properties such as:

  • issuer

  • type

  • subject

  • issuance date

The credential claim is assigned a proof in that it's cryptographically signed by the issuer (who may or may not be the owner of the signing key).

An example of a Verifiable Credential document
{
  "vc": {
    "@context": [
      "https://www.w3.org/2018/credentials/v1"
    ],
    // The Credential type(s) which declare what data (schema) to expect 
    // in the Credential. The second item in the array is waht's interesting
    // to most. The first item (VerifiableCredential) is more of a formality.
    "type": [
      "VerifiableCredential",
      "MembershipCredential"
    ],
    // Who (or what) that issued the credential. Note this could be the DID for an 
    // individual or an organization.
    "issuer": {
      "id": "did:web:api.disco.xyz/v1/disco"
    },
    // When the credential was issued.
    "issuanceDate": "2023-09-29T18:28:00.853Z",
    // The unique identifier for the Credential.
    "id": "https://api.disco.xyz/credential/de5eb800-a023-483b-88a2-39a062fec13e",
    // Detailed claims about the subject of the Credential. These details varies based 
    // on the credential type (i.e., credential schema, see below). 
    "credentialSubject": {
      // Identifier for the subject of the credential (in many use cases this is the 
      // same as the recipient identifier).
      "id": "did:web:api.disco.xyz/v1/jane",
      // Assertions about the subject of the credential
      "memberId": "123XYZ",
      "membershipDescription": "Demo membership to showcase Disco API",
      "membershipLevel": "Permanent",
      "membershipType": "Developer",
      "organization": "Disco.xyz"
    },
    // The credential schema that represents the credential type.
    "credentialSchema": {
      "id": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
      "type": "JsonSchemaValidator2018"
    },
    // Digital proof that makes the credential tamper-evident. Disco uses 
    // EIP-712 or JWT.
    "proof": {
      // The identifier of the public key that can verify the signature.
      "verificationMethod": "did:web:api.disco.xyz/v1/disco#controller",
      "created": "2023-09-29T18:28:00.870Z",
      "proofPurpose": "assertionMethod",
      // Signed with EIP-712. Also support JWT.
      "type": "EthereumEip712Signature2021",
      "proofValue": "0xa0c0552a9d58b030e4f8a .... 621ee0f671a85e3bc1f7970c53a1b",
      "eip712Domain": {
        "domain": {
          "chainId": 1,
          "name": "Disco Verifiable Credential",
          "version": "1"
        },
        "messageSchema": {...},
        "primaryType": "VerifiableCredential"
      }
    }
  },
  // If isPublic is false the credential is only accessible to the issuer 
  // and recipient.
  "isPublic": true,
  // The DID for whom or what issued the credential.
  "issuer": "did:web:api.disco.xyz/v1/disco",
  // The DID for whom or what recieved the credential.
  "recipient": "did:web:api.disco.xyz/v1/jane",
  // The DID for the subject of the credential (most cases the same as the recipient).
  "subject": "did:web:api.disco.xyz/v1/jane",
  // Disco supported schemas can be found at https://github.com/discoxyz/disco-schemas
  "schema": "https://raw.githubusercontent.com/discoxyz/disco-schemas/main/json/MembershipCredential/1-0-0.json",
  "genId": "440994e8-fa9a-494c-83cd-2732f8c0cdba",
  "updatedAt": "2023-09-29T18:28:00.877Z"
}

Last updated