Message Signing

Sign Message

Learn how to sign a message using the Okto SDK.

The signMessage() method creates a signature for any message following the EIP191 standard. This function initiates the signing process, which can be executed using the OktoClient instance.

Example

import { OktoClient } from '@okto_web3/core-js-sdk'; 
 
async function SignMessage() {
 
    const oktoClient = new OktoClient({ 
        environment: process.env.OKTO_ENVIRONMENT, 
        clientPrivateKey: process.env.OKTO_CLIENT_PRIVATE_KEY, 
        clientSWA: process.env.OKTO_CLIENT_SWA, 
    }); 
 
    const message = "Hello Okto!"; 
 
    const signedMessage_response = await oktoClient.signMessage(message); 
    console.log('Signed Message: ', signedMessage_response);
}

Note

For error handling:

Method Overview

MethodDescription
async signMessageSign a message using EIP191 standard

Sign Message

async oktoClient.signMessage(message: string) creates cryptographic signature for the provided message.

Parameters

ParameterTypeDescriptionRequired
oktoClientOktoClientInstance of OktoClient obtained from useOkto hookYes
messageStringParameters for the Sign MessageYes

Response

Success Response

Field NameTypeDescription
resultPromise<string>Returns the EIP191 compliant signature of the message