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:
import { StacksTestnet, StacksMainnet } from '@stacks/network';const testnet = new StacksTestnet();constmainnet= new StacksMainnet();// use this in your messe signing method:openSignatureRequestPopup({ network:mainnet, // other relevant options});
Several parameters are available for calling openSignatureRequestPopup:
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:
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: