3
3
4
4
5
5
> ### Status of This Memo
6
- >
6
+ >
7
7
> This living document specifies current set of conventions for the IPFS community,
8
8
> and requests discussion and suggestions for improvements via PR.
9
9
10
10
## Table of Contents
11
11
12
- - [ Summary] ( #tldr )
12
+ - [ ** TL;DR** ] ( #tldr )
13
+ - [ With HTTP] ( #addressing-with-http )
14
+ - [ With New URIs] ( #addressing-with-native-url )
13
15
- [ References] ( #references )
14
16
- [ Appendices] ( #appendices )
15
17
- Notes on addressing with [ http://] ( #notes-on-addressing-with-http )
18
20
19
21
## TL;DR
20
22
21
- ### Addressing with HTTP
23
+ If no native protocol handler is available, redirect to a gateway:
22
24
25
+ ``` bash
26
+ ipfs://{cid} → https://{gateway}/ipfs/{cid}
27
+ ipns://{libp2p-key} → https://{gateway}/ipns/{libp2p-key}
28
+ ipns://{fqdn-with-dnslink} → https://{gateway}/ipns/{fqdn-with-dnslink}
29
+ ```
30
+
31
+ With native protocol handlers, follow below:
32
+
33
+ ``` bash
34
+ ipfs://{cidv1base32}
35
+ ipfs://{cidv0} → redirect → ipfs://{cidv1base32} # CIDv0 is case-sensitive Base58, does not work as Origin authority
36
+
37
+ ipns://{libp2p-key-in-cidv1base32}
38
+ ipns://{libp2p-key-in-base58} → redirect → ipns://{libp2p-key-in-cidv1} # Base58, does not work as Origin authority
39
+
40
+ ipns://{fqdn-with-dnslink}
41
+ ipfs://{fqdn-with-dnslink} → redirect → ipns://{fqdn-with-dnslink} # just to improve UX :-)
42
+
43
+ dweb:/ipfs/{root}/{resource} → redirect → ipfs://{root}/{resource} # ensures {root} is the authority component
44
+ dweb:/ipns/{root}/{resource} → redirect → ipns://{root}/{resource} # ensures {root} is the authority component
45
+ ```
46
+
47
+ ## Addressing with HTTP
48
+
49
+ ### Paths
23
50
24
51
When site isolation does not matter gateway can expose IPFS namespaces as regular URL paths:
25
52
26
53
https://<gateway-host>.tld/ipfs/<cid>/path/to/resource
27
54
https://<gateway-host>.tld/ipns/<keyid_or_fqdn>/path/to/resource
28
55
29
- When origin-based security perimeter is needed, [ CIDv1] ( https://github.com/ipld/cid#cidv1 ) in Base32 ([ RFC4648] ( https://tools.ietf.org/html/rfc4648#section-6 ) , no padding) should be used in subdomain:
56
+ Examples:
57
+
58
+ https://gateway.ipfs.io/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html
59
+ https://gateway.ipfs.io/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Mars.html
60
+ https://gateway.ipfs.io/ipns/tr.wikipedia-on-ipfs.org/wiki/Anasayfa.html
61
+
62
+ ### Subdomains
63
+
64
+ When [ origin-based security] ( https://en.wikipedia.org/wiki/Same-origin_policy ) perimeter is needed, [ CIDv1] ( https://github.com/ipld/cid#cidv1 ) in Base32 ([ RFC4648] ( https://tools.ietf.org/html/rfc4648#section-6 ) , no padding) should be used in subdomain:
30
65
31
66
https://<cidv1-base32>.ipfs.<gateway-host>.tld/path/to/resource
32
67
68
+ Example:
69
+
70
+ https://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq.ipfs.dweb.link/wiki/
71
+
33
72
Read more: [ notes on addressing with HTTP] ( #notes-on-addressing-with-http ) .
34
73
35
- ### Addressing with Native URL
74
+ ## Addressing with Native URL
36
75
37
76
In future, subdomain convention will be replaced with native handler that provides the same origin-based guarantees:
38
77
39
78
ipfs://{cidv1b32}/path/to/resource
40
79
80
+ Example:
81
+
82
+ ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html
83
+
41
84
Read more: [ notes on addressing with ipfs://] ( #notes-on-addressing-with-ipfs ) .
42
85
43
- ### Addressing with URI
86
+ ## Addressing with URI
87
+
88
+ > ** Implementation Warning:**
89
+ > web browsers often implement custom URIs in a way that enforces Origin to be either equal ` null ` or based on the first label after ` : ` .
90
+ > This makes proper security isolation of content loaded via ` dweb:/ipfs/{root}/ ` difficult to get right, and it may be easier to redirect to ` ipfs://{root} ` .
44
91
45
92
In contexts that do not require origin-based security a simple URI can be used for addressing both IPFS and IPNS resources.
93
+
46
94
We argue that paths are the better canonical address and that all kinds of things with different semantics can live in a shared universal namespace. To provide a first step towards that goal, the dweb: URI is proposed:
47
95
48
96
dweb:/ipfs/{cidv1b32}/path/to/resource
97
+ dweb:/ipns/{libp2p-key-in-cidv1base32}/path/to/resource
98
+ dweb:/ipns/{fqdn-with-dnslink}/path/to/resource
99
+
100
+ Example:
101
+
102
+ dweb:/ipfs/bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html
103
+ dweb:/ipns/tr.wikipedia-on-ipfs.org/wiki/Anasayfa.html
49
104
50
105
Read more: [ notes on addressing with dweb:] ( #notes-on-addressing-with-dweb ) .
51
106
@@ -55,9 +110,9 @@ Read more: [notes on addressing with dweb:](#notes-on-addressing-with-dweb).
55
110
- [ IPFS: Migration to CIDv1 (default base32)] ( https://github.com/ipfs/ipfs/issues/337 )
56
111
- [ Support Custom Protocols in WebExtension] ( https://github.com/lidel/ipfs-firefox-addon/issues/164 )
57
112
- [ mozilla/libdweb experiment: ipfs:// protocol handler] ( https://github.com/ipfs-shipyard/ipfs-companion/pull/533 )
58
-
113
+
59
114
## Appendices
60
-
115
+
61
116
### Notes on addressing with ` http:// `
62
117
63
118
The first stage on the upgrade path are HTTP gateways.
@@ -125,7 +180,7 @@ According to [RFC 1035](http://tools.ietf.org/html/rfc1035) subdomains (aka
125
180
of content addressing identifier types that can be used without need for an
126
181
additional conversion step.
127
182
128
- Due to this IPFS community [ decided] ( https://github.com/ipfs/ipfs/issues/337 ) to use lowercased base32
183
+ Due to this IPFS community [ decided] ( https://github.com/ipfs/ipfs/issues/337 ) to use lowercased base32
129
184
([ RFC4648] ( https://tools.ietf.org/html/rfc4648#section-6 ) - no padding - highest letter)
130
185
as the default base encoding of [ CIDv1] ( https://github.com/ipld/cid#cidv1 ) (our binary identifiers).
131
186
@@ -137,9 +192,9 @@ Suborigins are a
137
192
provide a new mechanism for allowing sites to separate their content by
138
193
creating synthetic origins while serving content from a single physical origin.
139
194
140
- A [ ` suborigin ` header] ( https://w3c.github.io/webappsec-suborigins/#the-suborigin-header )
195
+ A [ ` suborigin ` header] ( https://w3c.github.io/webappsec-suborigins/#the-suborigin-header )
141
196
SHOULD be returned by HTTP gateway and contain a value
142
- unique to the current content addressing root.
197
+ unique to the current content addressing root.
143
198
144
199
Unfortunately due to limited adoption suborigin have no practical use.
145
200
@@ -157,14 +212,11 @@ calculation, which provides necessary isolation between security contexts of dif
157
212
158
213
### Notes on addressing with ` dweb: `
159
214
160
- We're not trying to bring in all the possible sources of data, or interfaces into this namespace.
161
- We only work on content-addressed stuff here.
215
+ We're not trying to bring in all the possible sources of data, or interfaces into this namespace.
216
+ We only work on content-addressed stuff here.
162
217
163
218
Why not just only ` ipfs:// ` and ` ipns:// ` ?
164
219
165
220
- These URLs satisfy the content-addressing requirement
166
221
- They don't satisfy the universal-data-namespace requirement
167
222
- [ We want to leave room for others in this new addressing scheme] ( https://github.com/arewedistributedyet/arewedistributedyet/issues/28 )
168
-
169
-
170
-
0 commit comments