Construct credential

Important

Before constructing credential please ensure that you have generated a key pair

Construct the credential using the JSON and JSON-LD schema. Here we use; DriversLicence

Example credential using the schemas provided above.

const credential = {
  id: "urn:262e62b7-a7cc-4429-a562-2b34b73ad37e",
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/security/bbs/v1",
    "https://redbellynetwork.github.io/did-schema/driversLicence/credential/v1.jsonld",
  ],
  credentialSchema: {
    id: "https://redbellynetwork.github.io/did-schema/driversLicence/credential/DriversLicenceCredential-v1.json",
    type: "JsonSchema2023",
  },
  credentialSubject: {
    id: "did:key:Av2imXAIjOuRN6cs9TGXKjD0qhcAxL410S4y6J/lbN75",
    name: "mary testfour",
    licenseNumber: "103188691",
    stateOfIssuance: "QLD",
    birthDate: 19530101,
    customerReference: "6e74b01f-4ec8-f0a7-c2fe-d60e773d64d5",
    expiryDate: 21000101,
    publicAddress: "0xAB76da8136A433E4CcF3A149e424c7aA8CDda0A3",
    type: "DriversLicenceCredential",
  },
  expiration: "2030-04-25T14:29:26Z",
  issuanceDate: "2023-07-10T00:28:50.087270501Z",
  issuer:
    "did:polygonid:polygon:mumbai:2qPtAUb1jtfyWVJs59mpeCkBd8dd8Ae9qo2dyWREYf",
  type: ["VerifiableCredential", "KYCAgeCredential"],
};

Next Up: Create message array →