upleb.uk

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

summaryrefslogtreecommitdiff
path: root/90.md
diff options
context:
space:
mode:
authorPablo Fernandez <p@f7z.io>2023-11-11 18:27:13 +0200
committerGitHub <noreply@github.com>2023-11-11 18:27:13 +0200
commit8e2f3aa60a293dd65d5c42e9d61b9fb9114f2717 (patch)
treebc2c6da5056252bb934e9291898944a9a802ce49 /90.md
parentcbdca1e9643711c62e06a19d9c2d889699a7978d (diff)
parent7e3b7cd90c6e5c4ccba94b58231312aaac421551 (diff)
Merge pull request #860 from starbackr-dev/patch-2
Adding encryption NIP-90 Data Vending Machine
Diffstat (limited to '90.md')
-rw-r--r--90.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/90.md b/90.md
index 163dbd0..31447f2 100644
--- a/90.md
+++ b/90.md
@@ -67,6 +67,37 @@ All tags are optional.
67* `relays`: List of relays where Service Providers SHOULD publish responses to 67* `relays`: List of relays where Service Providers SHOULD publish responses to
68* `p`: Service Providers the customer is interested in. Other SPs MIGHT still choose to process the job 68* `p`: Service Providers the customer is interested in. Other SPs MIGHT still choose to process the job
69 69
70## Encrypted Params
71
72If the user wants to keep the input parameters a secret, they can encrypt the `i` and `param` tags with the service provider's 'p' tag and add it to the content field. Add a tag `encrypted` as tags. Encryption for private tags will use [NIP-04 - Encrypted Direct Message encryption](https://github.com/nostr-protocol/nips/blob/master/04.md), using the user's private and service provider's public key for the shared secret
73
74```json
75[
76 [ "i", "what is the capital of France? ", "text" ],
77 [ "param", "model", "LLaMA-2" ],
78 [ "param", "max_tokens", "512" ],
79 [ "param", "temperature", "0.5" ],
80 [ "param", "top-k", "50" ],
81 [ "param", "top-p", "0.7" ],
82 [ "param", "frequency_penalty", "1" ]
83
84]
85
86```
87
88This param data will be encrypted and added to the `content` field and `p` tag should be present
89
90```
91"content": "BE2Y4xvS6HIY7TozIgbEl3sAHkdZoXyLRRkZv4fLPh3R7LtviLKAJM5qpkC7D6VtMbgIt4iNcMpLtpo...",
92 "tags": [
93 ["p", "04f74530a6ede6b24731b976b8e78fb449ea61f40ff10e3d869a3030c4edc91f"],
94 ["encrypted"]
95 ]
96
97
98```
99
100
70## Job result (`kind:6000-6999`) 101## Job result (`kind:6000-6999`)
71 102
72Service providers publish job results, providing the output of the job result. They should tag the original job request event id as well as the customer's pubkey. 103Service providers publish job results, providing the output of the job result. They should tag the original job request event id as well as the customer's pubkey.
@@ -90,6 +121,27 @@ Service providers publish job results, providing the output of the job result. T
90* `amount`: millisats that the Service Provider is requesting to be paid. An optional third value can be a bolt11 invoice. 121* `amount`: millisats that the Service Provider is requesting to be paid. An optional third value can be a bolt11 invoice.
91* `i`: The original input(s) specified in the request. 122* `i`: The original input(s) specified in the request.
92 123
124## Encrypted Output
125
126If the request has encrypted params, then output should be encrypted and placed in `content` field. If the output is encrypted, then avoid including `i` tag with input-data as clear text.
127Add a tag encrypted to mark the output content as `encrypted`
128```json
129{
130 "pubkey": "<service-provider pubkey>",
131 "content": "<encrypted payload>",
132 "kind": 6xxx,
133 "tags": [
134 [ "request", "<job-request>" ],
135 [ "e", "<job-request-id>", "<relay-hint>" ],
136 [ "p", "<customer's-pubkey>" ],
137 [ "amount", "requested-payment-amount", "<optional-bolt11>" ],
138 ["encrypted"]
139
140 ]
141}
142```
143
144
93## Job feedback 145## Job feedback
94Service providers can give feedback about a job back to the customer. 146Service providers can give feedback about a job back to the customer.
95 147
@@ -110,6 +162,8 @@ Service providers can give feedback about a job back to the customer.
110* `amount` tag: as defined in the [Job Result](#job-result) section. 162* `amount` tag: as defined in the [Job Result](#job-result) section.
111* `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Appendix 1](#appendix-1-job-feedback-status) defines status. Extra human-readable information can be added as an extra argument. 163* `status` tag: Service Providers SHOULD indicate what this feedback status refers to. [Appendix 1](#appendix-1-job-feedback-status) defines status. Extra human-readable information can be added as an extra argument.
112 164
165* NOTE: If the input params requires input to be encryped, then `content` field will have encrypted payload with `p` tag as key.
166
113### Job feedback status 167### Job feedback status
114 168
115| status | description | 169| status | description |