@helia/verified-fetch 0.0.0-8a5bc6f → 0.0.0-f58d467
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -43
- package/dist/index.min.js +4 -29
- package/dist/src/index.d.ts +110 -51
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +86 -47
- package/dist/src/index.js.map +1 -1
- package/dist/src/singleton.d.ts +3 -0
- package/dist/src/singleton.d.ts.map +1 -0
- package/dist/src/singleton.js +15 -0
- package/dist/src/singleton.js.map +1 -0
- package/dist/src/utils/get-stream-from-async-iterable.d.ts +10 -0
- package/dist/src/utils/get-stream-from-async-iterable.d.ts.map +1 -0
- package/dist/src/utils/{get-stream-and-content-type.js → get-stream-from-async-iterable.js} +10 -9
- package/dist/src/utils/get-stream-from-async-iterable.js.map +1 -0
- package/dist/src/verified-fetch.d.ts +4 -1
- package/dist/src/verified-fetch.d.ts.map +1 -1
- package/dist/src/verified-fetch.js +34 -6
- package/dist/src/verified-fetch.js.map +1 -1
- package/package.json +19 -19
- package/src/index.ts +117 -52
- package/src/singleton.ts +20 -0
- package/src/utils/{get-stream-and-content-type.ts → get-stream-from-async-iterable.ts} +9 -8
- package/src/verified-fetch.ts +41 -10
- package/dist/src/utils/get-content-type.d.ts +0 -11
- package/dist/src/utils/get-content-type.d.ts.map +0 -1
- package/dist/src/utils/get-content-type.js +0 -43
- package/dist/src/utils/get-content-type.js.map +0 -1
- package/dist/src/utils/get-stream-and-content-type.d.ts +0 -10
- package/dist/src/utils/get-stream-and-content-type.d.ts.map +0 -1
- package/dist/src/utils/get-stream-and-content-type.js.map +0 -1
- package/src/utils/get-content-type.ts +0 -55
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { CustomProgressEvent } from 'progress-events';
|
|
2
|
-
import { getContentType } from './get-content-type.js';
|
|
3
2
|
/**
|
|
4
|
-
* Converts an async iterator of Uint8Array bytes to a stream and
|
|
3
|
+
* Converts an async iterator of Uint8Array bytes to a stream and returns the first chunk of bytes
|
|
5
4
|
*/
|
|
6
|
-
export async function
|
|
7
|
-
const log = logger.forComponent('helia:verified-fetch:get-stream-
|
|
5
|
+
export async function getStreamFromAsyncIterable(iterator, path, logger, options) {
|
|
6
|
+
const log = logger.forComponent('helia:verified-fetch:get-stream-from-async-iterable');
|
|
8
7
|
const reader = iterator[Symbol.asyncIterator]();
|
|
9
|
-
const { value, done } = await reader.next();
|
|
8
|
+
const { value: firstChunk, done } = await reader.next();
|
|
10
9
|
if (done === true) {
|
|
11
10
|
log.error('No content found for path', path);
|
|
12
11
|
throw new Error('No content found');
|
|
13
12
|
}
|
|
14
|
-
const contentType = await getContentType({ bytes: value, path });
|
|
15
13
|
const stream = new ReadableStream({
|
|
16
14
|
async start(controller) {
|
|
17
15
|
// the initial value is already available
|
|
18
16
|
options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:progress:chunk'));
|
|
19
|
-
controller.enqueue(
|
|
17
|
+
controller.enqueue(firstChunk);
|
|
20
18
|
},
|
|
21
19
|
async pull(controller) {
|
|
22
20
|
const { value, done } = await reader.next();
|
|
@@ -32,6 +30,9 @@ export async function getStreamAndContentType(iterator, path, logger, options) {
|
|
|
32
30
|
controller.enqueue(value);
|
|
33
31
|
}
|
|
34
32
|
});
|
|
35
|
-
return {
|
|
33
|
+
return {
|
|
34
|
+
stream,
|
|
35
|
+
firstChunk
|
|
36
|
+
};
|
|
36
37
|
}
|
|
37
|
-
//# sourceMappingURL=get-stream-
|
|
38
|
+
//# sourceMappingURL=get-stream-from-async-iterable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-stream-from-async-iterable.js","sourceRoot":"","sources":["../../../src/utils/get-stream-from-async-iterable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAIrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAE,QAAmC,EAAE,IA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AC;KACF,CAAC,CAAA;IAEF,OAAO;QACL,MAAM;QACN,UAAU;KACX,CAAA;AACH,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { type IPNS } from '@helia/ipns';
|
|
|
4
4
|
import { type JSON } from '@helia/json';
|
|
5
5
|
import { type UnixFS as HeliaUnixFs } from '@helia/unixfs';
|
|
6
6
|
import { type PathWalkerFn } from './utils/walk-path.js';
|
|
7
|
-
import type { Resource, VerifiedFetchInit as VerifiedFetchOptions } from './index.js';
|
|
7
|
+
import type { ContentTypeParser, Resource, VerifiedFetchInit as VerifiedFetchOptions } from './index.js';
|
|
8
8
|
import type { Helia } from '@helia/interface';
|
|
9
9
|
interface VerifiedFetchComponents {
|
|
10
10
|
helia: Helia;
|
|
@@ -19,6 +19,7 @@ interface VerifiedFetchComponents {
|
|
|
19
19
|
* Potential future options for the VerifiedFetch constructor.
|
|
20
20
|
*/
|
|
21
21
|
interface VerifiedFetchInit {
|
|
22
|
+
contentTypeParser?: ContentTypeParser;
|
|
22
23
|
}
|
|
23
24
|
export declare class VerifiedFetch {
|
|
24
25
|
private readonly helia;
|
|
@@ -29,6 +30,7 @@ export declare class VerifiedFetch {
|
|
|
29
30
|
private readonly json;
|
|
30
31
|
private readonly pathWalker;
|
|
31
32
|
private readonly log;
|
|
33
|
+
private readonly contentTypeParser;
|
|
32
34
|
constructor({ helia, ipns, unixfs, dagJson, json, dagCbor, pathWalker }: VerifiedFetchComponents, init?: VerifiedFetchInit);
|
|
33
35
|
private handleIPNSRecord;
|
|
34
36
|
private handleIPLDCar;
|
|
@@ -37,6 +39,7 @@ export declare class VerifiedFetch {
|
|
|
37
39
|
private handleDagCbor;
|
|
38
40
|
private handleDagPb;
|
|
39
41
|
private handleRaw;
|
|
42
|
+
private setContentType;
|
|
40
43
|
/**
|
|
41
44
|
* Determines the format requested by the client, defaults to `null` if no format is requested.
|
|
42
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verified-fetch.d.ts","sourceRoot":"","sources":["../../src/verified-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAyB,KAAK,MAAM,IAAI,WAAW,EAAoB,MAAM,eAAe,CAAA;AASnG,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,KAAK,EAAa,QAAQ,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"verified-fetch.d.ts","sourceRoot":"","sources":["../../src/verified-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAyB,KAAK,MAAM,IAAI,WAAW,EAAoB,MAAM,eAAe,CAAA;AASnG,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,KAAK,EAAa,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,IAAI,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACnH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAK7C,UAAU,uBAAuB;IAC/B,KAAK,EAAE,KAAK,CAAA;IACZ,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,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}
|
|
@@ -10,7 +10,7 @@ import { code as dagPbCode } from '@ipld/dag-pb';
|
|
|
10
10
|
import { code as jsonCode } from 'multiformats/codecs/json';
|
|
11
11
|
import { decode, code as rawCode } from 'multiformats/codecs/raw';
|
|
12
12
|
import { CustomProgressEvent } from 'progress-events';
|
|
13
|
-
import {
|
|
13
|
+
import { getStreamFromAsyncIterable } from './utils/get-stream-from-async-iterable.js';
|
|
14
14
|
import { parseResource } from './utils/parse-resource.js';
|
|
15
15
|
import { walkPath } from './utils/walk-path.js';
|
|
16
16
|
function convertOptions(options) {
|
|
@@ -35,6 +35,7 @@ export class VerifiedFetch {
|
|
|
35
35
|
json;
|
|
36
36
|
pathWalker;
|
|
37
37
|
log;
|
|
38
|
+
contentTypeParser;
|
|
38
39
|
constructor({ helia, ipns, unixfs, dagJson, json, dagCbor, pathWalker }, init) {
|
|
39
40
|
this.helia = helia;
|
|
40
41
|
this.log = helia.logger.forComponent('helia:verified-fetch');
|
|
@@ -49,6 +50,7 @@ export class VerifiedFetch {
|
|
|
49
50
|
this.json = json ?? heliaJson(helia);
|
|
50
51
|
this.dagCbor = dagCbor ?? heliaDagCbor(helia);
|
|
51
52
|
this.pathWalker = pathWalker ?? walkPath;
|
|
53
|
+
this.contentTypeParser = init?.contentTypeParser;
|
|
52
54
|
this.log.trace('created VerifiedFetch instance');
|
|
53
55
|
}
|
|
54
56
|
// handle vnd.ipfs.ipns-record
|
|
@@ -95,8 +97,8 @@ export class VerifiedFetch {
|
|
|
95
97
|
onProgress: options?.onProgress
|
|
96
98
|
});
|
|
97
99
|
options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid: cid.toString(), path }));
|
|
98
|
-
const response = new Response(
|
|
99
|
-
|
|
100
|
+
const response = new Response(result, { status: 200 });
|
|
101
|
+
await this.setContentType(result, path, response);
|
|
100
102
|
return response;
|
|
101
103
|
}
|
|
102
104
|
async handleDagPb({ cid, path, options, terminalElement }) {
|
|
@@ -134,11 +136,11 @@ export class VerifiedFetch {
|
|
|
134
136
|
});
|
|
135
137
|
options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid: resolvedCID.toString(), path: '' }));
|
|
136
138
|
this.log('got async iterator for %c/%s', cid, path);
|
|
137
|
-
const {
|
|
139
|
+
const { stream, firstChunk } = await getStreamFromAsyncIterable(asyncIter, path ?? '', this.helia.logger, {
|
|
138
140
|
onProgress: options?.onProgress
|
|
139
141
|
});
|
|
140
142
|
const response = new Response(stream, { status: 200 });
|
|
141
|
-
|
|
143
|
+
await this.setContentType(firstChunk, path, response);
|
|
142
144
|
return response;
|
|
143
145
|
}
|
|
144
146
|
async handleRaw({ cid, path, options }) {
|
|
@@ -147,9 +149,32 @@ export class VerifiedFetch {
|
|
|
147
149
|
const result = await this.helia.blockstore.get(cid);
|
|
148
150
|
options?.onProgress?.(new CustomProgressEvent('verified-fetch:request:end', { cid: cid.toString(), path }));
|
|
149
151
|
const response = new Response(decode(result), { status: 200 });
|
|
150
|
-
|
|
152
|
+
await this.setContentType(result, path, response);
|
|
151
153
|
return response;
|
|
152
154
|
}
|
|
155
|
+
async setContentType(bytes, path, response) {
|
|
156
|
+
let contentType = 'application/octet-stream';
|
|
157
|
+
if (this.contentTypeParser != null) {
|
|
158
|
+
try {
|
|
159
|
+
let fileName = path.split('/').pop()?.trim();
|
|
160
|
+
fileName = fileName === '' ? undefined : fileName;
|
|
161
|
+
const parsed = this.contentTypeParser(bytes, fileName);
|
|
162
|
+
if (isPromise(parsed)) {
|
|
163
|
+
const result = await parsed;
|
|
164
|
+
if (result != null) {
|
|
165
|
+
contentType = result;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else if (parsed != null) {
|
|
169
|
+
contentType = parsed;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
this.log.error('Error parsing content type', err);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
response.headers.set('content-type', contentType);
|
|
177
|
+
}
|
|
153
178
|
/**
|
|
154
179
|
* Determines the format requested by the client, defaults to `null` if no format is requested.
|
|
155
180
|
*
|
|
@@ -258,4 +283,7 @@ export class VerifiedFetch {
|
|
|
258
283
|
await this.helia.stop();
|
|
259
284
|
}
|
|
260
285
|
}
|
|
286
|
+
function isPromise(p) {
|
|
287
|
+
return p?.then != null;
|
|
288
|
+
}
|
|
261
289
|
//# sourceMappingURL=verified-fetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verified-fetch.js","sourceRoot":"","sources":["../../src/verified-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAgB,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAgB,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,IAAI,IAAI,SAAS,EAAa,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,IAAI,IAAI,SAAS,EAAa,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAgD,MAAM,eAAe,CAAA;AACnG,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,QAAQ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,EAAE,CAAC,CAAA,CAAC,2EAA2E;QACxH,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,qCAAqC,CAAC,CAAA;QAC3E,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA,CAAC,kFAAkF;QAE3I,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC,mFAAmF;QACjL,CAAC;QACD,iJAAiJ;QAEjJ,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IACzB,CAAC;CACF;AAED,SAAS,SAAS,CAAM,CAAO;IAC7B,OAAO,CAAC,EAAE,IAAI,IAAI,IAAI,CAAA;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@helia/verified-fetch",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-f58d467",
|
|
4
4
|
"description": "A fetch-like API for obtaining verified & trustless IPFS content on the web.",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/ipfs/helia/tree/main/packages/verified-fetch#readme",
|
|
@@ -141,36 +141,36 @@
|
|
|
141
141
|
"release": "aegir release"
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@helia/block-brokers": "2.0.1-
|
|
145
|
-
"@helia/dag-cbor": "3.0.0-
|
|
146
|
-
"@helia/dag-json": "3.0.0-
|
|
147
|
-
"@helia/http": "1.0.1-
|
|
148
|
-
"@helia/interface": "4.0.0-
|
|
149
|
-
"@helia/ipns": "6.0.0-
|
|
150
|
-
"@helia/json": "3.0.0-
|
|
151
|
-
"@helia/routers": "1.0.0-
|
|
152
|
-
"@helia/unixfs": "3.0.0-
|
|
144
|
+
"@helia/block-brokers": "2.0.1-f58d467",
|
|
145
|
+
"@helia/dag-cbor": "3.0.0-f58d467",
|
|
146
|
+
"@helia/dag-json": "3.0.0-f58d467",
|
|
147
|
+
"@helia/http": "1.0.1-f58d467",
|
|
148
|
+
"@helia/interface": "4.0.0-f58d467",
|
|
149
|
+
"@helia/ipns": "6.0.0-f58d467",
|
|
150
|
+
"@helia/json": "3.0.0-f58d467",
|
|
151
|
+
"@helia/routers": "1.0.0-f58d467",
|
|
152
|
+
"@helia/unixfs": "3.0.0-f58d467",
|
|
153
153
|
"@ipld/dag-cbor": "^9.1.0",
|
|
154
154
|
"@ipld/dag-json": "^10.1.7",
|
|
155
155
|
"@ipld/dag-pb": "^4.0.8",
|
|
156
156
|
"@libp2p/interface": "^1.1.2",
|
|
157
157
|
"@libp2p/peer-id": "^4.0.5",
|
|
158
158
|
"hashlru": "^2.3.0",
|
|
159
|
-
"ipfs-unixfs-exporter": "^13.
|
|
160
|
-
"
|
|
161
|
-
"multiformats": "^13.0.0",
|
|
159
|
+
"ipfs-unixfs-exporter": "^13.5.0",
|
|
160
|
+
"multiformats": "^13.0.1",
|
|
162
161
|
"progress-events": "^1.0.0"
|
|
163
162
|
},
|
|
164
163
|
"devDependencies": {
|
|
165
164
|
"@libp2p/logger": "^4.0.5",
|
|
166
165
|
"@libp2p/peer-id-factory": "^4.0.5",
|
|
167
|
-
"@
|
|
168
|
-
"@types/sinon": "^17.0.
|
|
169
|
-
"aegir": "^42.
|
|
170
|
-
"helia": "4.0.1-
|
|
171
|
-
"
|
|
166
|
+
"@sgtpooki/file-type": "^1.0.1",
|
|
167
|
+
"@types/sinon": "^17.0.3",
|
|
168
|
+
"aegir": "^42.2.2",
|
|
169
|
+
"helia": "4.0.1-f58d467",
|
|
170
|
+
"magic-bytes.js": "^1.8.0",
|
|
172
171
|
"sinon": "^17.0.1",
|
|
173
|
-
"sinon-ts": "^2.0.0"
|
|
172
|
+
"sinon-ts": "^2.0.0",
|
|
173
|
+
"uint8arrays": "^5.0.1"
|
|
174
174
|
},
|
|
175
175
|
"sideEffects": false
|
|
176
176
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,57 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
*
|
|
4
|
-
* `@helia/verified-fetch`
|
|
4
|
+
* `@helia/verified-fetch` provides a [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)-like API for retrieving content from the [IPFS](https://ipfs.tech/) network.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* All content is retrieved in a [trustless manner](https://www.techopedia.com/definition/trustless), and the integrity of all bytes are verified by comparing hashes of the data.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* This is a marked improvement over `fetch` which offers no such protections and is vulnerable to all sorts of attacks like [Content Spoofing](https://owasp.org/www-community/attacks/Content_Spoofing), [DNS Hijacking](https://en.wikipedia.org/wiki/DNS_hijacking), etc.
|
|
9
|
+
*
|
|
10
|
+
* A `verifiedFetch` function is exported to get up and running quickly, and a `createVerifiedFetch` function is also available that allows customizing the underlying [Helia](https://helia.io/) node for complete control over how content is retrieved.
|
|
11
|
+
*
|
|
12
|
+
* Browser-cache-friendly [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects are returned which should be instantly familiar to web developers.
|
|
9
13
|
*
|
|
10
14
|
* You may use any supported resource argument to fetch content:
|
|
11
15
|
*
|
|
12
|
-
* - CID instance
|
|
16
|
+
* - [CID](https://multiformats.github.io/js-multiformats/classes/cid.CID.html) instance
|
|
13
17
|
* - IPFS URL
|
|
14
18
|
* - IPNS URL
|
|
15
19
|
*
|
|
16
|
-
* @example
|
|
20
|
+
* @example Getting started
|
|
17
21
|
*
|
|
18
22
|
* ```typescript
|
|
19
|
-
* import {
|
|
23
|
+
* import { verifiedFetch } from '@helia/verified-fetch'
|
|
20
24
|
*
|
|
21
|
-
* const
|
|
22
|
-
* gateways: ['https://mygateway.example.net', 'https://trustless-gateway.link']
|
|
23
|
-
*})
|
|
24
|
-
*
|
|
25
|
-
* const resp = await fetch('ipfs://bafy...')
|
|
25
|
+
* const resp = await verifiedFetch('ipfs://bafy...')
|
|
26
26
|
*
|
|
27
27
|
* const json = await resp.json()
|
|
28
28
|
*```
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
30
|
* @example Using a CID instance to fetch JSON
|
|
32
31
|
*
|
|
33
32
|
* ```typescript
|
|
34
|
-
* import {
|
|
33
|
+
* import { verifiedFetch } from '@helia/verified-fetch'
|
|
35
34
|
* import { CID } from 'multiformats/cid'
|
|
36
35
|
*
|
|
37
|
-
* const fetch = await createVerifiedFetch({
|
|
38
|
-
* gateways: ['https://mygateway.example.net', 'https://trustless-gateway.link']
|
|
39
|
-
* })
|
|
40
|
-
*
|
|
41
36
|
* const cid = CID.parse('bafyFoo') // some image file
|
|
42
|
-
* const response = await
|
|
37
|
+
* const response = await verifiedFetch(cid)
|
|
43
38
|
* const json = await response.json()
|
|
44
39
|
* ```
|
|
45
40
|
*
|
|
46
41
|
* @example Using IPFS protocol to fetch an image
|
|
47
42
|
*
|
|
48
43
|
* ```typescript
|
|
49
|
-
* import {
|
|
44
|
+
* import { verifiedFetch } from '@helia/verified-fetch'
|
|
50
45
|
*
|
|
51
|
-
* const
|
|
52
|
-
* gateways: ['https://mygateway.example.net', 'https://trustless-gateway.link']
|
|
53
|
-
* })
|
|
54
|
-
* const response = await fetch('ipfs://bafyFoo') // CID for some image file
|
|
46
|
+
* const response = await verifiedFetch('ipfs://bafyFoo') // CID for some image file
|
|
55
47
|
* const blob = await response.blob()
|
|
56
48
|
* const image = document.createElement('img')
|
|
57
49
|
* image.src = URL.createObjectURL(blob)
|
|
@@ -61,22 +53,42 @@
|
|
|
61
53
|
* @example Using IPNS protocol to stream a big file
|
|
62
54
|
*
|
|
63
55
|
* ```typescript
|
|
56
|
+
* import { verifiedFetch } from '@helia/verified-fetch'
|
|
57
|
+
*
|
|
58
|
+
* const response = await verifiedFetch('ipns://mydomain.com/path/to/very-long-file.log')
|
|
59
|
+
* const bigFileStreamReader = await response.body.getReader()
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* ## Configuration
|
|
63
|
+
*
|
|
64
|
+
* ### Custom HTTP gateways and routers
|
|
65
|
+
*
|
|
66
|
+
* Out of the box `@helia/verified-fetch` uses a default set of [trustless gateways](https://specs.ipfs.tech/http-gateways/trustless-gateway/) for fetching blocks and [HTTP delegated routers](https://specs.ipfs.tech/routing/http-routing-v1/) for performing routing tasks - looking up peers, resolving/publishing [IPNS](https://docs.ipfs.tech/concepts/ipns/) names, etc.
|
|
67
|
+
*
|
|
68
|
+
* It's possible to override these by passing `gateways` and `routers` keys to the `createVerifiedFetch` function:
|
|
69
|
+
*
|
|
70
|
+
* @example Configuring gateways and routers
|
|
71
|
+
*
|
|
72
|
+
* ```typescript
|
|
64
73
|
* import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
65
74
|
*
|
|
66
75
|
* const fetch = await createVerifiedFetch({
|
|
67
|
-
* gateways: ['https://
|
|
76
|
+
* gateways: ['https://trustless-gateway.link'],
|
|
77
|
+
* routers: ['http://delegated-ipfs.dev']
|
|
68
78
|
* })
|
|
69
|
-
* const response = await fetch('ipns://mydomain.com/path/to/very-long-file.log')
|
|
70
|
-
* const bigFileStreamReader = await response.body.getReader()
|
|
71
|
-
* ```
|
|
72
79
|
*
|
|
73
|
-
*
|
|
80
|
+
* const resp = await fetch('ipfs://bafy...')
|
|
74
81
|
*
|
|
75
|
-
*
|
|
82
|
+
* const json = await resp.json()
|
|
83
|
+
*```
|
|
76
84
|
*
|
|
77
|
-
*
|
|
85
|
+
* ### Usage with customized Helia
|
|
86
|
+
*
|
|
87
|
+
* For full control of how `@helia/verified-fetch` fetches content from the distributed web you can pass a preconfigured Helia node to `createVerifiedFetch`.
|
|
78
88
|
*
|
|
79
|
-
* The
|
|
89
|
+
* The [helia](https://www.npmjs.com/package/helia) module is configured with a libp2p node that is suited for decentralized applications, alternatively [@helia/http](https://www.npmjs.com/package/@helia/http) is available which uses HTTP gateways for all network operations.
|
|
90
|
+
*
|
|
91
|
+
* You can see variations of Helia and js-libp2p configuration options at https://helia.io/interfaces/helia.index.HeliaInit.html.
|
|
80
92
|
*
|
|
81
93
|
* ```typescript
|
|
82
94
|
* import { trustlessGateway } from '@helia/block-brokers'
|
|
@@ -100,28 +112,53 @@
|
|
|
100
112
|
* const json = await resp.json()
|
|
101
113
|
* ```
|
|
102
114
|
*
|
|
103
|
-
* ###
|
|
115
|
+
* ### Custom content-type parsing
|
|
116
|
+
*
|
|
117
|
+
* By default, `@helia/verified-fetch` sets the `Content-Type` header as `application/octet-stream` - this is because the `.json()`, `.text()`, `.blob()`, and `.arrayBuffer()` methods will usually work as expected without a detailed content type.
|
|
118
|
+
*
|
|
119
|
+
* If you require an accurate content-type you can provide a `contentTypeParser` function as an option to `createVerifiedFetch` to handle parsing the content type.
|
|
120
|
+
*
|
|
121
|
+
* The function you provide will be called with the first chunk of bytes from the file and should return a string or a promise of a string.
|
|
122
|
+
*
|
|
123
|
+
* @example Customizing content-type parsing
|
|
124
|
+
*
|
|
125
|
+
* ```typescript
|
|
126
|
+
* import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
127
|
+
* import { fileTypeFromBuffer } from '@sgtpooki/file-type'
|
|
128
|
+
*
|
|
129
|
+
* const fetch = await createVerifiedFetch({
|
|
130
|
+
* gateways: ['https://trustless-gateway.link'],
|
|
131
|
+
* routers: ['http://delegated-ipfs.dev'],
|
|
132
|
+
* contentTypeParser: async (bytes) => {
|
|
133
|
+
* // call to some magic-byte recognition library like magic-bytes, file-type, or your own custom byte recognition
|
|
134
|
+
* const result = await fileTypeFromBuffer(bytes)
|
|
135
|
+
* return result?.mime
|
|
136
|
+
* }
|
|
137
|
+
* })
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* ## Comparison to fetch
|
|
104
141
|
*
|
|
105
|
-
*
|
|
142
|
+
* This module attempts to act as similarly to the `fetch()` API as possible.
|
|
106
143
|
*
|
|
107
144
|
* [The `fetch()` API](https://developer.mozilla.org/en-US/docs/Web/API/fetch) takes two parameters:
|
|
108
145
|
*
|
|
109
146
|
* 1. A [resource](https://developer.mozilla.org/en-US/docs/Web/API/fetch#resource)
|
|
110
147
|
* 2. An [options object](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options)
|
|
111
148
|
*
|
|
112
|
-
*
|
|
149
|
+
* ### Resource argument
|
|
113
150
|
*
|
|
114
|
-
* This library
|
|
151
|
+
* This library supports the following methods of fetching web3 content from IPFS:
|
|
115
152
|
*
|
|
116
153
|
* 1. IPFS protocol: `ipfs://<cidv0>` & `ipfs://<cidv0>`
|
|
117
154
|
* 2. IPNS protocol: `ipns://<peerId>` & `ipns://<publicKey>` & `ipns://<hostUri_Supporting_DnsLink_TxtRecords>`
|
|
118
155
|
* 3. CID instances: An actual CID instance `CID.parse('bafy...')`
|
|
119
156
|
*
|
|
120
|
-
* As well as support for pathing & params for item 1&2 above according to [IPFS - Path Gateway Specification](https://specs.ipfs.tech/http-gateways/path-gateway) & [IPFS - Trustless Gateway Specification](https://specs.ipfs.tech/http-gateways/trustless-gateway/). Further refinement of those specifications specifically for web-based scenarios can be found in the [Web Pathing Specification IPIP](https://github.com/ipfs/specs/pull/453).
|
|
157
|
+
* As well as support for pathing & params for item 1 & 2 above according to [IPFS - Path Gateway Specification](https://specs.ipfs.tech/http-gateways/path-gateway) & [IPFS - Trustless Gateway Specification](https://specs.ipfs.tech/http-gateways/trustless-gateway/). Further refinement of those specifications specifically for web-based scenarios can be found in the [Web Pathing Specification IPIP](https://github.com/ipfs/specs/pull/453).
|
|
121
158
|
*
|
|
122
|
-
* If you pass a CID instance,
|
|
159
|
+
* If you pass a CID instance, it assumes you want the content for that specific CID only, and does not support pathing or params for that CID.
|
|
123
160
|
*
|
|
124
|
-
*
|
|
161
|
+
* ### Options argument
|
|
125
162
|
*
|
|
126
163
|
* This library does not plan to support the exact Fetch API options object, as some of the arguments don't make sense. Instead, it will only support options necessary to meet [IPFS specs](https://specs.ipfs.tech/) related to specifying the resultant shape of desired content.
|
|
127
164
|
*
|
|
@@ -146,7 +183,6 @@
|
|
|
146
183
|
* 5. `body` - An object that specifies the body of the request. Best effort to adhere to the [Fetch API body](https://developer.mozilla.org/en-US/docs/Web/API/fetch#body) parameter.
|
|
147
184
|
* 6. `cache` - Will basically act as `force-cache` for the request. Best effort to adhere to the [Fetch API cache](https://developer.mozilla.org/en-US/docs/Web/API/fetch#cache) parameter.
|
|
148
185
|
*
|
|
149
|
-
*
|
|
150
186
|
* Non-Fetch API options that will be supported:
|
|
151
187
|
*
|
|
152
188
|
* 1. `onProgress` - Similar to Helia `onProgress` options, this will be a function that will be called with a progress event. Supported progress events are:
|
|
@@ -167,7 +203,7 @@
|
|
|
167
203
|
* 4. [IPIP-0328: JSON and CBOR Response Formats on HTTP Gateways](https://specs.ipfs.tech/ipips/ipip-0328/)
|
|
168
204
|
* 5. [IPIP-0288: TAR Response Format on HTTP Gateways](https://specs.ipfs.tech/ipips/ipip-0288/)
|
|
169
205
|
*
|
|
170
|
-
*
|
|
206
|
+
* ### Response types
|
|
171
207
|
*
|
|
172
208
|
* This library's purpose is to return reasonably representable content from IPFS. In other words, fetching content is intended for leaf-node content -- such as images/videos/audio & other assets, or other IPLD content (with link) -- that can be represented by https://developer.mozilla.org/en-US/docs/Web/API/Response#instance_methods. The content type you receive back will depend upon the CID you request as well as the `Accept` header value you provide.
|
|
173
209
|
*
|
|
@@ -175,7 +211,7 @@
|
|
|
175
211
|
*
|
|
176
212
|
* If your content doesn't have a mime-type or an [IPFS spec](https://specs.ipfs.tech), this library will not support it, but you can use the [`helia`](https://github.com/ipfs/helia) library directly for those use cases. See [Unsupported response types](#unsupported-response-types) for more information.
|
|
177
213
|
*
|
|
178
|
-
*
|
|
214
|
+
* #### Handling response types
|
|
179
215
|
*
|
|
180
216
|
* For handling responses we want to follow conventions/abstractions from Fetch API where possible:
|
|
181
217
|
*
|
|
@@ -184,12 +220,12 @@
|
|
|
184
220
|
* - For plain text in utf-8, you would call `.text()`
|
|
185
221
|
* - For streaming response data, use something like `response.body.getReader()` to get a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams#consuming_a_fetch_as_a_stream).
|
|
186
222
|
*
|
|
187
|
-
*
|
|
223
|
+
* #### Unsupported response types
|
|
188
224
|
*
|
|
189
225
|
* * Returning IPLD nodes or DAGs as JS objects is not supported, as there is no currently well-defined structure for representing this data in an [HTTP Response](https://developer.mozilla.org/en-US/docs/Web/API/Response). Instead, users should request `aplication/vnd.ipld.car` or use the [`helia`](https://github.com/ipfs/helia) library directly for this use case.
|
|
190
226
|
* * Others? Open an issue or PR!
|
|
191
227
|
*
|
|
192
|
-
*
|
|
228
|
+
* ### Response headers
|
|
193
229
|
*
|
|
194
230
|
* This library will set the [HTTP Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) headers to the appropriate values for the content type according to the appropriate [IPFS Specifications](https://specs.ipfs.tech/).
|
|
195
231
|
*
|
|
@@ -199,13 +235,13 @@
|
|
|
199
235
|
* * https://specs.ipfs.tech/http-gateways/trustless-gateway/#response-headers
|
|
200
236
|
* * https://specs.ipfs.tech/http-gateways/subdomain-gateway/#response-headers
|
|
201
237
|
*
|
|
202
|
-
*
|
|
238
|
+
* ### Possible Scenarios that could cause confusion
|
|
203
239
|
*
|
|
204
|
-
*
|
|
240
|
+
* #### Attempting to fetch the CID for content that does not make sense
|
|
205
241
|
*
|
|
206
242
|
* If you request `bafybeiaysi4s6lnjev27ln5icwm6tueaw2vdykrtjkwiphwekaywqhcjze`, which points to the root of the en.wikipedia.org mirror, a response object does not make sense.
|
|
207
243
|
*
|
|
208
|
-
*
|
|
244
|
+
* ### Errors
|
|
209
245
|
*
|
|
210
246
|
* Known Errors that can be thrown:
|
|
211
247
|
*
|
|
@@ -246,11 +282,34 @@ export interface VerifiedFetch {
|
|
|
246
282
|
}
|
|
247
283
|
|
|
248
284
|
/**
|
|
249
|
-
* Instead of passing a Helia instance, you can pass a list of gateways and
|
|
285
|
+
* Instead of passing a Helia instance, you can pass a list of gateways and
|
|
286
|
+
* routers, and a HeliaHTTP instance will be created for you.
|
|
250
287
|
*/
|
|
251
|
-
export interface
|
|
288
|
+
export interface CreateVerifiedFetchOptions {
|
|
252
289
|
gateways: string[]
|
|
253
290
|
routers?: string[]
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* A function to handle parsing content type from bytes. The function you
|
|
294
|
+
* provide will be passed the first set of bytes we receive from the network,
|
|
295
|
+
* and should return a string that will be used as the value for the
|
|
296
|
+
* `Content-Type` header in the response.
|
|
297
|
+
*/
|
|
298
|
+
contentTypeParser?: ContentTypeParser
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* A ContentTypeParser attempts to return the mime type of a given file. It
|
|
303
|
+
* receives the first chunk of the file data and the file name, if it is
|
|
304
|
+
* available. The function can be sync or async and if it returns/resolves to
|
|
305
|
+
* `undefined`, `application/octet-stream` will be used.
|
|
306
|
+
*/
|
|
307
|
+
export interface ContentTypeParser {
|
|
308
|
+
/**
|
|
309
|
+
* Attempt to determine a mime type, either via of the passed bytes or the
|
|
310
|
+
* filename if it is available.
|
|
311
|
+
*/
|
|
312
|
+
(bytes: Uint8Array, fileName?: string): Promise<string | undefined> | string | undefined
|
|
254
313
|
}
|
|
255
314
|
|
|
256
315
|
export type BubbledProgressEvents =
|
|
@@ -269,8 +328,9 @@ export type VerifiedFetchProgressEvents =
|
|
|
269
328
|
/**
|
|
270
329
|
* Options for the `fetch` function returned by `createVerifiedFetch`.
|
|
271
330
|
*
|
|
272
|
-
* This
|
|
273
|
-
* listen for
|
|
331
|
+
* This interface contains all the same fields as the [options object](https://developer.mozilla.org/en-US/docs/Web/API/fetch#options)
|
|
332
|
+
* passed to `fetch` in browsers, plus an `onProgress` option to listen for
|
|
333
|
+
* progress events.
|
|
274
334
|
*/
|
|
275
335
|
export interface VerifiedFetchInit extends RequestInit, ProgressOptions<BubbledProgressEvents | VerifiedFetchProgressEvents> {
|
|
276
336
|
}
|
|
@@ -278,8 +338,11 @@ export interface VerifiedFetchInit extends RequestInit, ProgressOptions<BubbledP
|
|
|
278
338
|
/**
|
|
279
339
|
* Create and return a Helia node
|
|
280
340
|
*/
|
|
281
|
-
export async function createVerifiedFetch (init?: Helia |
|
|
341
|
+
export async function createVerifiedFetch (init?: Helia | CreateVerifiedFetchOptions): Promise<VerifiedFetch> {
|
|
342
|
+
let contentTypeParser: ContentTypeParser | undefined
|
|
343
|
+
|
|
282
344
|
if (!isHelia(init)) {
|
|
345
|
+
contentTypeParser = init?.contentTypeParser
|
|
283
346
|
init = await createHeliaHTTP({
|
|
284
347
|
blockBrokers: [
|
|
285
348
|
trustlessGateway({
|
|
@@ -290,7 +353,7 @@ export async function createVerifiedFetch (init?: Helia | CreateVerifiedFetchWit
|
|
|
290
353
|
})
|
|
291
354
|
}
|
|
292
355
|
|
|
293
|
-
const verifiedFetchInstance = new VerifiedFetchClass({ helia: init })
|
|
356
|
+
const verifiedFetchInstance = new VerifiedFetchClass({ helia: init }, { contentTypeParser })
|
|
294
357
|
async function verifiedFetch (resource: Resource, options?: VerifiedFetchInit): Promise<Response> {
|
|
295
358
|
return verifiedFetchInstance.fetch(resource, options)
|
|
296
359
|
}
|
|
@@ -300,6 +363,8 @@ export async function createVerifiedFetch (init?: Helia | CreateVerifiedFetchWit
|
|
|
300
363
|
return verifiedFetch
|
|
301
364
|
}
|
|
302
365
|
|
|
366
|
+
export { verifiedFetch } from './singleton.js'
|
|
367
|
+
|
|
303
368
|
function isHelia (obj: any): obj is Helia {
|
|
304
369
|
// test for the presence of known Helia properties, return a boolean value
|
|
305
370
|
return obj?.blockstore != null &&
|