latest discoveries.

This commit is contained in:
fiatjaf 2023-12-02 14:45:10 -03:00
parent 6c35537ca4
commit 3983a52d3b
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

28
46.md
View File

@ -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
```
<npub1...>#<secret>?relay=wss://...&relay=wss://...
<npub1...>#<optional-secret>?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", "<signer-key-hex>"]
],
"content": "nip04_encrypted_json({id: <random-string>, method: <see-below>, params: []})",
"content": "nip04_encrypted_json({id: <random-string>, method: <see-below>, params: [array_of_strings]})",
...
}
```
@ -58,27 +58,29 @@ And the events the remote signer sends to the client have the following format:
"tags": [
["p", "<client-key-hex>"]
],
"content": "nip04_encrypted_json({id: <request-id>, result: <any>, error: <reason-string>})",
"content": "nip04_encrypted_json({id: <request-id>, result: <string>, error: <reason-string>})",
...
```
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`