OthentKMS verifyMessage() function

The verifyMessage function enables verification of a cryptographic signature created with the signMessage function.

Example Usage

To use the verifyMessage function, import it from the @othent/kms package and call it within an asynchronous function as follows:

import { verifyMessage } from "@othent/kms";

const handleVerifyMessage = async () => {
  const data = new TextEncoder().encode(
    "The hash of this msg will be signed.",
  );
  const signedMessage = await signMessage(data);
  const owner = await getActivePublicKey();
  const res = await verifyMessage(data, signedMessage, owner);
  console.log(res);
};

The verifyMessage function supports the following arguments:

<aside> ⚠️ Note: A user must be logged in to an application to successfully encrypt data.

</aside>

Result

On execution, the function returns a boolean of the verification as follows:

true

The boolean result can be used as a conditional for further operations.