dag_signData

Creates a request to generate a safe signature of arbitrary data from the selected wallet. This method is intended to be used for interaction with custom data requests to metagraphs and other similar use cases.

This method adds a standard "\u0019Constellation Signed Data:\n" + len(message) + "\n" prefix when calculating the signature hash. The addition of the prefix prevents users from being tricked into signing a valid token transaction with this method.

The final string looks like this: "\u0019Constellation Signed Data:\n" + len(message) + "\n" + message

Warning

Please be sure you use the correct prefix for the correct method when verifying signatures, dag_signData uses "Constellation Signed Data:" while dag_signMessage uses "Constellation Signed Message:"

Parameters

Name
Type
Description

Account

Address

Account to sign from.

Request

Base64<JSONEncoded> | Base64<StringEncoded>

Signature Request.

Return Type

HexString - The prefixed ECDSA signature.

Base64

/**
 * A base64 encoded string
 * */
type Base64 = string;

JSONEncoded

/**
 * A JSON encoded string
 * */
type JSONEncoded = string;

StringEncoded

Example

Verify

In order to verify the signature you can use the verifyData() method from dag4.js:

Last updated

Was this helpful?