Skip to content

Commit

Permalink
add Key.isMine(str)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalmi committed Aug 21, 2023
1 parent dd254a4 commit 379662a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/components/PrivateMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const PrivateMessage = ({ event, selfAuthored, showName }: Props) => {
<PrivateMessage
event={innerEvent}
showName={true}
selfAuthored={innerEvent.pubkey === Key.getPubKey()}
selfAuthored={Key.isMine(innerEvent.pubkey)}
/>
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/js/nostr/Key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> {
const k = this.key;
pub = pub || k.rpub || '';
Expand Down

0 comments on commit 379662a

Please sign in to comment.