Saltar al contenido principal

Crea una Credencial Verificable

1. Instala

npm install @extrimian/vc-core

2. Crea una credencial

Para crear tu primer credencial debes tener tu creado un DID y sus claves guardadas en el storage de KMS. Si aun no lo creaste podes hacerlo siguiendo los pasos de la seccion Creacion de un DID.

import { VerifiableCredentialService } from "@extrimian/vc-core";
const vcService = new VerifiableCredentialService();

const credential = await vcService.createCredential({
context: [
"https://w3id.org/vaccination/v1",
"https://w3id.org/security/v2",
"https://w3id.org/security/bbs/v1",
],
vcInfo: {
issuer: "did:quarkid:zksync:EiCvhchHLnK1HOM1vlQJTSW0TotsNfe34zFbGXisg3fMzA",
expirationDate: new Date("2026/05/05"),
id: "123456789",
types: ["VaccinationCertificate"],
},
data: {
type: "VaccinationEvent",
batchNumber: "1183738569",
administeringCentre: "MoH",
healthProfessional: "MoH",
countryOfVaccination: "NZ",
recipient: {
type: "VaccineRecipient",
givenName: "JOHN",
familyName: "SMITH",
gender: "Male",
birthDate: "1958-07-17",
},
vaccine: {
type: "Vaccine",
disease: "COVID-19",
atcCode: "J07BX03",
medicinalProductName: "COVID-19 Vaccine Moderna",
marketingAuthorizationHolder: "Moderna Biotech",
},
},
mappingRules: null,
});

3. Prueba

console.log(credential);