Signing Messages

Once an application is connected to the Rise Wallet via connect method, it can also request that the user signs a given message using window.rise.signMessage().Applications are free to write their own messages which will be displayed to users from within Rise Wallet's signature prompt. Message signatures do not involve network fees and are a convenient way for apps to verify ownership of an address. It takes one parameter listed below:

{
   address?: boolean; // To include the address of the account in the message
   application?: boolean; // To include the domain of the dapp
   chainId?: boolean; // To include the current chain id the wallet is connected to
   message: string; // The message to be signed and displayed to the user
   nonce: string; // A nonce the app should generate,
 }

Below is an example code describing the way to sign a message.

const signature = await window.rise.signMessage({
  address: true,
  application: true,
  chainId: true,
  message: "This is a message",
  nonce: 123,
});
console.log(signature)
// {
//  address: true
//  application: "localhost:5001"
//  chainId: 33
//  fullMessage: "APTOS\naddress: true\napplication: localhost:5001\nchainId: 33\nmessage: This is a message\nnonce: 123"
//  message: "This is a message"
//  nonce: 123
//  prefix: "APTOS"
//  publicKey: "0x71c87ca87e89dd7d02d224465cc40a1aafb10a76a91a0857ddac29fe0c3cdf23"
//  signature: "0xd4bfd19381d4e2d1ae06f530a4390c671baa8427829a9deeb457cada04a58e7cf22bc9bfc1049586628eed09ba356fcd8abdc67b7830dbe3bc4de1df0e88fc0e"
// }

Last updated