allow platform-specific NIP-44 decryption - #86
Conversation
Users may be reluctant to grant a website full NIP-44 decryption access.
This lets a site request limited permission: plaintext is returned only if it is JSON whose `tags` include a `platforms` tag matching one of the permitted platforms.
For example, a game named "Foo" can wrap player messages as:
```
{"content":"...","tags":[["platforms","Foo"]]}
```
stringify that object, then encrypt it with NIP-44. The JSON may be a fully signed Nostr event, but it does not have to be.
On decrypt, the site calls `nip44.decrypt` with `{platforms: ["Foo"]}`. That means it is asking only to read messages tagged for "Foo", not to inspect encrypted events from other Nostr apps (such as general-purpose DMs).
|
There was some idea somewhere of calling a different encryption/decryption function with the full wrapper event (where the ciphertext lives) so the extension would know better whether to agree or not. Isn't this similar? |
|
Not necessarily. Maybe a tag like "encryption context" would be better than "platforms". I'm open to other suggestions. |
|
I'd be ok with a |
|
Maybe "label" wouls sound better?
And the extension will give the decrypted plaintext to the website only if it's a JSON string that looks like: |
Users may be reluctant to grant a website full NIP-44 decryption access.
This lets a site request limited permission: plaintext is returned only if it is JSON whose
tagsinclude aplatformstag matching one of the permitted platforms.For example, a game named "Foo" can wrap player messages as:
stringify that object, then encrypt it with NIP-44. The JSON may be a fully signed Nostr event, but it does not have to be.
On decrypt, the site calls
nip44.decryptwith{platforms: ["Foo"]}. That means it is asking only to read messages tagged for "Foo", not to inspect encrypted events from other Nostr apps (such as general-purpose DMs).If the decrypted plaintext is not a json with a platform-tag of "Foo", the website will not be exposed to any of the plaintext and will get an error instead.
This is the first implementation of this idea, there is no NIP defining it yet.
An example website that uses this is: https://betwithfriends.niot.space
When placing a bet, users encrypt their lightning address so that only the page admin could see it.
The page admin may not want to allow the website to decrypt everything - only things related to this website (or a similar platform implementation on a different domain).