Solflare Wallet

Signing Messages

For Web & Extension


const providerUrl = '';
const wallet = new Wallet(providerUrl);
wallet.on('connect', publicKey => console.log('Connected to ' + publicKey.toBase58()));
wallet.on('disconnect', () => console.log('Disconnected'));
await wallet.connect();
const message = "Please sign this message for proof of address ownership.";
const data = new TextEncoder().encode(message);
let { signature } = await wallet.sign(data, 'utf8');


The signMessage function expects an Uint8Array and a data display type parameter (either utf8 for readable text or hex for binary data) and returns an object with keys signature (signature of the input message) and publicKey.
const message = 'To avoid digital dognappers, sign below to authenticate with CryptoCorgis';
const encodedMessage = new TextEncoder().encode(message);
const signedMessage = await window.solflare.signMessage(encodedMessage, 'utf8');
// { signature, publicKey }