diff options
Diffstat (limited to '26.md')
| -rw-r--r-- | 26.md | 46 |
1 files changed, 32 insertions, 14 deletions
| @@ -25,41 +25,59 @@ This NIP introduces a new tag: `delegation` which is formatted as follows: | |||
| 25 | 25 | ||
| 26 | ##### Delegation Token | 26 | ##### Delegation Token |
| 27 | 27 | ||
| 28 | The **delegation token** should be a 64-bytes schnorr signature of the sha256 hash of the following string: | 28 | The **delegation token** should be a 64-byte Schnorr signature of the sha256 hash of the following string: |
| 29 | 29 | ||
| 30 | ``` | 30 | ``` |
| 31 | nostr:delegation:<pubkey of publisher (delegatee)>:<conditions query string> | 31 | nostr:delegation:<pubkey of publisher (delegatee)>:<conditions query string> |
| 32 | ``` | 32 | ``` |
| 33 | 33 | ||
| 34 | For example, the token `c33c88ba78ec3c760e49db591ac5f7b129e3887c8af7729795e85a0588007e5ac89b46549232d8f918eefd73e726cb450135314bfda419c030d0b6affe401ec1` is signed by `86f0689bd48dcd19c67a19d994f938ee34f251d8c39976290955ff585f2db42e` and consists of: | ||
| 35 | 34 | ||
| 36 | ```json | 35 | #### Example |
| 37 | nostr:delegation:62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49:kind=1&created_at>1640995200 | 36 | |
| 38 | ``` | 37 | ``` |
| 38 | # Delegator: | ||
| 39 | privkey: ee35e8bb71131c02c1d7e73231daa48e9953d329a4b701f7133c8f46dd21139c | ||
| 40 | pubkey: 8e0d3d3eb2881ec137a11debe736a9086715a8c8beeeda615780064d68bc25dd | ||
| 39 | 41 | ||
| 40 | #### Example | 42 | # Delegatee: |
| 43 | privkey: 777e4f60b4aa87937e13acc84f7abcc3c93cc035cb4c1e9f7a9086dd78fffce1 | ||
| 44 | pubkey: 477318cfb5427b9cfc66a9fa376150c1ddbc62115ae27cef72417eb959691396 | ||
| 45 | ``` | ||
| 46 | |||
| 47 | Delegation string to grant note publishing authorization to the delegatee (477318cf) for the next 30 days. | ||
| 48 | ```json | ||
| 49 | nostr:delegation:477318cfb5427b9cfc66a9fa376150c1ddbc62115ae27cef72417eb959691396:kind=1&created_at<1675721885 | ||
| 50 | ``` | ||
| 41 | 51 | ||
| 42 | Below is an example of an event published by `62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49`, on behalf of `86f0689bd48dcd19c67a19d994f938ee34f251d8c39976290955ff585f2db42e`. | 52 | The delegator (8e0d3d3e) then signs the above delegation string, the result of which is the delegation token: |
| 53 | ``` | ||
| 54 | cbc49c65fe04a3181d72fb5a9f1c627e329d5f45d300a2dfed1c3e788b7834dad48a6d27d8e244af39c77381334ede97d4fd15abe80f35fda695fd9bd732aa1e | ||
| 55 | ``` | ||
| 43 | 56 | ||
| 57 | The delegatee (477318cf) can now construct an event on behalf of the delegator (8e0d3d3e). The delegatee then signs the event with its own private key and publishes. | ||
| 44 | ```json | 58 | ```json |
| 45 | { | 59 | { |
| 46 | "id": "a080fd288b60ac2225ff2e2d815291bd730911e583e177302cc949a15dc2b2dc", | 60 | "id": "ac4c71e69c39b1bd605de812543ebfaf81d5af365354f061d48981fb61e00b8a", |
| 47 | "pubkey": "62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49", | 61 | "pubkey": "477318cfb5427b9cfc66a9fa376150c1ddbc62115ae27cef72417eb959691396", |
| 48 | "created_at": 1660896109, | 62 | "created_at": 1673129661, |
| 49 | "kind": 1, | 63 | "kind": 1, |
| 50 | "tags": [ | 64 | "tags": [ |
| 51 | [ | 65 | [ |
| 52 | "delegation", | 66 | "delegation", |
| 53 | "86f0689bd48dcd19c67a19d994f938ee34f251d8c39976290955ff585f2db42e", | 67 | "8e0d3d3eb2881ec137a11debe736a9086715a8c8beeeda615780064d68bc25dd", |
| 54 | "kind=1&created_at>1640995200", | 68 | "kind=1&created_at<1675721813", |
| 55 | "c33c88ba78ec3c760e49db591ac5f7b129e3887c8af7729795e85a0588007e5ac89b46549232d8f918eefd73e726cb450135314bfda419c030d0b6affe401ec1" | 69 | "cbc49c65fe04a3181d72fb5a9f1c627e329d5f45d300a2dfed1c3e788b7834dad48a6d27d8e244af39c77381334ede97d4fd15abe80f35fda695fd9bd732aa1e" |
| 56 | ] | 70 | ] |
| 57 | ], | 71 | ], |
| 58 | "content": "Hello world", | 72 | "content": "Hello, world!", |
| 59 | "sig": "cd4a3cd20dc61dcbc98324de561a07fd23b3d9702115920c0814b5fb822cc5b7c5bcdaf3fa326d24ed50c5b9c8214d66c75bae34e3a84c25e4d122afccb66eb6" | 73 | "sig": "55ed9a78d6449b8c189b6dbc34bc4bcd34dcc79e6da6c9078268fe3d7c0cbe62b1b907ffb76ba591e83895b1329bf2e6e16f3b0cd5827272e420d419c6f0f0b5" |
| 60 | } | 74 | } |
| 61 | ``` | 75 | ``` |
| 62 | 76 | ||
| 77 | The event should be considered a valid delegation if the conditions are satisfied (`kind=1` and `created_at<1675721813` in this example) and, upon validation of the delegation token, are found to be unchanged from the conditions in the original delegation string. | ||
| 78 | |||
| 79 | Clients should display the delegated note as if it was published directly by the delegator (8e0d3d3e). | ||
| 80 | |||
| 63 | 81 | ||
| 64 | #### Relay & Client Querying Support | 82 | #### Relay & Client Querying Support |
| 65 | 83 | ||