feat: upgrade bot

This commit is contained in:
2024-10-20 22:11:34 +01:00
parent b417ff27d7
commit eaaa7edc78
7 changed files with 229 additions and 57 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@snort/system",
"version": "1.5.1",
"version": "1.5.2",
"description": "Snort nostr system package",
"type": "module",
"main": "dist/index.js",

View File

@ -4,6 +4,7 @@ import { EventExt } from "./event-ext";
import { Nip4WebCryptoEncryptor } from "./impl/nip4";
import { Nip44Encryptor } from "./impl/nip44";
import { NostrEvent, NotSignedNostrEvent } from "./nostr";
import { randomBytes } from "@noble/hashes/utils";
export type SignerSupports = "nip04" | "nip44" | string;
@ -31,6 +32,14 @@ export class PrivateKeySigner implements EventSigner {
this.#publicKey = getPublicKey(this.#privateKey);
}
/**
* Generate a new private key
*/
static random() {
const k = randomBytes(32);
return new PrivateKeySigner(k);
}
get supports(): string[] {
return ["nip04", "nip44"];
}