Skip to content
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

Failing NIP-44 encryption/decryption #45

Open
twenty-eighty opened this issue Jan 3, 2025 · 4 comments
Open

Failing NIP-44 encryption/decryption #45

twenty-eighty opened this issue Jan 3, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@twenty-eighty
Copy link

Encrypting/decrypting with nip44.encrypt and nip44.decrypt fail for NIP-37 draft events.
The same application works with nos2x on Brave (Linux).

When I get the dialogs to confirm usage of my nsec I always clicked "Autorize forever".

encryption:
[nos2x-fox:9366] calling nip44.encrypt with {"peer":"0f4795bf31824a414148daf1b589bb8138fb0a03963f984c84462e40a8365abe","plaintext":"{\"created_at\":1735923539,\"content\":\"text content\\n\",\"tags\":[[\"alt\",\"This is a long form article, you can read it in https://pareto.space/a/naddr1qqxnzdenx5unyv3h8qun2wp5qgsq73u4huccyjjpg9yd4ud43xaczw8mpgpev0ucfjzyvtjq4qm940srqsqqqa2gqyv8wumn8ghj7mn0wd68ytnsv9ex2ar09eehqctrv53cqza9\"],[\"client\",\"Pareto\",\"31990:0f479c7dff7bb53dae53f3bb32ad1109edbb07ba562bdd5168044b3f4364e7b5:8020802080208020\",\"wss://nostr.pareto.space\"],[\"d\",\"1735922789584\"],[\"summary\",\"z1\"],[\"title\",\"t1\"],[\"zap\",\"0f4795bf31824a414148daf1b589bb8138fb0a03963f984c84462e40a8365abe\",\"wss://nostr.pareto.space\",\"80\"],[\"zap\",\"0f479c7dff7bb53dae53f3bb32ad1109edbb07ba562bdd5168044b3f4364e7b5\",\"wss://nostr.pareto.space\",\"20\"]],\"kind\":30024,\"pubkey\":\"0f4795bf31824a414148daf1b589bb8138fb0a03963f984c84462e40a8365abe\",\"id\":\"945cbde5ad13fc6116684f8a313671773905816a4911a4aff0a576f29996f988\",\"sig\":\"a773c5fdd6b84fa101a2110bca8fb11f5b554ee64a12ecbad547738b8779a87fedf192d10ed9bbd3f02e8767225c7638363d9841fb741d7df1fed7836f846975\"}"}
Screenshot from 2025-01-03 17-00-28

decryption:
Screenshot from 2025-01-03 16-56-15

Which additional information should I provide for reproduction of the issue?

@diegogurpegui
Copy link
Owner

Thanks! I'll take a look.

@diegogurpegui diegogurpegui added the bug Something isn't working label Jan 3, 2025
@twenty-eighty
Copy link
Author

If you give me your npub I'll give you access to the application for testing (currently in test mode).

@diegogurpegui
Copy link
Owner

I tried to encrypt the content you provided in your example (seen on the "plaintext" field in what you pasted) and I found no issues.
Just calling window.nostr.nip04.encrypt(pubkey, plaintext).
That function, in the extension, just calles the nip44 encryption from a library (https://github.com/nbd-wtf/nostr-tools). It does nothing more. If any NIP 44 encryption/decryption works, this should too.

If you can send me a website where I can test it in order to reproduce it perhaps it will help.

@twenty-eighty
Copy link
Author

Ok, sent you a DM (Nostr).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants