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:
authorfiatjaf <fiatjaf@gmail.com>2023-12-02 14:45:10 -0300
committerfiatjaf <fiatjaf@gmail.com>2023-12-02 14:45:10 -0300
commit3983a52d3bb720852090ee02911f56ee2701dd73 (patch)
treeb0635e92d72f84e5a0f4c3376ea360a6852a1769 /46.md
parent6c35537ca425f154ca1c92897ab0eac599a80c87 (diff)
latest discoveries.
Diffstat (limited to '46.md')
-rw-r--r--46.md28
1 files changed, 15 insertions, 13 deletions
diff --git a/46.md b/46.md
index 1a9be03..ce31970 100644
--- a/46.md
+++ b/46.md
@@ -12,12 +12,12 @@ This NIP describes a method for 2-way communication between a **remote signer**
12 12
13The client always starts by generating a random key which is used to communicate with the signer, then it one of the methods below is used to allow the client to know what is the signer public key for the session and which relays to use. 13The client always starts by generating a random key which is used to communicate with the signer, then it one of the methods below is used to allow the client to know what is the signer public key for the session and which relays to use.
14 14
15### Started by the signer 15### Started by the signer (nsecBunker)
16 16
17The remote signer generates a connection token in the form 17The remote signer generates a connection token in the form
18 18
19``` 19```
20<npub1...>#<secret>?relay=wss://...&relay=wss://... 20<npub1...>#<optional-secret>?relay=wss://...&relay=wss://...
21``` 21```
22 22
23The user copies that token and pastes it in the client UI somehow. Then the client can send events of kind `24133` to the specified relays and wait for responses from the remote signer. 23The user copies that token and pastes it in the client UI somehow. Then the client can send events of kind `24133` to the specified relays and wait for responses from the remote signer.
@@ -34,7 +34,7 @@ The signer scans the QR code and sends a `connect` message to the client in the
34 34
35## Event payloads 35## Event payloads
36 36
37Event payloads are [NIP-04](04.md)-encrypted JSON blobs that look like JSONRPC. 37Event payloads are [NIP-04](04.md)-encrypted JSON blobs that look like JSONRPC messages (their format is specified inside the `.content` of the event formats nelow).
38 38
39Events sent by the client to the remote signer have the following format: 39Events sent by the client to the remote signer have the following format:
40 40
@@ -45,7 +45,7 @@ Events sent by the client to the remote signer have the following format:
45 "tags": [ 45 "tags": [
46 ["p", "<signer-key-hex>"] 46 ["p", "<signer-key-hex>"]
47 ], 47 ],
48 "content": "nip04_encrypted_json({id: <random-string>, method: <see-below>, params: []})", 48 "content": "nip04_encrypted_json({id: <random-string>, method: <see-below>, params: [array_of_strings]})",
49 ... 49 ...
50} 50}
51``` 51```
@@ -58,27 +58,29 @@ And the events the remote signer sends to the client have the following format:
58 "tags": [ 58 "tags": [
59 ["p", "<client-key-hex>"] 59 ["p", "<client-key-hex>"]
60 ], 60 ],
61 "content": "nip04_encrypted_json({id: <request-id>, result: <any>, error: <reason-string>})", 61 "content": "nip04_encrypted_json({id: <request-id>, result: <string>, error: <reason-string>})",
62 ... 62 ...
63``` 63```
64 64
65The signer key will always be the key of the user who controls the signer device.
66
65### Methods 67### Methods
66 68
67- **connect** 69- **connect**
68 - params: [`pubkey`, `secret`] 70 - params: [`pubkey`, `secret`]
69 - result: `null` 71 - result: `"ack"`
70- **get_public_key** 72- **get_public_key**
71 - params: [] 73 - params: []
72 - result: `pubkey` 74 - result: `pubkey-hex`
73- **sign_event** 75- **sign_event**
74 - params: [`event`] 76 - params: [`event`]
75 - result: `event_with_pubkey_id_and_signature` 77 - result: `json_string(event_with_pubkey_id_and_signature)`
76- **get_relays** 78- **get_relays**
77 - params: [] 79 - params: []
78 - result: `{ [url: string]: {read: boolean, write: boolean} }` 80 - result: `json_string({[url: string]: {read: boolean, write: boolean}})`
79- **nip04_encrypt** 81- **nip04_encrypt**
80 - params: [`peer-pubkey`, `plaintext`] 82 - params: [`third-party-pubkey`, `plaintext`]
81 - result: `nip4 ciphertext` 83 - result: `nip04-ciphertext`
82- **nip04_decrypt** 84- **nip04_decrypt**
83 - params: [`peer-pubkey`, `nip4 ciphertext`] 85 - params: [`third-party-pubkey`, `nip04-ciphertext`]
84 - result: [`plaintext`] 86 - result: `plaintext`