network:newStacksTestnet(),// for mainnet, `new StacksMainnet()`
appDetails:{
name:'My App',
icon:window.location.origin+'/my-app-logo.svg',
},
onFinish(data) {
console.log('Signature of the message', data.signature);
console.log('Use public key:', data.publicKey);
},
});
All of the methods included on this page accept a network option. By default, Connect uses a testnet network option. You can import a network configuration from the @stacks/network package:
The openSignatureRequestPopup method from @stacks/connect allows you to specify an onFinish callback. This callback will be triggered after the user has successfully signed the message.
You can get the signature of the message via the arguments passed to onFinish. Your callback will be fired with a single data argument:
constonFinish=(data:SignatureData)=>{
const{ signature, publicKey }=data;
console.log('Signature', signature);
console.log('PublicKey', publicKey);
};
export interfaceSignatureData{
/* Hex encoded DER signature */
signature:string;
/* Hex encoded private string taken from privateKey */
When you verify a signature, you're confirming that the message was indeed created by the claimed sender and that it hasn't been altered since it was signed. To do this, use the verifyMessageSignatureRsv function from the @stacks/encryption package: