wip: nsecbunker

This commit is contained in:
2023-10-20 09:36:49 +07:00
parent e1e54c1a98
commit 7c8d8a09fd
7 changed files with 202 additions and 147 deletions

View File

@@ -304,20 +304,14 @@ export function useNostr() {
kind: NDKKind | number;
tags: string[][];
}): Promise<NDKEvent> => {
const privkey: string = await db.secureLoad(db.account.pubkey);
// #TODO: show prompt
if (!privkey) return;
const event = new NDKEvent(ndk);
const signer = new NDKPrivateKeySigner(privkey);
event.content = content;
event.kind = kind;
event.created_at = Math.floor(Date.now() / 1000);
event.pubkey = db.account.pubkey;
event.tags = tags;
await event.sign(signer);
await event.sign();
await event.publish();
return event;

View File

@@ -22,8 +22,7 @@ export interface DBEvent {
}
export interface Account extends NDKUserProfile {
id: number;
npub: string;
id: string;
pubkey: string;
follows: null | string[];
circles: null | string[];