nip46: abandon nip04 entirely and just use nip44.

This commit is contained in:
fiatjaf 2024-05-19 14:54:04 -03:00
parent d85c347813
commit 18bd7c46c5

18
46.md
View File

@ -56,7 +56,7 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
{
"kind": 24133,
"pubkey": "eff37350d839ce3707332348af4549a96051bd695d3223af4aabce4993531d86",
"content": nip04({
"content": nip44({
"id": <random_string>,
"method": "sign_event",
"params": [json_stringified(<{
@ -76,7 +76,7 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
{
"kind": 24133,
"pubkey": "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52",
"content": nip04({
"content": nip44({
"id": <random_string>,
"result": json_stringified(<signed-event>)
}),
@ -95,13 +95,13 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata
"id": <id>,
"kind": 24133,
"pubkey": <local_keypair_pubkey>,
"content": <nip04(<request>)>,
"content": <nip44(<request>)>,
"tags": [["p", <remote_user_pubkey>]], // NB: in the `create_account` event, the remote signer pubkey should be `p` tagged.
"created_at": <unix timestamp in seconds>
}
```
The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) encrypted and has the following structure:
The `content` field is a JSON-RPC-like message that is [NIP-44](https://github.com/nostr-protocol/nips/blob/master/44.md) encrypted and has the following structure:
```json
{
@ -126,14 +126,12 @@ Each of the following are methods that the client sends to the remote signer.
| `ping` | `[]` | "pong" |
| `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` |
| `get_public_key` | `[]` | `<hex-pubkey>` |
| `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` |
| `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` |
| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` |
| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` |
### Requested permissions
The `connect` method may be provided with `optional_requested_permissions` for user convenience. The permissions are a comma-separated list of `method[:params]`, i.e. `nip04_encrypt,sign_event:4` meaning permissions to call `nip04_encrypt` and to call `sign_event` with `kind:4`. Optional parameter for `sign_event` is the kind number, parameters for other methods are to be defined later.
The `connect` method may be provided with `optional_requested_permissions` for user convenience. The permissions are a comma-separated list of `method[:params]`, i.e. `nip44_encrypt,sign_event:14` meaning permissions to call `nip44_encrypt` and to call `sign_event` with `kind:14`. Optional parameter for `sign_event` is the kind number, parameters for other methods are to be defined later.
## Response Events `kind:24133`
@ -142,13 +140,13 @@ The `connect` method may be provided with `optional_requested_permissions` for u
"id": <id>,
"kind": 24133,
"pubkey": <remote_signer_pubkey>,
"content": <nip04(<response>)>,
"content": <nip44(<response>)>,
"tags": [["p", <local_keypair_pubkey>]],
"created_at": <unix timestamp in seconds>
}
```
The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) encrypted and has the following structure:
The `content` field is a JSON-RPC-like message that is [NIP-44](https://github.com/nostr-protocol/nips/blob/master/44.md) encrypted and has the following structure:
```json
{
@ -224,4 +222,4 @@ Coming soon...
## References
- [NIP-04 - Encryption](https://github.com/nostr-protocol/nips/blob/master/04.md)
- [NIP-44 - Encryption](https://github.com/nostr-protocol/nips/blob/master/44.md)