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