createVSCredential()

storing EIP712 verifiable credentials to ComposeDB/Ceramic

How to use?

import { getVESSKit,getPkhDIDFromAddress } from 'vess-kit-node'
          
const vc = {
  id: "urn:...........",
  type: ["Verifiable Credential"],
  issuer: {
    id: "did:pkh:eip155:1:0x......."
  },
  credentialSubject: {
    id: "did:pkh:eip155:1:0x......."
    ...other props
  },
  issuanceDate: "2024-10-12",
  expirationDate: "2124-10-12",
  ...other props
  } // EIP712 verifiable credential
          
// connect to ComposeDB
const provider:any // any ethereum provider that is already connected
const signer = provider.getSigner()
const isDev:boolean = true
const issuerAddress = "0x....."

const vess = getVESSKit()
await vessKit.connect(
          issuerAddress,
        async (message) => {
          const signed = await signer.signMessage(message)
          return signed
        },
        !isDev ? 'mainnet' : 'testnet-clay',
      )
const payload = await vessKit.createVSCredential({
      content: {
        plainCreds: JSON.stringify(vc),
        issuerDid: vc.issuer.id,
        holderDid: vc.credentialSubject.id,
        issuanceDate: vc.issuanceDate,
        expirationDate: expirationDate,
        type: vc.type,
      },
    })

Parameters

input: CreateVsVerifiableCredentialInput

Return

Promise<CreateVsVerifiableCredentialPayload>

Last updated