upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/46.md
diff options
context:
space:
mode:
authorVitor Pamplona <vitor@vitorpamplona.com>2024-05-30 15:32:46 -0400
committerVitor Pamplona <vitor@vitorpamplona.com>2024-05-30 15:32:46 -0400
commitd5b77b6d7348061cd0f16adc35e4d02a3a0b7380 (patch)
treef00539ec0e0a8b6bf027ff6a9b93846adafa02b3 /46.md
parent48674e563865b1cb7bb3c5c7869d20055446f408 (diff)
parent5c796c19fd6330628a0b328bfcf5270cb2bc3aff (diff)
Merge remote-tracking branch 'upstream/master' into draft-event
# Conflicts: # README.md
Diffstat (limited to '46.md')
-rw-r--r--46.md41
1 files changed, 23 insertions, 18 deletions
diff --git a/46.md b/46.md
index eb96494..1528116 100644
--- a/46.md
+++ b/46.md
@@ -25,7 +25,7 @@ This is most common in a situation where you have your own nsecbunker or other t
25The remote signer would provide a connection token in the form: 25The remote signer would provide a connection token in the form:
26 26
27``` 27```
28bunker://<remote-pubkey>?relay=<wss://relay-to-connect-on>&relay=<wss://another-relay-to-connect-on>&secret=<optional-secret-value> 28bunker://<remote-user-pubkey>?relay=<wss://relay-to-connect-on>&relay=<wss://another-relay-to-connect-on>&secret=<optional-secret-value>
29``` 29```
30 30
31This token is pasted into the client by the user and the client then uses the details to connect to the remote signer via the specified relay(s). 31This token is pasted into the client by the user and the client then uses the details to connect to the remote signer via the specified relay(s).
@@ -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,17 +119,21 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.c
118 119
119Each of the following are methods that the client sends to the remote signer. 120Each 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>]` | "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>` |
133
134### Requested permissions
135
136The `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.
132 137
133## Response Events `kind:24133` 138## Response Events `kind:24133`
134 139
@@ -149,13 +154,13 @@ The `content` field is a JSON-RPC-like message that is [NIP-04](https://github.c
149{ 154{
150 "id": <request_id>, 155 "id": <request_id>,
151 "result": <results_string>, 156 "result": <results_string>,
152 "error": <error_string> 157 "error": <optional_error_string>
153} 158}
154``` 159```
155 160
156- `id` is the request ID that this response is for. 161- `id` is the request ID that this response is for.
157- `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)
158- `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.
159 164
160### Auth Challenges 165### Auth Challenges
161 166
@@ -185,7 +190,7 @@ Each of the following are methods that the client sends to the remote signer.
185 190
186| Command | Params | Result | 191| Command | Params | Result |
187| ---------------- | ------------------------------------------ | ------------------------------------ | 192| ---------------- | ------------------------------------------ | ------------------------------------ |
188| `create_account` | `[<username>, <domain>, <optional_email>]` | `<newly_created_remote_user_pubkey>` | 193| `create_account` | `[<username>, <domain>, <optional_email>, <optional_requested_permissions>]` | `<newly_created_remote_user_pubkey>` |
189 194
190## Appendix 195## Appendix
191 196
@@ -203,7 +208,7 @@ When the user types a NIP-05 the client:
203 208
204#### Remote signer discovery via NIP-89 209#### Remote signer discovery via NIP-89
205 210
206In 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. 211In 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.
207 212
208First the client will query for `kind: 31990` events that have a `k` tag of `24133`. 213First the client will query for `kind: 31990` events that have a `k` tag of `24133`.
209 214