Aptos Signature Guide

  • We are using tweetnacl for this particular example

import nacl from "tweetnacl"

const secretKey = ""
const publicKey = "" // without prefix 0x

const generatedMessage = await generateMessage()

const message = `APTOS\nmessage: {generatedMessage.message}\nnonce: {generatedMessage.nonce}`

const signature = nacl.sign.detached(Buffer.from(message), Buffer.from(message, 'hex'))

APTOS has a standard for signing message, there will be APTOS before message and nonce after message, nonce is provided by the generateMessage, use that as a nonce

Last updated