mirror of
https://github.com/dergigi/boris.git
synced 2026-01-03 06:54:53 +01:00
- Add project structure with TypeScript, React, and Vite - Implement nostr authentication using browser extension (NIP-07) - Add NIP-51 compliant bookmark fetching and display - Create minimal UI with login and bookmark components - Integrate applesauce-core and applesauce-react libraries - Add responsive styling with dark/light mode support - Include comprehensive README with setup instructions This is a minimal MVP for a nostr bookmark client that allows users to view their bookmarks according to NIP-51 specification.
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
"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
|