diff options
| author | Adam Soltys <[email protected]> | 2026-02-11 20:10:43 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 20:10:43 -0800 |
| commit | 56a04684c1fb77ea7b21afc6b0d2e1c4773906f6 (patch) | |
| tree | d6bc2557c56b93177bb14aa376847c6e123a4862 /src/lib/nip07.ts | |
| parent | 13466248004327e9a026cb89f94926f9b060d1c1 (diff) | |
| download | coinos-ui-56a04684c1fb77ea7b21afc6b0d2e1c4773906f6.tar.gz coinos-ui-56a04684c1fb77ea7b21afc6b0d2e1c4773906f6.zip | |
format
Diffstat (limited to 'src/lib/nip07.ts')
| -rw-r--r-- | src/lib/nip07.ts | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/lib/nip07.ts b/src/lib/nip07.ts index 4b32512f..c26226d9 100644 --- a/src/lib/nip07.ts +++ b/src/lib/nip07.ts @@ -15,16 +15,9 @@ export const signEvent = async (event: any, user: any): Promise<any> => { }; // Encrypts an event in NIP-44 using NIP-07 if available, otherwise getPrivateKey() -export const encrypt = async ( - json: any, - user: any, - receiverPK: string, -): Promise<string> => { +export const encrypt = async (json: any, user: any, receiverPK: string): Promise<string> => { if ((await (window as any).nostr.getPublicKey()) === user.pubkey) { - return (window as any).nostr.nip44.encrypt( - receiverPK, - JSON.stringify(json), - ); + return (window as any).nostr.nip44.encrypt(receiverPK, JSON.stringify(json)); } else { const senderSK = await getPrivateKey(user); const senderSKString = bytesToHex(senderSK); @@ -34,15 +27,9 @@ export const encrypt = async ( }; // Decrypts an event in NIP-44 using NIP-07 if available, otherwise getPrivateKey() -export const decrypt = async ( - encrypted: string, - user: any, - receiverPK: string, -): Promise<any> => { +export const decrypt = async (encrypted: string, user: any, receiverPK: string): Promise<any> => { if ((await (window as any).nostr.getPublicKey()) === user.pubkey) { - return JSON.parse( - await (window as any).nostr.nip44.decrypt(receiverPK, encrypted), - ); + return JSON.parse(await (window as any).nostr.nip44.decrypt(receiverPK, encrypted)); } else { const senderSK = await getPrivateKey(user); const senderSKString = bytesToHex(senderSK); |
