UNPKG

@taquito/utils

Version:

converts michelson data and types into convenient JS/TS objects

25 lines (24 loc) 1.53 kB
import { Prefix } from './taquito-utils'; type PkPrefix = Prefix.EDPK | Prefix.SPPK | Prefix.P2PK | Prefix.BLPK; /** * @description Verify signature of a payload * * @param messageBytes 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) * @param publicKey The public key to verify the signature against * @param signature The signature to verify * @returns A boolean indicating if the signature matches * @throws {@link InvalidPublicKeyError} | {@link InvalidSignatureError} | {@link InvalidMessageError} * @example * ``` * const message = '03d0c10e3ed11d7c6e3357f6ef335bab9e8f2bd54d0ce20c482e241191a6e4b8ce6c01be917311d9ac46959750e405d57e268e2ed9e174a80794fbd504e12a4a000141eb3781afed2f69679ff2bbe1c5375950b0e40d00ff000000005e05050505050507070100000024747a32526773486e74516b72794670707352466261313652546656503539684b72654a4d07070100000024747a315a6672455263414c42776d4171776f6e525859565142445439426a4e6a42484a750001'; * const pk = 'sppk7c7hkPj47yjYFEHX85q46sFJGw6RBrqoVSHwAJAT4e14KJwzoey'; * const sig = 'spsig1cdLkp1RLgUHAp13aRFkZ6MQDPp7xCnjAExGL3MBSdMDmT6JgQSX8cufyDgJRM3sinFtiCzLbsyP6d365EHoNevxhT47nx' * * const response = verifySignature(message, pk, sig); * ``` * */ export declare function verifySignature(messageBytes: string, publicKey: string, signature: string, watermark?: Uint8Array): boolean; export declare function validatePkAndExtractPrefix(publicKey: string): PkPrefix; export {};