Sign a message

How to ask users to sign a message.

Intro

Signing a message is the equivalent to asking the user to sign his signature. Therefore to sign a message, we need to define the message for the user to sign and request his approval.

The object that can ask the user his approval is called a Signer, once we've created a Signer object we can use the Signer to sign the message.

🚧

To perform actions on a wallet , such as transactions or signatures, the wallet has to be linked to your application. The easiest way to link a wallet to your application in to use getAccount flow. The benefits of using the getAccount flow is that this flow bundles multiple actions into one call.

Function:

//Asking the signer to sign a message.
venlyConnect.signer.signMessage({
    walletId: '<WALLET_ID>',
    secretType: '<BLOCKCHAIN>',
    data : "<YOUR_MESSAGE>"
})

Example:

venlyConnect.signer.signMessage({
    walletId: 'c8ec9954-fa1a-4682-9cf8-ef5c1015d1d1',
    secretType: 'ETHEREUM',
    data : "I agree with terms and conditions"
})

Returns:

{
    result: {
        r: "0xc5e7a538a353c53e839ed0a2cf7b726806114b637ad1c527046adfc92fecf0d8"
        s: "0x551041e78e3b3d4432f653d708965d34aceaf067255d9cc5970283b00d5f95e0"
        signature: "0xc5e7a538a353c53e839ed0a2cf7b726806114b637ad1c527046adfc92fecf0d8551041e78e3b3d4432f653d708965d34aceaf067255d9cc5970283b00d5f95e01b"
        v: "0x1b"
    }
    status: "SUCCESS"
}

JS Fiddle Example

Function Reference

The function reference describes the different functions that are available in the Widget. For each function you can find the signature, its parameters, and possible options documented.

📘