Verify Signature

After signing a challenge, you will get some signed data includes credential info, challenge, message and signature. You can verify the signature by using the credential info and the message.

challenge vs. message

The process of verifying a signature has three steps:

  1. Verify the credential that has ownership of the corresponding CKB Address.
  2. Verify the message that contains the challenge that you requested to sign.
  3. Verify the signature that is signed by the credential.

For the first step, you can use the verifyCredential function to verify the credential. for the rest two steps, JoyID SDK provides a function verifySignature:

import { signWithPopup, verifySignature } from '@joyid/core'

const { error, data } = await signWithPopup(request)
if (error == null) {
  const result = await verifySignature(data)
  alert(result) // true or false

Try it out

Loading Sandbox...
Loading Sandbox...