diff options
Diffstat (limited to '46.md')
| -rw-r--r-- | 46.md | 35 |
1 files changed, 18 insertions, 17 deletions
| @@ -61,8 +61,9 @@ nostrconnect://<local-keypair-pubkey>?relay=<wss://relay-to-connect-on>&metadata | |||
| 61 | "method": "sign_event", | 61 | "method": "sign_event", |
| 62 | "params": [json_stringified(<{ | 62 | "params": [json_stringified(<{ |
| 63 | content: "Hello, I'm signing remotely", | 63 | content: "Hello, I'm signing remotely", |
| 64 | pubkey: "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", | 64 | kind: 1, |
| 65 | // ...the rest of the event data | 65 | tags: [], |
| 66 | created_at: 1714078911 | ||
| 66 | }>)] | 67 | }>)] |
| 67 | }), | 68 | }), |
| 68 | "tags": [["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]], // p-tags the remote user pubkey | 69 | "tags": [["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]], // p-tags the remote user pubkey |
| @@ -118,21 +119,21 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.c | |||
| 118 | 119 | ||
| 119 | Each of the following are methods that the client sends to the remote signer. | 120 | Each of the following are methods that the client sends to the remote signer. |
| 120 | 121 | ||
| 121 | | Command | Params | Result | | 122 | | Command | Params | Result | |
| 122 | | ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- | | 123 | | ------------------------ | ------------------------------------------------- | ---------------------------------------------------------------------- | |
| 123 | | `connect` | `[<remote_user_pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" | | 124 | | `connect` | `[<remote_user_pubkey>, <optional_secret>, <optional_requested_permissions>]` | "ack" | |
| 124 | | `sign_event` | `[<json_stringified_event_to_sign>]` | `json_stringified(<signed_event>)` | | 125 | | `sign_event` | `[<{kind, content, tags, created_at}>]` | `json_stringified(<signed_event>)` | |
| 125 | | `ping` | `[]` | "pong" | | 126 | | `ping` | `[]` | "pong" | |
| 126 | | `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` | | 127 | | `get_relays` | `[]` | `json_stringified({<relay_url>: {read: <boolean>, write: <boolean>}})` | |
| 127 | | `get_public_key` | `[]` | `<hex-pubkey>` | | 128 | | `get_public_key` | `[]` | `<hex-pubkey>` | |
| 128 | | `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` | | 129 | | `nip04_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip04_ciphertext>` | |
| 129 | | `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` | | 130 | | `nip04_decrypt` | `[<third_party_pubkey>, <nip04_ciphertext_to_decrypt>]` | `<plaintext>` | |
| 130 | | `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` | | 131 | | `nip44_encrypt` | `[<third_party_pubkey>, <plaintext_to_encrypt>]` | `<nip44_ciphertext>` | |
| 131 | | `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` | | 132 | | `nip44_decrypt` | `[<third_party_pubkey>, <nip44_ciphertext_to_decrypt>]` | `<plaintext>` | |
| 132 | 133 | ||
| 133 | ### Requested permissions | 134 | ### Requested permissions |
| 134 | 135 | ||
| 135 | 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. | 136 | 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. |
| 136 | 137 | ||
| 137 | ## Response Events `kind:24133` | 138 | ## Response Events `kind:24133` |
| 138 | 139 | ||
| @@ -153,13 +154,13 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.c | |||
| 153 | { | 154 | { |
| 154 | "id": <request_id>, | 155 | "id": <request_id>, |
| 155 | "result": <results_string>, | 156 | "result": <results_string>, |
| 156 | "error": <error_string> | 157 | "error": <optional_error_string> |
| 157 | } | 158 | } |
| 158 | ``` | 159 | ``` |
| 159 | 160 | ||
| 160 | - `id` is the request ID that this response is for. | 161 | - `id` is the request ID that this response is for. |
| 161 | - `results` is a string of the result of the call (this can be either a string or a JSON stringified object) | 162 | - `results` is a string of the result of the call (this can be either a string or a JSON stringified object) |
| 162 | - `error` is an error in string form. | 163 | - `error`, _optionally_, it is an error in string form, if any. Its presence indicates an error with the request. |
| 163 | 164 | ||
| 164 | ### Auth Challenges | 165 | ### Auth Challenges |
| 165 | 166 | ||
| @@ -207,7 +208,7 @@ When the user types a NIP-05 the client: | |||
| 207 | 208 | ||
| 208 | #### Remote signer discovery via NIP-89 | 209 | #### Remote signer discovery via NIP-89 |
| 209 | 210 | ||
| 210 | In this last case, most often used to fascilitate an OAuth-like signin flow, the client first looks for remote signers that have announced themselves via NIP-89 application handler events. | 211 | In this last case, most often used to facilitate an OAuth-like signin flow, the client first looks for remote signers that have announced themselves via NIP-89 application handler events. |
| 211 | 212 | ||
| 212 | First the client will query for `kind: 31990` events that have a `k` tag of `24133`. | 213 | First the client will query for `kind: 31990` events that have a `k` tag of `24133`. |
| 213 | 214 | ||