"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.verifyP2PKSig = void 0; const secp256k1_1 = require("@noble/curves/secp256k1"); const sha256_1 = require("@noble/hashes/sha256"); const NUT11_js_1 = require("../common/NUT11.js"); const verifyP2PKSig = (proof) => { if (!proof.witness) { throw new Error('could not verify signature, no witness provided'); } const parsedSecret = (0, NUT11_js_1.parseSecret)(proof.secret); // const tags = {} as Tags // parsedSecret[1].tags.forEach((e: string[]) => {tags[e[0]]=e.shift()}) // if (tags.locktime) { // const locktime = parseInt(tags.locktime[1]) // let isUnlocked = false // if (Math.floor(Date.now() / 1000)>=locktime) { // isUnlocked = true // } // } // if (tags.sigflag as SigFlag) { // if (tags.sigflag[0]==='SIG_INPUT') { // } // else if(tags.sigflag[0]==='SIG_ALL') { // } // else { // throw new Error("Unknown sigflag"); // } // } // if (tags.n_sigs) { // if (tags.pubkeys) { // } // } return secp256k1_1.schnorr.verify(proof.witness.signatures[0], (0, sha256_1.sha256)(new TextDecoder().decode(proof.secret)), parsedSecret[1].data); }; exports.verifyP2PKSig = verifyP2PKSig; //# sourceMappingURL=NUT11.js.map