Skip to content

Commit

Permalink
docs: merge delegated naming with Routing V1 Spec
Browse files Browse the repository at this point in the history
- suggestions from code review
- removes application/json from ipip-379
- removes custom headers from ipip-379
- cleans duplicated errors
- punctuation and others
  • Loading branch information
hacdias committed May 30, 2023
1 parent c04b1f6 commit 8ff9b91
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 240 deletions.
2 changes: 1 addition & 1 deletion src/ipips/ipip-0337.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ To understand the design rationale, it is important to consider the concrete Ref
So this API proposal makes the following changes:

- The Delegated Content Routing API is defined using HTTP semantics, and can be implemented without introducing Reframe concepts nor IPLD
- There is a clear distinction between the RPC protocol (HTTP) and the API (Delegated Content Routing)
- There is a clear distinction between the [Kubo RPC](https://docs.ipfs.tech/reference/kubo/rpc/) and the vendor-agnostic Routing V1 HTTP API (introduced in :cite[ipip-0377]).
- "Method names" and cache-relevant parameters are pushed into the URL path
- Streaming support is removed, and default response size limits are added.
- We will add streaming support in a subsequent IPIP, but we are trying to minimize the scope of this IPIP to what is immediately useful
Expand Down
41 changes: 12 additions & 29 deletions src/ipips/ipip-0379.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ relatedIssues:
- https://github.com/ipfs/specs/issues/343
- https://github.com/ipfs/specs/pull/337
- https://github.com/ipfs/specs/pull/377
xref:
- ipns-record
order: 379
tags: ['ipips']
---

- Start Date: 2023-02-13
- Related Issues:

## Summary

This IPIP specifies a set of HTTP APIs to offload naming system onto another process or server.
Expand All @@ -28,21 +27,17 @@ This IPIP specifies a set of HTTP APIs to offload naming system onto another pro
Expanding on the motivations of :cite[ipip-0337], the work here concentrates on delegation of _naming system_ over HTTP APIs. Naming is part of the core IPFS DHT functionality.
The performance of naming system over the IPFS DHT can suffer from long delays due to churn of records and quorum requirements.

## HTTP API Specification
## Detailed design

See :cite[http-ipns-routing] specification.
See :cite[http-routing-v1] specification.

## Design rationale

The rationale for delegated IPNS over HTTP APIs closely follows the reasoning listed in :cite[ipip-0337].

The document proposes the following:
- Use of HTTP semantics for publication and resolution of naming records.
- Preference for human-readable request and response encoding, such as JSON format
- Optional backward compatibility support for the existing ProtocolBuffer format using `Content-Type: application/vnd.ipfs.ipns-record`
- Use of extra headers in `OPTIONS` response to communicate the supported capabilities and limitations, namely:
- `X-Ipns-Allow-Max-Size` -- to signal maximum supported IPNS record size
- `X-Ipns-Allow-Protobuf` -- to signal whether the server supports ProtocolBuffer formatted records.
- Use of existing :ref[IPNS Record] serialization format through `Content-Type: application/vnd.ipfs.ipns-record`.
- Streaming interaction is not supported.

### User benefit
Expand All @@ -51,44 +46,32 @@ The ability of offload naming onto another process or server via an idiomatic an

### Compatibility

#### Backwards Compatibility
See "Compatibility" section of :cite[ipip-0337].

##### Serialization Format
#### Serialization Format

:cite[ipns-record] use ProtocolBuffer serialisation format.
:cite[ipns-record] uses `application/vnd.ipfs.ipns-record` protobuf serialization format.
This format is widely in use in IPNS over PubSub and DHT routing systems.
One of the motivations of this document is to introduce simple to use HTTP APIs and ultimately reduce barrier for interaction across alternative systems.
Further, interoperability across the existing and HTTP APIs is also desirable in order to reduce the barrier for adoption of the delegated HTTP APIs.

The specification here maintains backwards compatibility in terms of record serialisation, with preference for human-readable formats such as JSON.
To maximize interoperability with existing ecosystem, the canonical IPNS record serialization format :cite[ipns-record] (`0x0300`) can be requested with content type `application/vnd.ipfs.ipns-record`.

##### Reframe

See "Backwards Compatibility" section of :cite[ipip-0337].

#### Forwards Compatibility

See "Forwards Compatibility" section of :cite[ipip-0337].

### Security

All interaction over the APIs should use TLS to protect against third-party observation and tampering.
Additionally, the IPNS records are signed by the publisher's identity and contain sequence number to avoid replay attacks.

To avoid Denial of Service attack, maximum IPNS record size of `10 KiB` applies.
Implements are permitted to set a lower limit. If lower than the default maximum, the limit should be discoverable via `OPTIONS` request with header key `X-Ipns-Allow-Max-Size` with value specified as the number of bytes.
Additionally, the IPNS records must be validated according to the rules stated in :cite[ipns-record] before further processing.

Similarly, a client may check if a server supports ProtocolBuffer formatted records by checking the `X-Ipns-Allow-Protobuf` header key in response to `OPTIONS` request. If present the header value must be either `true` or `false` the absence of the header indicates that ProtocolBuffer formatted records are not supported.
To avoid Denial of Service attack, maximum IPNS record size defined in :cite[ipns-record] applies.

Privacy in delegated IPNS is out of scope for this work.
- The usual JSON parsing rules apply. To prevent potential Denial of Service (DoS) attack, clients should ignore responses larger than 100 providers and introduce a byte size limit that is applicable to their use case.

### Alternatives

See:

- [Libp2p-based IPNS](https://github.com/ipfs/go-ipns).
- Reframe; find out more on "Design Rationale" section of :cite[ipip-0337].
- Reframe; it was deprecated and now removed. Historical reasons can be found in :cite[ipip-0337].

### Copyright

Expand Down
177 changes: 0 additions & 177 deletions src/routing/http-ipns-routing.md

This file was deleted.

Loading

0 comments on commit 8ff9b91

Please sign in to comment.