upleb.uk

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

summaryrefslogtreecommitdiff
path: root/26.md
diff options
context:
space:
mode:
authorMark Harding <mark@minds.com>2022-08-04 09:33:38 +0100
committerMark Harding <mark@minds.com>2022-08-04 09:33:38 +0100
commite13f6d39b954764ae4d8a4478f3e9b62fe74e5ab (patch)
tree779ee07a23c6878077fa24693297052cf578b4da /26.md
parent7fe572ec5a7321726c9469f70a93bb278be8d774 (diff)
First draft of Delegated Event Signing
Diffstat (limited to '26.md')
-rw-r--r--26.md80
1 files changed, 80 insertions, 0 deletions
diff --git a/26.md b/26.md
new file mode 100644
index 0000000..17255e2
--- /dev/null
+++ b/26.md
@@ -0,0 +1,80 @@
1NIP: 26
2=======
3
4Delegated Event Signing
5-----
6
7`draft` `mandatory` `author:markharding` `author:minds`
8
9This NIP defines how events should be verified and signed to support generating events on behalf of someone else. It should be possible to sign Nostr events from other keypairs.
10
11Another application of this proposal is to abstract away the use of the 'root' keypairs when interacting with clients. For example, a user could generate new keypairs for each client they wish to use and authorize those keypairs to generate events on behalf of their root pubkey, where the root keypair is stored in cold storage.
12
13#### Introducing the 's' tag
14
15This NIP introduces a new tag: `s` which is formatted as follows:
16
17```json
18[
19 "s",
20 <signed pairing payload (base64 encoded)>,
21 <signed pairing signature (64-bytes shnnorr signature of the sha256 hash of the signed pairing payload>
22]
23```
24
25##### Signed Pairing Payload
26
27The Signed Pairing Payload should be a `base64` encoded JSON object as follows:
28
29```json
30{
31 "signerkey": <32-bytes hex-encoded public key of who is authorized to sign>,
32 "created_at": <unix timestamp of issued time>,
33 "expires_at": <optional, if present unix timestamp of invalidation time>
34}
35```
36
37For example, the Signed Pairing Payload `eyJzaWduZXJrZXkiOiI2MjkwM2IxZmY0MTU1OWRhZjllZTk4ZWYxYWU2N2NjNTJmMzAxYmI1Y2UyNmQxNGJhYmEzMDUyZjY0OWMzZjQ5IiwiY3JlYXRlZF9hdCI6MTY1OTQ0NjMxNX0=` consists of the payload:
38
39```json
40{
41 "signerkey": "62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49",
42 "created_at": 1659446315
43}
44```
45
46##### Signed Pairing Signature
47
48The Signed Pairing Signature is a schnorr signature of the sha256 hash of the Signed Pairing Payload. For example `2ed3e4b8470ce37b7e1946441a323d1d71c8a846fe49787ec406e14a44632cc96e48cabccc4a526eedd51aca33bf2a5cf7fb85462d23ad6d4de29c8b91abc41b` is a signature of the payload mentioned above.
49
50#### Modifying event verification
51
52When the `s` tag is provided, events **must** be signed and verified by the respective private key of the `signerkey`. Clients/relays **should** confirm that no revocation have been created with a greater `created_at` value.
53
54Clients **must** verify the token is valid. The token **may** include the `expires_at` field if it wishes the delegated signing to be temporary (ie. sign events for 2 hours, 7 days, etc).
55
56> TODO: How to revoke. This could be a future NIP.
57
58
59#### Example
60
61Below is an example of an event published by `62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49`, on behalf of `86f0689bd48dcd19c67a19d994f938ee34f251d8c39976290955ff585f2db42e`.
62
63```json
64{
65 "id":"23bf557814cd294d77a52e43d16903862c231857319f950ba40474fde1b9c393",
66 "pubkey":"86f0689bd48dcd19c67a19d994f938ee34f251d8c39976290955ff585f2db42e",
67 "created_at":1652969505,
68 "kind":1,
69 "tags":[
70 [
71 "s",
72 "eyJzaWduZXJrZXkiOiI2MjkwM2IxZmY0MTU1OWRhZjllZTk4ZWYxYWU2N2NjNTJmMzAxYmI1Y2UyNmQxNGJhYmEzMDUyZjY0OWMzZjQ5IiwiY3JlYXRlZF9hdCI6MTY1OTQ0NjMxNX0=",
73 "2ed3e4b8470ce37b7e1946441a323d1d71c8a846fe49787ec406e14a44632cc96e48cabccc4a526eedd51aca33bf2a5cf7fb85462d23ad6d4de29c8b91abc41b"
74 ]
75 ],
76 "content":"Hello Nostr. This is Minds calling.",
77 "sig":"30f0ebb907bd23416dd32a14b905abeb1db3fde97c74a151c51e5503e91ed25d58fbdcd95910ea4c11dc49d3fca8c616c0e7489e0f8da37b0938a7ce393285e7"
78}
79```
80