Skip to content

Extract and Verify

Important

Before extracting and verifying proof, please ensure that you have created message array.

Extract Details

Extract the publicKey, signature, and nonce from the proof attribute of the Verifiable Credential (VC). In this step, the vc.proof attribute is extracted from the Verifiable Credential (VC). The publicKey, signature, and nonce are then obtained by decoding the base64-encoded values from the proof attribute.

const vcProof = vc.proof;
const publicKey = Buffer.from(vcProof?.verificationMethod, "base64");
const signature = Buffer.from(vcProof?.proofValue, "base64");
const nonce = Buffer.from(vcProof?.nonce, "base64");

Verify Proof

The blsVerifyProof method is employed to verify the proof by passing the signature, publicKey, messages (previously created vcmessages array), and nonce.

const isProofVerified = await blsVerifyProof({
  proof: signature,
  publicKey,
  messages: vcmessages,
  nonce: nonce,
});

Next Steps

Finally, the value generated above in isProofVerified indicates if the proof has been verified successfully or not.