signMessage()
Othent JS SDK signMessage() function
The signMessage()
function creates a cryptographic signature of any data (after hashing it) for later validation, using the active (authenticated) user's private key.
This function assumes (and requires) a user is authenticated. See requireAuth()
.
Also, this function should only be used to allow data validation. It cannot be used for on-chain transactions, interactions or bundles, for security reasons. Consider using sign()
, signDataItem()
or dispatch() instead.
Tip: This function's implementation is compatible with ArConnect's signMessage()
and verifyMessage()
's.
Tip: The function first hashes the input data for security reasons. We recommend using the built in verifyMessage()
function to validate the signature, or hashing the data the same way, before validation (example).
API
data: string | BinaryDataType
data: string | BinaryDataType
The data to generate the signature for.
options?: SignMessageOptions
options?: SignMessageOptions
The options
argument is optional. If it is not provided, the extension will use the SHA-256
hash algorithm.
return Promise<Uint8Array>
return Promise<Uint8Array>
A Promise
containing an Uint8Array
with the signed hash of the data, which can be verified with Othent.verifyMessage
.
Example usage
Last updated