From 379662a27b719fc68998c034f2dd131202316f09 Mon Sep 17 00:00:00 2001 From: Martti Malmi Date: Mon, 21 Aug 2023 23:35:11 +0300 Subject: [PATCH] add Key.isMine(str) --- src/js/components/PrivateMessage.tsx | 2 +- src/js/nostr/Key.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/components/PrivateMessage.tsx b/src/js/components/PrivateMessage.tsx index 69678b4b6..6ec558d03 100644 --- a/src/js/components/PrivateMessage.tsx +++ b/src/js/components/PrivateMessage.tsx @@ -58,7 +58,7 @@ const PrivateMessage = ({ event, selfAuthored, showName }: Props) => { ); } diff --git a/src/js/nostr/Key.ts b/src/js/nostr/Key.ts index ed56011d2..8e81c22b2 100644 --- a/src/js/nostr/Key.ts +++ b/src/js/nostr/Key.ts @@ -85,6 +85,9 @@ export default { getPrivKey(): string { return this.key?.priv || ''; }, + isMine(pubkey: string) { + return new PublicKey(pubkey).equals(this.getPubKey()); + }, encrypt: async function (data: string, pub?: string): Promise { const k = this.key; pub = pub || k.rpub || '';