Skip to content

Commit 3eb75a7

Browse files
committed
fix: doublehash example, editorials
1 parent fb7304a commit 3eb75a7

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

src/compact-denylist-format.md

+26-25
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ We include *negative block items* as well, with the idea of enabling denylists
5858
that are append-only. One of the main operational constraints we have seen is
5959
that a single item can cause a full denylist to be re-read, re-parsed and
6060
ultimately need a full restart of the application. We want to avoid that by
61-
providing operators and implementors with the possiblity of just watching
61+
providing operators and implementors with the possibility of just watching
6262
denylists for new items without then need to restart anything while new items
63-
are added. This also gives the possiblity of storing an offset and seeking
63+
are added. This also gives the possibility of storing an offset and seeking
6464
directly to it after application restarts. *negative block items* can also be
6565
used to make exceptions to otherwise more general rules.
6666

6767
Another aspect that we have maintained in the back of our minds is the
68-
possiblity of sharing lists using IPFS. The append-mostly aspect also plays a
68+
possibility of sharing lists using IPFS. The append-mostly aspect also plays a
6969
role here, for lists can be chunked and DAG-ified and only the last chunk will
7070
change as the file grows. This makes our lists immediately friendly to
7171
content-addressing and efficient transmission over IPFS. However, the
@@ -75,16 +75,16 @@ this spec.
7575
Beyond all of that, we put emphasis in making our format easily editable by
7676
users and facilitating integrations using scripts and with other applications
7777
(unrelated to the implementation of the parsing/blocking inside IPFS). We
78-
conciously avoid JSON and other machine formats and opt for text and for
78+
consciously avoid JSON and other machine formats and opt for text and for
7979
space-delimited items in a grep/sed/cut-friendly way. For example, we expect
80-
that the following should just work accross implementations for adding and
80+
that the following should just work across implementations for adding and
8181
blocking something new:
8282

8383
```
8484
echo /ipfs/QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768 >> ~/.config/ipfs/custom.deny
8585
```
8686

87-
We conciously avoid defining any other API other than expecting
87+
We consciously avoid defining any other API other than expecting
8888
implementations to honor blocking what is on the denylist and act accordingly
8989
when it is updated. CLI commands or API endpoint to modify list items etc. are
9090
outside the scope of this spec. Implementations how much information to
@@ -138,7 +138,7 @@ hints:
138138
# Block IPNS key - blocks wrapped multihash.
139139
/ipns/k51qzi5uqu5dhmzyv3zac033i7rl9hkgczxyl81lwoukda2htteop7d3x0y1mf
140140

141-
# Double-hash CID block
141+
# Double-hash CID block using sha2-256 hashing
142142
# base58btc-sha256-multihash(QmVTF1yEejXd9iMgoRTFDxBv7HAz9kuZcQNBzHrceuK9HR)
143143
# Blocks bafybeidjwik6im54nrpfg7osdvmx7zojl5oaxqel5cmsz46iuelwf5acja
144144
# and QmVTF1yEejXd9iMgoRTFDxBv7HAz9kuZcQNBzHrceuK9HR etc. by multihash
@@ -150,7 +150,7 @@ hints:
150150
# /ipfs/bafyb4ieqht3b2rssdmc7sjv2cy2gfdilxkfh7623nvndziyqnawkmo266a/path
151151
# /ipfs/f01701e20903cf61d46521b05f926ba1634628d0bba8a7ffb5b6d5a3ca310682ca63b5ef0/path etc...
152152
# But not /path2
153-
//QmbK7LDv5NNBvYQzNfm2eED17SNLt1yNMapcUhSuNLgkqz
153+
//gW813G35CnLsy7gRYYHuf63hrz71U1xoLFDVeV7actx6oX
154154

155155
# Legacy CID double-hash block
156156
# sha256(bafybeiefwqslmf6zyyrxodaxx4vwqircuxpza5ri45ws3y5a62ypxti42e/)
@@ -184,7 +184,6 @@ Comment lines start with `#`. Empty lines are allowed.
184184

185185
Lines should not be longer than 2MiB including the "\n" delimiter.
186186

187-
188187
### Header
189188

190189
The list header is an optional YAML block.
@@ -273,7 +272,7 @@ Blocking layer recommendation: PathResolver.
273272
#### `/ipfs/CID/PATH*`
274273

275274
IPFS-Path-Prefix-Rule: Blocks any multihash-path combination starting with the
276-
the given path prefix. `/*` includes the empty path. Thus `/ipfs/CID/*`
275+
given path prefix. `/*` includes the empty path. Thus, `/ipfs/CID/*`
277276
blocks the CID itself, and any paths. Examples:
278277

279278
- `/ipfs/CID/*` : blocks CID (by multihash) and any path BEFORE resolving.
@@ -301,7 +300,7 @@ When the rule `/ipfs/CID` exists and BlockService-level blocking
301300
IPNS-rule: Blocks the given IPNS name before resolving. It does not block the CID that it
302301
resolves to.
303302

304-
If the IPNS `NAME` is a domain name, it is blocked directy.
303+
If the IPNS `NAME` is a domain name, it is blocked directly.
305304

306305
If the IPNS `NAME` is a CIDv1 (libp2p-key) or b58-encoded-multihash (CIDV0),
307306
then the blocking affects the underlying Multihash.
@@ -380,8 +379,8 @@ In order to check for a matching rule, the PathResolver working with `/ipfs/CID/
380379
- (legacy) Convert the CID to CIDv1Base32 and hash `CIDV1BASE32/PATH` with the
381380
hashing functions used in the denylist. Match against declared double-hashes.
382381
An empty path means that the value to hash is `CIDV1BASE32/` (with the
383-
trailing slash). This is the legacy hashing so the hashing function is
384-
usually sha256 and the matched rules are legacy badbits anchor rules.
382+
trailing slash). This is the legacy hashing, the function is
383+
sha256 and the matched rules are legacy badbits anchor rules.
385384

386385
The NameSystem (used only for `/ipns/*`) should:
387386

@@ -399,24 +398,27 @@ The "modern" double-hashed items (b58-encoded-multihash) can be created with
399398
existing CLI tools like
400399
[Kubo](https://docs.ipfs.tech/how-to/command-line-quick-start/):
401400

401+
Convert any CID to its multihash with:
402+
402403
```
403-
$ printf "QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768/my/path" | ipfs add --raw-leaves --only-hash --quiet | ipfs cid format -f '%M' -b base58btc
404-
QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8
404+
$ ipfs cid format -f '%M' -b base58btc bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze
405+
QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768
405406
```
406407

407-
The rule `//QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8` will block
408-
`/ipfs/bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze/my/path`,
409-
with `QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8` being the base58-encoded
410-
multihash contained in
411-
`bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze`.
412-
413-
We can convert any CID to its multihash with:
408+
Then, create a second multihash to be used in `//DOUBLE-HASH` rule that will be
409+
blocking specific content path under the extracted multihash:
414410

415411
```
416-
$ ipfs cid format -f '%M' -b base58btc bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze
417-
QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768
412+
$ printf "QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768/my/path" | ipfs block put --mhtype sha2-256 | ipfs cid format -f '%M' -b base58btc
413+
QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8
418414
```
419415

416+
The double-hash rule `//QmSju6XPmYLG611rmK7rEeCMFVuL6EHpqyvmEU6oGx3GR8` will block
417+
`/ipfs/bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze/my/path`.
418+
419+
The `QmecDgNqCRirkc3Cjz9eoRBNwXGckJ9WvTdmY16HP88768` is the multihash contained
420+
in `bafybeihrw75yfhdx5qsqgesdnxejtjybscwuclpusvxkuttep6h7pkgmze`.
421+
420422
:::
421423

422424
#### Negated rules
@@ -517,7 +519,6 @@ detail.
517519

518520
In particular, a reference [Blocker implementation validator](https://github.com/ipfs-shipyard/nopfs/tree/master/tester) is provided in Go, and can be adapted to other languages if needed.
519521

520-
521522
### Implementations
522523

523524
- [NOpfs](https://github.com/ipfs-shipyard/nopfs): An implementation of IPIP-383 which add supports for content blocking to the go-ipfs stack and particularly to [Kubo](https://github.com/ipfs/kubo).

0 commit comments

Comments
 (0)