Skip to content

Commit da12e11

Browse files
committed
ipip-378: clarify string values
#378 (comment)
1 parent cf83c02 commit da12e11

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/routing/http-routing-v1.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ server SHOULD be no more than 100 `Providers` per `application/json` response.
119119

120120
:::
121121

122-
#### `POST` Response codes
122+
#### `POST` Response Status Codes
123123

124124
- `200` (OK): the server processed the full list of provider records (possibly unsuccessfully, depending on the semantics of the particular records)
125125
- `400` (Bad Request): the server deems the request to be invalid and cannot process it
@@ -198,7 +198,7 @@ Each object in the `Peers` list is a *write peer record* entry.
198198

199199
Server SHOULD accept writes represented with [Announcement Schema](#announcement-schema).
200200

201-
#### `POST` Response codes
201+
#### `POST` Response Status Codes
202202

203203
- `200` (OK): the server processed the full list of provider records (possibly unsuccessfully, depending on the semantics of the particular records)
204204
- `400` (Bad Request): the server deems the request to be invalid and cannot process it
@@ -393,20 +393,20 @@ The `announcement` schema can be used in `POST` operations to announce content p
393393
```
394394

395395
- `Schema`: tells the server to interpret the JSON object as announce provider
396-
- `Payload`: is a DAG-JSON-compatible object with a subset of the below fields
397-
- `CID` is the CID being provided (`/routing/v1/providers` only).
398-
- This field is not presend when used for `POST /routing/v1/peers`
399-
- `Scope` is an optional hint that provides semantic meaning about CID (`/routing/v1/providers` only):
396+
- `Payload`: is a map object with a subset of the below fields.
397+
- `CID` is a string with multibase-encoded CID being provided (`/routing/v1/providers` only).
398+
- This field is not present when used for `POST /routing/v1/peers`
399+
- `Scope` (optional) is a string hint that provides semantic meaning about CID (`/routing/v1/providers` only):
400400
- `block` announces only the individual block (this is the implicit default if `Scope` field is not present).
401401
- `entity` announces CIDs required for enumerating entity behind the CID (e.g.: all blocks for UnixFS file or a minimum set of blocks to enumerate contents of HAMT-sharded UnixFS directory, only top level of directory tree, etc).
402402
- `recursive` announces entire DAGs behind the CIDs (e.g.: entire DAG-CBOR DAG, or everything in UnixFS directory, including all files in all subdirectories).
403403
- `Timestamp` is the current time, formatted as an ASCII string that follows notation from [rfc3339](https://specs.ipfs.tech/ipns/ipns-record/#ref-rfc3339).
404-
- `TTL` is caching and expiration hint informing the server how long to keep the record available, specified in milliseconds.
405-
- If this value is unknown, the caller may skip this field, or use a value of 0. The server's default will be used.
406-
- `ID` is Peer ID of the node that provides the content and also indicates the `libp2p-key` that SHOULD be used for verifying `Signature` field.
407-
- `Addrs` is an a list of string-encoded multiaddrs without `/p2p/peerID` suffix.
408-
- `Protocols` is a list of protocols supported by `ID` and/or `Addrs`, if known upfront.
409-
- `Metadata` is a string with multibase-encoded binary metadata that should be passed as-is
404+
- `TTL` is caching and expiration hint informing the server how long to keep the record available, specified as integer in milliseconds.
405+
- If this value is unknown, the caller may skip this field or set it to 0. The server's default will be used.
406+
- `ID` is a multibase-encoded Peer ID of the node that provides the content and also indicates the `libp2p-key` that SHOULD be used for verifying `Signature` field.
407+
- `Addrs` (optional) is an a list of string-encoded multiaddrs without `/p2p/peerID` suffix.
408+
- `Protocols` (optional) is a list of strings with protocols supported by `ID` and/or `Addrs`, if known upfront.
409+
- `Metadata` (optional) is a string with multibase-encoded binary metadata that should be passed as-is
410410
- `Signature` is a string with multibase-encoded binary signature that provides integrity and authenticity of the `Payload` field.
411411
- Signature is created by following below steps:
412412
1. Convert `Payload` to deterministic, ordered [DAG-JSON](https://ipld.io/specs/codecs/dag-json/spec/) map notation
@@ -418,9 +418,10 @@ The `announcement` schema can be used in `POST` operations to announce content p
418418
- ED25519 and other small public keys MUST be inlined inside of the `ID` field with the identity multihash type.
419419
- Key types that exceed 42 bytes (e.g. RSA) SHOULD NOT be inlined, the `ID` field should only include the multihash of the key. The key itself SHOULD be obtained out-of-band (e.g. by fetching the block via IPFS) and cached.
420420
If support for big keys is needed in the future, this spec can be updated to allow the client to provide the key and key type out-of-band by adding optional `PublicKey` fields, and if the Peer ID is a CID, then the server can verify the public key's authenticity against the CID, and then proceed with the rest of the verification scheme.
421-
- A [400 Bad Request](https://httpwg.org/specs/rfc9110.html#status.400) response code SHOULD be returned if the `Signature` check fails.
422421

423-
Server SHOULD return HTTP 400 Bad Request when announcement `Payload` serizalized to DAG-CBOR is bigger than 2MiB.
422+
A [400 Bad Request](https://httpwg.org/specs/rfc9110.html#status.400) response code SHOULD be returned if either
423+
- `Signature` is not valid
424+
- `Payload` serialized to DAG-CBOR is bigger than 2MiB
424425

425426
#### Use in POST responses
426427

0 commit comments

Comments
 (0)