From 3983a52d3bb720852090ee02911f56ee2701dd73 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 2 Dec 2023 14:45:10 -0300 Subject: [PATCH] latest discoveries. --- 46.md | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/46.md b/46.md index 1a9be035..ce319709 100644 --- a/46.md +++ b/46.md @@ -12,12 +12,12 @@ This NIP describes a method for 2-way communication between a **remote signer** The 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. -### Started by the signer +### Started by the signer (nsecBunker) The remote signer generates a connection token in the form ``` -#?relay=wss://...&relay=wss://... +#?relay=wss://...&relay=wss://... ``` The 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 ## Event payloads -Event payloads are [NIP-04](04.md)-encrypted JSON blobs that look like JSONRPC. +Event 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). Events sent by the client to the remote signer have the following format: @@ -45,7 +45,7 @@ Events sent by the client to the remote signer have the following format: "tags": [ ["p", ""] ], - "content": "nip04_encrypted_json({id: , method: , params: []})", + "content": "nip04_encrypted_json({id: , method: , params: [array_of_strings]})", ... } ``` @@ -58,27 +58,29 @@ And the events the remote signer sends to the client have the following format: "tags": [ ["p", ""] ], - "content": "nip04_encrypted_json({id: , result: , error: })", + "content": "nip04_encrypted_json({id: , result: , error: })", ... ``` +The signer key will always be the key of the user who controls the signer device. + ### Methods - **connect** - params: [`pubkey`, `secret`] - - result: `null` + - result: `"ack"` - **get_public_key** - params: [] - - result: `pubkey` + - result: `pubkey-hex` - **sign_event** - params: [`event`] - - result: `event_with_pubkey_id_and_signature` + - result: `json_string(event_with_pubkey_id_and_signature)` - **get_relays** - params: [] - - result: `{ [url: string]: {read: boolean, write: boolean} }` + - result: `json_string({[url: string]: {read: boolean, write: boolean}})` - **nip04_encrypt** - - params: [`peer-pubkey`, `plaintext`] - - result: `nip4 ciphertext` + - params: [`third-party-pubkey`, `plaintext`] + - result: `nip04-ciphertext` - **nip04_decrypt** - - params: [`peer-pubkey`, `nip4 ciphertext`] - - result: [`plaintext`] + - params: [`third-party-pubkey`, `nip04-ciphertext`] + - result: `plaintext`