upleb.uk

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

summaryrefslogtreecommitdiff
path: root/47.md
diff options
context:
space:
mode:
authorRobert C. Martin <unclebob@cleancoder.com>2023-05-09 10:17:15 -0500
committerGitHub <noreply@github.com>2023-05-09 12:17:15 -0300
commit60aa6ae168e8d71e4fd247e49f8ba70fbe511fda (patch)
treed620e1c4dc67033b937df3cf28445f45ed3377fb /47.md
parentd70aa87f076f8609950fc96e4e66d86c711c66ac (diff)
A few changes to some nips. (#510)
Diffstat (limited to '47.md')
-rw-r--r--47.md19
1 files changed, 15 insertions, 4 deletions
diff --git a/47.md b/47.md
index aa58b5c..fe3d575 100644
--- a/47.md
+++ b/47.md
@@ -12,8 +12,18 @@ This NIP describes a way for clients to access a remote Lightning wallet through
12 12
13## Terms 13## Terms
14 14
15* **client**: Nostr app on any platform that wants to pay Lightning invoices 15* **client**: Nostr app on any platform that wants to pay Lightning invoices.
16* **wallet service**: Nostr app that typically runs on an always-on computer (eg. in the cloud or on a Raspberry Pi). 16* **user**: The person using the **client**, and want's to connect their wallet app to their **client**.
17* **wallet service**: Nostr app that typically runs on an always-on computer (eg. in the cloud or on a Raspberry Pi). This app has access to the APIs of the wallets it serves.
18
19## Theory of Operation
20 1. **Users** who which to use this NIP to send lightning payments to other nostr users must first acquire a special "connection" URI from their NIP-47 compliant wallet application. The wallet application may provide this URI using a QR screen, or a pasteable string, or some other means.
21
22 2. The **user** should then copy this URI into their **client(s)** by pasting, or scanning the QR, etc. The **client(s)** should save this URI and use it later whenever the **user** makes a payment. The **client** should then request an `info` (13194) event from the relay(s) specified in the URI. The **wallet service** will have sent that event to those relays earlier, and the relays will hold it as a replaceable event.
23
24 3. When the **user** initiates a payment their nostr **client** create a `pay_invoice` request, encrypts it using a token from the URI, and sends it (kind 23194) to the relay(s) specified in the connection URI. The **wallet service** will be listening on those relays and will decrypt the request and then contact the **user's** wallet application to send the payment. The **wallet service** will know how to talk to the wallet application because the connection URI specified relay(s) that have access to the wallet app API.
25
26 4. Once the payment is complete the **wallet service** will send an encrypted `response` (kind 23195) to the **user** over the relay(s) in the URI.
17 27
18## Events 28## Events
19 29
@@ -24,7 +34,8 @@ There are three event kinds:
24 34
25The info event should be a replaceable event that is published by the **wallet service** on the relay to indicate which commands it supports. The content should be 35The info event should be a replaceable event that is published by the **wallet service** on the relay to indicate which commands it supports. The content should be
26a plaintext string with the supported commands, space-seperated, eg. `pay_invoice get_balance`. Only the `pay_invoice` command is described in this NIP, but other commands might be defined in different NIPs. 36a plaintext string with the supported commands, space-seperated, eg. `pay_invoice get_balance`. Only the `pay_invoice` command is described in this NIP, but other commands might be defined in different NIPs.
27Both the request and response events SHOULD contain one `p` tag, containing the public key of the **wallet service** if this is a request, and the public key of the **client** if this is a response. The response event SHOULD contain an `e` tag with the id of the request event it is responding to. 37
38Both the request and response events SHOULD contain one `p` tag, containing the public key of the **wallet service** if this is a request, and the public key of the **user** if this is a response. The response event SHOULD contain an `e` tag with the id of the request event it is responding to.
28 39
29The content of requests and responses is encrypted with [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md), and is a JSON-RPCish object with a semi-fixed structure: 40The content of requests and responses is encrypted with [NIP04](https://github.com/nostr-protocol/nips/blob/master/04.md), and is a JSON-RPCish object with a semi-fixed structure:
30 41
@@ -117,7 +128,7 @@ Errors:
117## Example pay invoice flow 128## Example pay invoice flow
118 129
1190. The user scans the QR code generated by the **wallet service** with their **client** application, they follow a `nostr+walletconnect:` deeplink or configure the connection details manually. 1300. The user scans the QR code generated by the **wallet service** with their **client** application, they follow a `nostr+walletconnect:` deeplink or configure the connection details manually.
1201. **client** sends an event to with **wallet service** service with kind `23194`. The content is a `pay_invoice` request. The private key is the secret from the connection string above. 1311. **client** sends an event to the **wallet service** service with kind `23194`. The content is a `pay_invoice` request. The private key is the secret from the connection string above.
1212. **wallet service** verifies that the author's key is authorized to perform the payment, decrypts the payload and sends the payment. 1322. **wallet service** verifies that the author's key is authorized to perform the payment, decrypts the payload and sends the payment.
1223. **wallet service** responds to the event by sending an event with kind `23195` and content being a response either containing an error message or a preimage. 1333. **wallet service** responds to the event by sending an event with kind `23195` and content being a response either containing an error message or a preimage.
123 134