|
| 1 | +# IPIP 0351: IPNS Signed Records Response Format on HTTP Gateways |
| 2 | + |
| 3 | +- Start Date: 2022-11-29 |
| 4 | +- Related Issues: |
| 5 | + - [ipfs/specs/issues/320](https://github.com/ipfs/specs/issues/320) |
| 6 | + - [ipfs/specs/pull/351](https://github.com/ipfs/specs/pull/351) |
| 7 | + - [ipfs/kubo/pull/9399](https://github.com/ipfs/kubo/pull/9399) |
| 8 | + |
| 9 | +## Summary |
| 10 | + |
| 11 | +Add IPNS Signed Records response format to the [HTTP Gateway](https://specs.ipfs.tech/http-gateways/). |
| 12 | + |
| 13 | +## Motivation |
| 14 | + |
| 15 | +Currently, the gateway allows for trustless retrieval of data under the `/ipfs` |
| 16 | +namespace, bu fetching the data as a CAR, or Block, and then verifying it locally. |
| 17 | +This is especially important for light IPFS clients, so that they can retrieve |
| 18 | +data from other gateways without delegating any of the trust to them. Unfortunately, |
| 19 | +this is not possible under the `/ipns` namespace. |
| 20 | + |
| 21 | +In contrary to DNSLink, IPNS provides cryptographically-verifiable records that |
| 22 | +can be verified by the client. This means that, if a gateway is able to provide |
| 23 | +the IPNS signed record to an HTTP client, trustless retrieval would also be available |
| 24 | +under the `/ipns` namespace. |
| 25 | + |
| 26 | +In this IPIP, we propose adding [IPNS signed records][ipld-record] as a response |
| 27 | +format to the gateway under the `/ipns` namespace, allowing for trustless |
| 28 | +retrieval of IPNS records. |
| 29 | + |
| 30 | +## Detailed design |
| 31 | + |
| 32 | +The solution is to allow the Gateway to provide an IPNS signed record by |
| 33 | +requesting it using either the `Accept` HTTP header or the `format` URL query. |
| 34 | + |
| 35 | +## Test fixtures |
| 36 | + |
| 37 | +IPNS records for testing can be generated in Kubo by creating an IPNS record: |
| 38 | + |
| 39 | +```bash |
| 40 | +$ ipfs key gen <key-name> |
| 41 | +k51Key |
| 42 | + |
| 43 | +$ ipfs name publish /ipfs/bafyHash --key=<key-name> --ttl=<record-ttl> |
| 44 | +Published to k51Key: /ipfs/bafyHash |
| 45 | + |
| 46 | +$ ipfs routing get /ipns/k51Key > key.pb |
| 47 | +``` |
| 48 | + |
| 49 | +## Design rationale |
| 50 | + |
| 51 | +The current gateway already supports different response formats via the |
| 52 | +`Accept` HTTP header and the `format` URL query. This IPIP proposes adding |
| 53 | +one more supported format to that list. |
| 54 | + |
| 55 | +### User benefit |
| 56 | + |
| 57 | +By providing IPNS records through the gateway, IPFS light clients are able |
| 58 | +to race multiple gateways in search for an IPNS record for a certain IPNS key. |
| 59 | +This way, IPFS light clients do not necessarily need to implement the required |
| 60 | +machinery to fetch IPNS records from other IPFS nodes through the DHT or PubSub. |
| 61 | + |
| 62 | +In addition, the retrieval of IPNS records is trustless in the sense that they can |
| 63 | +be verified by the client since the IPNS record includes a cryptographic signature |
| 64 | +provided by its creator. |
| 65 | + |
| 66 | +### Compatibility |
| 67 | + |
| 68 | +This IPIP proposes a new format to be added to the gateway, but does not change |
| 69 | +any prior format. Therefore, this IPIP is backwards compatible. Please note |
| 70 | +that IPNS records are also added to the [Trustless Gateway](https://specs.ipfs.tech/http-gateways/trustless-gateway/) |
| 71 | +specification. |
| 72 | + |
| 73 | +### Copyright |
| 74 | + |
| 75 | +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
| 76 | + |
| 77 | +[ipld-record]: ../ipns/IPNS.md#ipns-record |
0 commit comments