Skip to content
Cive

signMessage (Local Account)

Calculates an Ethereum-specific signature in CIP-23 format: keccak256("\x19Conflux Signed Message:\n" + len(message) + message)).

Usage

import {  } from "cive/chains";
import {  } from "cive/accounts";
 
const  = ("0x...", { : . });
 
const  = await .({
  : "hi 🥰",
});
 
Output: "0x1bd4b8a20e85d5334f1f6c813921994b70a684e2f5c425ec0aaff2d6354686e10ee546d97b8bcbd636ee3284cf2e4e120f2df456580a62d8558af55eb5b13e0b00"

Returns

Hex

The signed message.

Parameters

message

  • Type: string | { raw: Hex | ByteArray }

Message to sign.

By default, cive signs the UTF-8 representation of the message.

const  = await .({
  : "hello world", 
});

To sign the data representation of the message, you can use the raw attribute.

const  = await .({
  : { : "0x68656c6c6f20776f726c64" }, 
});