signature()

Othent JS SDK signature() function

Often an application might need a piece of data that is created, authorized or confirmed by the owner of a wallet. The signature() function creates a cryptographical signature that allows applications to verify if a piece of data has been signed using a specific wallet. This function works similarly to the webcrypto sign API.

Tip: Not to be confused with the sign() function that is created to sign Arweave transactions.

API

signature(data: string | BinaryDataType): Promise<Uint8Array>;

data: string | BinaryDataType

The data to be signed with the user's private key.

return Promise<Uint8Array>

A Promise containing a Uint8Array with the signed data.

Example usage

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

const othent = new Othent({ appInfo, throwErrors: false, ... });

// Make sure the user is authenticated, or prompt them to authenticate:
await othent.requireAuth();

// Sign data:
const signature = await othent.signature("Data to sign");

console.log(`The signature is "${ signature }".`);

Last updated