SignerKeyGrantOptions
The inputs to the SIP-018 message a signer key signs to authorize a signer-manager. Accepted by buildSignerGrantMessage, computeSignerGrantHash, signSignerGrant and verifySignerGrant. The hash they produce matches pox-5 get-signer-grant-message-hash.
Usage
import { signSignerGrant, verifySignerGrant } from '@stacks/bitcoin-staking';
import { STACKS_MAINNET } from '@stacks/network';
const grant = {
signerManager: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager',
authId: 1n,
chainId: STACKS_MAINNET.chainId, // 1
};
const signature = signSignerGrant({ ...grant, privateKey: signerPrivateKey });
const ok = verifySignerGrant({ ...grant, publicKey: signerPublicKey, signature });Notes
chainIdmust be the chain ID of the network wheregrant-signer-keyruns. pox-5 builds the domain from its ownchain-id(POX_5_SIGNER_DOMAIN), so a signature made for another chain ID does not recover to the signer key andgrant-signer-keyfails withERR_INVALID_SIGNATURE_PUBKEY (u14).grant-signer-keyrecords every signer key, signer-manager andauthIdcombination it accepts, and rejects a repeat withERR_SIGNER_KEY_GRANT_USED (u12). Use a newauthIdfor each grant.
Definition
Properties
signerManager
string
Contract principal of the signer-manager being authorized. Encoded as signer-manager in the message
authId
IntegerType
Replay nonce, encoded as the uint auth-id in the message
chainId
number
Stacks chain ID: 1 for mainnet, 0x80000000 for testnet. Read it from a StacksNetwork object's chainId
Was this helpful?