NIP-46 draft

This commit is contained in:
2023-07-05 11:41:47 +01:00
parent 9640a7fa57
commit 68b9a89278
8 changed files with 256 additions and 65 deletions

View File

@ -1,6 +1,6 @@
import * as secp from "@noble/curves/secp256k1";
import * as utils from "@noble/curves/abstract/utils";
import { sha256, unixNow } from "@snort/shared";
import { getPublicKey, sha256, unixNow } from "@snort/shared";
import { EventKind, HexKey, NostrEvent } from ".";
import { Nip4WebCryptoEncryptor } from "./impl/nip4";
@ -36,6 +36,7 @@ export abstract class EventExt {
* Sign this message with a private key
*/
static sign(e: NostrEvent, key: HexKey) {
e.pubkey = getPublicKey(key);
e.id = this.createId(e);
const sig = secp.schnorr.sign(e.id, key);