Add optional_requested_permissions

This is implemented in nsec.app, nostr.band, Coracle and Nostrudel, so maybe it's time to update the NIP.
This commit is contained in:
Nostr.Band 2024-03-22 08:01:37 +01:00 committed by fiatjaf_
parent cf0e6e1567
commit 4b79bc67c4

8
46.md
View File

@ -120,7 +120,7 @@ Each of the following are methods that the client sends to the remote signer.
| Command | Params | Result | | Command | Params | Result |
| ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- | | ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- |
| `connect` | `[<remote_user_pubkey>, <optional_secret>]` | "ack" | | `connect` | `[<remote_user_pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" |
| `sign_event` | `[<json_stringified_event_to_sign>]` | `json_stringified(<signed_event>)` | | `sign_event` | `[<json_stringified_event_to_sign>]` | `json_stringified(<signed_event>)` |
| `ping` | `[]` | "pong" | | `ping` | `[]` | "pong" |
| `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` | | `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` |
@ -130,6 +130,10 @@ Each of the following are methods that the client sends to the remote signer.
| `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` | | `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` |
| `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` | | `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.
## Response Events `kind:24133` ## Response Events `kind:24133`
```json ```json
@ -185,7 +189,7 @@ Each of the following are methods that the client sends to the remote signer.
| Command | Params | Result | | Command | Params | Result |
| ---------------- | ------------------------------------------ | ------------------------------------ | | ---------------- | ------------------------------------------ | ------------------------------------ |
| `create_account` | `[<username>, <domain>, <optional_email>]` | `<newly_created_remote_user_pubkey>` | | `create_account` | `[<username>, <domain>, <optional_email>, <optional_requested_permissions>]` | `<newly_created_remote_user_pubkey>` |
## Appendix ## Appendix