@cardano-foundation/cardano-verify-datasignature
Version:
A lightweight typescript library to verify a cip30 datasignature for browser and nodejs
26 lines (25 loc) • 1.02 kB
TypeScript
/**
* This method can be used to verify a cip30 data signature.
*
* https://cips.cardano.org/cips/cip30/#datasignature
* type DataSignature = {
* signature: cbor\<COSE_Sign1>,
* key: cbor\<COSE_Key>,
* };
*
* Optional:
*
* Furthermore a plain text message can be provided to check if both
* the plain text and the signed message are equal
*
* Also a payment (addr1/addr_test1) or stake address (stake1/stake_test1) can be provided
* to verify that this readable address belongs to the signature
*
* @param {string} signature - A COSE_Sign1 cbor string.
* @param {string} key - A COSE_Key cbor string
* @param {string} message - An optional plain text message
* @param {string} address - An optional address starting with (addr1/addr_test1/stake1/stake_test1)
* @returns {string} boolean - True if the verification was successful otherwise false
*/
declare const verifySignature: (signature: string, key: string, message?: string, address?: string) => boolean;
export default verifySignature;