diff options
| -rw-r--r-- | 26.md | 26 |
1 files changed, 20 insertions, 6 deletions
| @@ -38,20 +38,34 @@ The following fields and operators are supported in the above query string: | |||
| 38 | *Fields*: | 38 | *Fields*: |
| 39 | 1. `kind` | 39 | 1. `kind` |
| 40 | - *Operators*: | 40 | - *Operators*: |
| 41 | - `=${KIND_NUMBER}` - delegatee may only sign events of this kind | 41 | - `=${KIND_NUMBERS}` - delegatee may only sign events of listed kind(s) (comma-separated) |
| 42 | 2. `created_at` | 42 | 2. `created_at` |
| 43 | - *Operators*: | 43 | - *Operators*: |
| 44 | - `<${TIMESTAMP}` - delegatee may only sign events created ***before*** the specified timestamp | 44 | - `<${TIMESTAMP}` - delegatee may only sign events whose `created_at` is ***before*** the specified timestamp |
| 45 | - `>${TIMESTAMP}` - delegatee may only sign events created ***after*** the specified timestamp | 45 | - `>${TIMESTAMP}` - delegatee may only sign events whose `created_at` is ***after*** the specified timestamp |
| 46 | 46 | ||
| 47 | 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 `&`. | 47 | Multiple conditions can be used in a single query string, including on the same field. Conditions must be combined with `&`. |
| 48 | 48 | ||
| 49 | For example, the following condition strings are valid: | 49 | Multiple conditions should be treated as `AND` requirements; all conditions must be true for the delegated event to be valid. |
| 50 | |||
| 51 | Multiple comma-separated `kind` values should be interpreted as: | ||
| 52 | ``` | ||
| 53 | # kind=0,1,3000 | ||
| 54 | ... AND (kind == 0 OR kind == 1 OR kind == 3000) AND ... | ||
| 55 | ``` | ||
| 50 | 56 | ||
| 57 | For example, the following condition strings are valid: | ||
| 58 | - `kind=1` | ||
| 59 | - `created_at<1675721813` | ||
| 51 | - `kind=1&created_at<1675721813` | 60 | - `kind=1&created_at<1675721813` |
| 52 | - `kind=0&kind=1&created_at>1675721813` | 61 | - `kind=0,1,3000&created_at>1675721813` |
| 53 | - `kind=1&created_at>1674777689&created_at<1675721813` | 62 | - `kind=1&created_at>1674777689&created_at<1675721813` |
| 54 | 63 | ||
| 64 | However, specifying multiple _separate_ `kind` conditions is impossible to satisfy: | ||
| 65 | - `kind=1&kind=5` | ||
| 66 | |||
| 67 | There is no way for an event to satisfy the `AND` requirement of being both `kind`s simultaneously. | ||
| 68 | |||
| 55 | For the vast majority of use-cases, it is advisable that query strings should include a `created_at` ***after*** condition reflecting the current time, to prevent the delegatee from publishing historic notes on the delegator's behalf. | 69 | For the vast majority of use-cases, it is advisable that query strings should include a `created_at` ***after*** condition reflecting the current time, to prevent the delegatee from publishing historic notes on the delegator's behalf. |
| 56 | 70 | ||
| 57 | #### Example | 71 | #### Example |