You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/routing/http-routing-v1.md
+34-13
Original file line number
Diff line number
Diff line change
@@ -136,7 +136,7 @@ server SHOULD be no more than 100 `Providers` per `application/json` response.
136
136
}
137
137
```
138
138
139
-
-`ProvideResults` is a list of results in the same order as the `Providers` in the request, and the schema of each object is determined by the `Protocol` of the corresponding write object
139
+
-`ProvideResults` is a list of results in the same order as the `Providers` in the request, and the schema of each object is determined by the `Schema` of the corresponding write object
140
140
- Returned list MAY contain entry-specific information such as server-specific TTL, per-entry error message, etc. Fields which are not relevant, can be omitted.
141
141
- In error scenarios, a client can check for presence of non-empty `Error` field (top level, or per `ProvideResults` entry) to learn about the reason why POST failed.
142
142
- The work for processing each provider record should be idempotent so that it can be retried without excessive cost in the case of full or partial failure of the request
@@ -209,13 +209,13 @@ Server SHOULD accept writes represented with [Announcement Schema](#announcement
209
209
210
210
```json
211
211
{
212
-
"ProvideResults": [
212
+
"PeersResults": [
213
213
{ ... }
214
214
]
215
215
}
216
216
```
217
217
218
-
-`ProvideResults` is a list of results in the same order as the `Providers` in the request, and the schema of each object is determined by the `Protocol` of the corresponding write object
218
+
-`PeersResults` is a list of results in the same order as the `Peers` in the request, and the schema of each object is determined by the `Schema` of the corresponding write object
219
219
- Returned list MAY contain entry-specific information such as server-specific TTL, per-entry error message, etc. Fields which are not relevant, can be omitted.
220
220
- In error scenarios, a client can check for presence of non-empty `Error` field (top level, or per `ProvideResults` entry) to learn about the reason why POST failed.
221
221
- The work for processing each provider record should be idempotent so that it can be retried without excessive cost in the case of full or partial failure of the request
@@ -392,36 +392,57 @@ The `announcement` schema can be used in `POST` operations to announce content p
392
392
}
393
393
```
394
394
395
-
-`Schema`: tells the server to interpret the JSON object as announce provider
395
+
#### Announcement Payload
396
+
396
397
-`Payload`: is a map object with a subset of the below fields.
397
398
-`CID` is a string with multibase-encoded CID being provided (`/routing/v1/providers` only).
398
399
- This field is not present when used for `POST /routing/v1/peers`
399
400
-`Scope` (optional) is a string hint that provides semantic meaning about CID (`/routing/v1/providers` only):
400
401
-`block` announces only the individual block (this is the implicit default if `Scope` field is not present).
401
402
-`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).
402
403
-`recursive` announces entire DAGs behind the CIDs (e.g.: entire DAG-CBOR DAG, or everything in UnixFS directory, including all files in all subdirectories).
404
+
403
405
-`Timestamp` is the current time, formatted as an ASCII string that follows notation from [rfc3339](https://specs.ipfs.tech/ipns/ipns-record/#ref-rfc3339).
406
+
404
407
-`TTL` is caching and expiration hint informing the server how long to keep the record available, specified as integer in milliseconds.
405
408
- If this value is unknown, the caller may skip this field or set it to 0. The server's default will be used.
409
+
406
410
-`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.
411
+
- ED25519 and other small public keys MUST be inlined inside of the `ID` field
412
+
with the identity multihash type.
413
+
- Key types that exceed 42 bytes (e.g. RSA) SHOULD NOT be inlined, the `ID`
414
+
field should only include the multihash of the key. The key itself SHOULD be
415
+
obtained out-of-band (e.g. by fetching the block via IPFS) and cached to
416
+
reduce the size of the signed `Payload`.
417
+
418
+
If support for big keys is needed in
419
+
the future, this spec can be updated to allow the client to provide the key
420
+
and key type out-of-band by adding optional `PublicKey` fields, and if the
421
+
Peer ID is a CID, then the server can verify the public key's authenticity
422
+
against the CID, and then proceed with the rest of the verification scheme.
423
+
407
424
-`Addrs` (optional) is an a list of string-encoded multiaddrs without `/p2p/peerID` suffix.
425
+
408
426
-`Protocols` (optional) is a list of strings with protocols supported by `ID` and/or `Addrs`, if known upfront.
427
+
409
428
-`Metadata` (optional) is a string with multibase-encoded binary metadata that should be passed as-is
429
+
430
+
#### Announcement Signature
431
+
410
432
-`Signature` is a string with multibase-encoded binary signature that provides integrity and authenticity of the `Payload` field.
433
+
411
434
- Signature is created by following below steps:
412
-
1. Convert `Payload` to deterministic, ordered [DAG-JSON](https://ipld.io/specs/codecs/dag-json/spec/) map notation
413
-
2. Prefix the DAG-JSON bytes with ASCII string `POST /routing/v1 announcement:`
435
+
1. Convert `Payload` JSON to deterministic, ordered [DAG-CBOR](https://ipld.io/specs/codecs/dag-cbor/spec/) map notation
436
+
- Specification intention here is to use similar signature normalization as with DAG-CBOR `Data` field in IPNS Records, allowing for partial code and dependency reuse.
437
+
2. Prefix the DAG-CBOR bytes with ASCII string `routing-record:`
414
438
3. Sign the bytes with the private key of the Peer ID specified in the `Payload.ID`.
415
439
- Signing details for specific key types should follow [libp2p/peerid specs](https://github.com/libp2p/specs/blob/master/peer-ids/peer-ids.md#key-types), unless stated otherwise.
440
+
416
441
- Client SHOULD sign every announcement.
417
442
- Servers SHOULD verify signature before accepting a record, unless running in a trusted environment.
418
-
- ED25519 and other small public keys MUST be inlined inside of the `ID` field with the identity multihash type.
419
-
- 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.
420
-
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
-
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
443
+
- A [400 Bad Request](https://httpwg.org/specs/rfc9110.html#status.400) response code SHOULD be returned if (in order):
444
+
-`Payload` serialized to DAG-CBOR is bigger than 2MiB
0 commit comments