NIP-26: adding section documenting valid fields and operators for conditions string (#194)

This commit is contained in:
Zack Wynne 2023-01-27 03:11:27 -08:00 committed by GitHub
parent 5901fe0b87
commit 95fa5a4a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

20
26.md
View File

@ -31,6 +31,26 @@ The **delegation token** should be a 64-byte Schnorr signature of the sha256 has
nostr:delegation:<pubkey of publisher (delegatee)>:<conditions query string> nostr:delegation:<pubkey of publisher (delegatee)>:<conditions query string>
``` ```
##### Conditions Query String
The following fields and operators are supported in the above query string:
*Fields*:
1. `kind`
- *Operators*:
- `=${KIND_NUMBER}` - delegator may only sign events of this kind
2. `created_at`
- *Operators*:
- `<${TIMESTAMP}` - delegator may only sign events created ***before*** the specified timestamp
- `>${TIMESTAMP}` - delegator may only sign events created ***after*** the specified timestamp
In order to create a single condition, you must use a supported field and operator. Multiple conditions can be used in a single query string, including on the same field. Conditions must be combined with `&`.
For example, the following condition strings are valid:
- `kind=1&created_at<1675721813`
- `kind=0&kind=1&created_at>1675721813`
- `kind=1&created_at>1674777689&created_at<1675721813`
#### Example #### Example