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:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support
Method Overview
| Method | Description |
|---|---|
async signMessage | Sign a message using EIP191 standard |
Sign Message
async oktoClient.signMessage(message: string) creates cryptographic signature for the provided message.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
oktoClient | OktoClient | Instance of OktoClient obtained from useOkto hook | Yes |
message | String | Parameters for the Sign Message | Yes |
Response
Success Response
| Field Name | Type | Description |
|---|---|---|
result | Promise<string> | Returns the EIP191 compliant signature of the message |