Merge branch 'read-permission' of https://github.com/vitorpamplona/nips into read-permission

This commit is contained in:
Vitor Pamplona 2024-09-13 13:10:53 -04:00
commit 3c7429b665

6
76.md
View File

@ -8,7 +8,7 @@ Relay Read Permissions
Tag names `rp` (read permission) and `prp` (probabilistic read permission) define which keys are authorized to download an event from the relay. Tag names `rp` (read permission) and `prp` (probabilistic read permission) define which keys are authorized to download an event from the relay.
Events that include an `rp` or `prp` require AUTH to be downloaded. Events with an `rp` or `prp` require AUTH to be downloaded.
## Read Permission ## Read Permission
@ -31,7 +31,7 @@ Probabilistic permissions use bloom filters that include a set of pubkeys. They
["prp", "<BitArray Size>:<Rounds>:<base64>"] ["prp", "<BitArray Size>:<Rounds>:<base64>"]
``` ```
Bloom filters MUST use `SHA-256` functions of the key + iterating index as the psedocode below: Bloom filters MUST use `SHA-256` functions of the key + iterating index as the pseudocode below:
```js ```js
class BloomFilter(size: Int, rounds: Int, buffer: ByteArray) { class BloomFilter(size: Int, rounds: Int, buffer: ByteArray) {
@ -74,7 +74,7 @@ Relays MUST check if the authed user is in the filter before returning the event
### Test cases ### Test cases
The filter below has 100 bits, with 10 rounds or hashes that should be able to match 10,000,000 keys without a single false positive. The filter below has 100 bits, with 10 rounds of hashes that should be able to match 10,000,000 keys without a single false positive.
```json ```json
["prp", "100:10:QGKCgBEBAAhIAApO"] ["prp", "100:10:QGKCgBEBAAhIAApO"]