-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implemented nip04 #1777
feat: implemented nip04 #1777
Conversation
🚀 Thanks for the pull request! Here are the current build files for testing: Download and unzip the file for your browser. Refer to the readme for detailed install instructions. Don't forget: keep earning sats! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropped some questions.
|
||
encrypt(pubkey: string, text: string) { | ||
const key = secp256k1.getSharedSecret(this.getPrivateKey(), "02" + pubkey); | ||
const normalizedKey = Buffer.from(key.slice(1, 33)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this doing?
should this be a compressed key?
https://www.npmjs.com/package/@noble/secp256k1#getsharedsecretprivatekeya-publickeyb
isCompressed = false determines whether to return compact (33-byte), or full (65-byte) key
@@ -36,6 +42,35 @@ class Nostr { | |||
event.sig = signature; | |||
return event; | |||
} | |||
|
|||
encrypt(pubkey: string, text: string) { | |||
const key = secp256k1.getSharedSecret(this.getPrivateKey(), "02" + pubkey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this 02
?
src/extension/background-script/actions/nostr/decryptOrPrompt.ts
Outdated
Show resolved
Hide resolved
src/extension/background-script/actions/nostr/encryptOrPrompt.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Michael Bumann <hello@michaelbumann.com>
Co-authored-by: Michael Bumann <hello@michaelbumann.com>
Describe the changes you have made in this PR
Implement NIP04:
encrypt
&decrypt
Link this PR to an issue [optional]
#1730
Type of change
feat
: New feature (non-breaking change which adds functionality)