@taquito/utils
Version:
Encoding, crypto, and utility helpers for Taquito.
23 lines (22 loc) • 1.6 kB
TypeScript
export declare const BLS12_381_DST = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
export declare const POP_DST = "BLS_POP_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
/**
* Verify signature of a payload
* @param message The forged message including the magic byte (11 for block, 12 for preattestation, 13 for attestation, 3 for generic, 5 for the PACK format of michelson) in string or Uint8Array
* @param publicKey The public key to verify the signature against
* @param signature The signature to verify
* @param watermark Optional if not included in the message
* @param pop Optional if verifying proof of possession signature
* @returns A boolean indicating if the signature matches
* @throws InvalidPublicKeyError | InvalidSignatureError | InvalidMessageError
* @example
* ```
* const message = '03d0c10e3ed11d7c6e3357f6ef335bab9e8f2bd54d0ce20c482e241191a6e4b8ce6c01be917311d9ac46959750e405d57e268e2ed9e174a80794fbd504e12a4a000141eb3781afed2f69679ff2bbe1c5375950b0e40d00ff000000005e05050505050507070100000024747a32526773486e74516b72794670707352466261313652546656503539684b72654a4d07070100000024747a315a6672455263414c42776d4171776f6e525859565142445439426a4e6a42484a750001';
* const pk = 'sppk7c7hkPj47yjYFEHX85q46sFJGw6RBrqoVSHwAJAT4e14KJwzoey';
* const sig = 'spsig1cdLkp1RLgUHAp13aRFkZ6MQDPp7xCnjAExGL3MBSdMDmT6JgQSX8cufyDgJRM3sinFtiCzLbsyP6d365EHoNevxhT47nx'
*
* const response = verifySignature(message, pk, sig);
* ```
*
*/
export declare function verifySignature(message: string | Uint8Array, publicKey: string, signature: string, watermark?: Uint8Array, pop?: boolean): boolean;