@helia/interop 5.0.0-754c7af → 5.0.0-77e34fc

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 CHANGED
@@ -4,6 +4,8 @@
4
4
  </a>
5
5
  </p>
6
6
 
7
+ # @helia/interop
8
+
7
9
  [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
8
10
  [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
9
11
  [![codecov](https://img.shields.io/codecov/c/github/ipfs/helia.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/interop",
3
- "version": "5.0.0-754c7af",
3
+ "version": "5.0.0-77e34fc",
4
4
  "description": "Interop tests for Helia",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/main/packages/interop#readme",
@@ -58,30 +58,29 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@chainsafe/libp2p-gossipsub": "^12.0.0",
61
- "@helia/block-brokers": "2.0.1-754c7af",
62
- "@helia/car": "3.0.0-754c7af",
63
- "@helia/dag-cbor": "3.0.0-754c7af",
64
- "@helia/dag-json": "3.0.0-754c7af",
65
- "@helia/http": "1.0.1-754c7af",
66
- "@helia/interface": "4.0.0-754c7af",
67
- "@helia/ipns": "6.0.0-754c7af",
68
- "@helia/json": "3.0.0-754c7af",
69
- "@helia/mfs": "3.0.0-754c7af",
70
- "@helia/routers": "1.0.0-754c7af",
71
- "@helia/strings": "3.0.0-754c7af",
72
- "@helia/unixfs": "3.0.0-754c7af",
73
- "@helia/verified-fetch": "0.0.0-754c7af",
74
- "@ipld/car": "^5.2.6",
75
- "@ipld/dag-cbor": "^9.1.0",
76
- "@libp2p/interface": "^1.1.2",
77
- "@libp2p/kad-dht": "^12.0.5",
78
- "@libp2p/keychain": "^4.0.7",
79
- "@libp2p/peer-id": "^4.0.5",
80
- "@libp2p/peer-id-factory": "^4.0.5",
81
- "@libp2p/websockets": "^8.0.13",
61
+ "@helia/block-brokers": "2.0.1-77e34fc",
62
+ "@helia/car": "3.0.0-77e34fc",
63
+ "@helia/dag-cbor": "3.0.0-77e34fc",
64
+ "@helia/dag-json": "3.0.0-77e34fc",
65
+ "@helia/http": "1.0.1-77e34fc",
66
+ "@helia/interface": "4.0.0-77e34fc",
67
+ "@helia/ipns": "6.0.0-77e34fc",
68
+ "@helia/json": "3.0.0-77e34fc",
69
+ "@helia/mfs": "3.0.0-77e34fc",
70
+ "@helia/routers": "1.0.0-77e34fc",
71
+ "@helia/strings": "3.0.0-77e34fc",
72
+ "@helia/unixfs": "3.0.0-77e34fc",
73
+ "@ipld/car": "^5.3.0",
74
+ "@ipld/dag-cbor": "^9.2.0",
75
+ "@libp2p/interface": "^1.1.3",
76
+ "@libp2p/kad-dht": "^12.0.7",
77
+ "@libp2p/keychain": "^4.0.8",
78
+ "@libp2p/peer-id": "^4.0.6",
79
+ "@libp2p/peer-id-factory": "^4.0.6",
80
+ "@libp2p/websockets": "^8.0.15",
82
81
  "@multiformats/sha3": "^3.0.2",
83
- "aegir": "^42.2.2",
84
- "helia": "4.0.1-754c7af",
82
+ "aegir": "^42.2.5",
83
+ "helia": "4.0.1-77e34fc",
85
84
  "ipfs-core-types": "^0.14.1",
86
85
  "ipfs-unixfs-importer": "^15.2.4",
87
86
  "ipfsd-ctl": "^13.0.0",
@@ -91,12 +90,11 @@
91
90
  "it-map": "^3.0.5",
92
91
  "it-to-buffer": "^4.0.5",
93
92
  "kubo": "^0.26.0",
94
- "kubo-rpc-client": "^3.0.2",
95
- "libp2p": "^1.2.1",
96
- "magic-bytes.js": "^1.8.0",
97
- "multiformats": "^13.0.1",
93
+ "kubo-rpc-client": "^3.0.3",
94
+ "libp2p": "^1.2.3",
95
+ "multiformats": "^13.1.0",
98
96
  "p-defer": "^4.0.0",
99
- "uint8arrays": "^5.0.1",
97
+ "uint8arrays": "^5.0.2",
100
98
  "wherearewe": "^2.0.1"
101
99
  },
102
100
  "browser": {
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=verified-fetch-json.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verified-fetch-json.spec.d.ts","sourceRoot":"","sources":["../../src/verified-fetch-json.spec.ts"],"names":[],"mappings":""}
@@ -1,43 +0,0 @@
1
- /* eslint-env mocha */
2
- import { createVerifiedFetch } from '@helia/verified-fetch';
3
- import { expect } from 'aegir/chai';
4
- import { CID } from 'multiformats/cid';
5
- import { createKuboNode } from './fixtures/create-kubo.js';
6
- import { loadFixtureDataCar } from './fixtures/load-fixture-data.js';
7
- describe('@helia/verified-fetch - json', () => {
8
- describe('unixfs - multiblock', () => {
9
- let controller;
10
- let verifiedFetch;
11
- before(async () => {
12
- controller = await createKuboNode();
13
- await controller.start();
14
- // As of 2024-01-18, https://cloudflare-ipfs.com/ipns/tokens.uniswap.org resolves to:
15
- // root: QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr
16
- // child1: QmNik5N4ryNwzzXYq5hCYKGcRjAf9QtigxtiJh9o8aXXbG // partial JSON
17
- // child2: QmWNBJX6fZyNTLWNYBHxAHpBctCP43R2zeqV2G8uavqFZn // partial JSON
18
- await loadFixtureDataCar(controller, 'QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr-tokens.uniswap.org-2024-01-18.car');
19
- verifiedFetch = await createVerifiedFetch({
20
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
21
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
22
- });
23
- });
24
- after(async () => {
25
- await controller.stop();
26
- await verifiedFetch.stop();
27
- });
28
- it('handles UnixFS-chunked JSON file', async () => {
29
- const resp = await verifiedFetch(CID.parse('QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr'));
30
- expect(resp).to.be.ok();
31
- const jsonObj = await resp.json();
32
- expect(jsonObj).to.be.ok();
33
- expect(jsonObj).to.have.property('name').equal('Uniswap Labs Default');
34
- expect(jsonObj).to.have.property('timestamp').equal('2023-12-13T18:25:25.830Z');
35
- expect(jsonObj).to.have.property('version').to.deep.equal({ major: 11, minor: 11, patch: 0 });
36
- expect(jsonObj).to.have.property('tags');
37
- expect(jsonObj).to.have.property('logoURI').equal('ipfs://QmNa8mQkrNKp1WEEeGjFezDmDeodkWRevGFN8JCV7b4Xir');
38
- expect(jsonObj).to.have.property('keywords').to.deep.equal(['uniswap', 'default']);
39
- expect(jsonObj.tokens).to.be.an('array').of.length(767);
40
- });
41
- });
42
- });
43
- //# sourceMappingURL=verified-fetch-json.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verified-fetch-json.spec.js","sourceRoot":"","sources":["../../src/verified-fetch-json.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,IAAI,UAA4B,CAAA;QAChC,IAAI,aAA8D,CAAA;QAElE,MAAM,CAAC,KAAK,IAAI,EAAE;YAChB,UAAU,GAAG,MAAM,cAAc,EAAE,CAAA;YACnC,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;YACxB,qFAAqF;YACrF,uDAAuD;YACvD,yEAAyE;YACzE,yEAAyE;YACzE,MAAM,kBAAkB,CAAC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AE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAA;YAC7F,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;YACxC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;YAC1G,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;YAClF,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACzD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=verified-fetch-unixfs-dir.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verified-fetch-unixfs-dir.spec.d.ts","sourceRoot":"","sources":["../../src/verified-fetch-unixfs-dir.spec.ts"],"names":[],"mappings":""}
@@ -1,82 +0,0 @@
1
- /* eslint-env mocha */
2
- import { createVerifiedFetch } from '@helia/verified-fetch';
3
- import { expect } from 'aegir/chai';
4
- import { filetypemime } from 'magic-bytes.js';
5
- import { createKuboNode } from './fixtures/create-kubo.js';
6
- import { loadFixtureDataCar } from './fixtures/load-fixture-data.js';
7
- describe('@helia/verified-fetch - unixfs directory', () => {
8
- let controller;
9
- let verifiedFetch;
10
- before(async () => {
11
- controller = await createKuboNode();
12
- await controller.start();
13
- verifiedFetch = await createVerifiedFetch({
14
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
15
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
16
- });
17
- });
18
- after(async () => {
19
- await controller.stop();
20
- await verifiedFetch.stop();
21
- });
22
- describe('XKCD Barrel Part 1', () => {
23
- before(async () => {
24
- // This is the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
25
- await loadFixtureDataCar(controller, 'QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR-xkcd-Barrel-part-1.car');
26
- });
27
- it('fails to load when passed the root', async () => {
28
- // The spec says we should generate HTML with directory listings, but we don't do that yet, so expect a failure
29
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR');
30
- expect(resp).to.be.ok();
31
- expect(resp.status).to.equal(501); // TODO: we should do a directory listing instead
32
- });
33
- it('can return a string for unixfs pathed data', async () => {
34
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1 - alt.txt');
35
- expect(resp).to.be.ok();
36
- const text = await resp.text();
37
- expect(text).to.equal('Don\'t we all.');
38
- });
39
- it('can return an image for unixfs pathed data', async () => {
40
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png');
41
- expect(resp).to.be.ok();
42
- const imgData = await resp.blob();
43
- expect(imgData).to.be.ok();
44
- expect(imgData.size).to.equal(24848);
45
- });
46
- });
47
- describe('content type parser', () => {
48
- before(async () => {
49
- await verifiedFetch.stop();
50
- verifiedFetch = await createVerifiedFetch({
51
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
52
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
53
- }, {
54
- contentTypeParser: (bytes) => {
55
- return filetypemime(bytes)?.[0];
56
- }
57
- });
58
- });
59
- it('can return an image content-type for unixfs pathed data', async () => {
60
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png');
61
- // tediously this is actually a jpeg file with a .png extension
62
- expect(resp.headers.get('content-type')).to.equal('image/jpeg');
63
- });
64
- });
65
- // TODO: find a smaller car file so the test doesn't timeout locally or flake on CI
66
- describe.skip('HAMT-sharded directory', () => {
67
- before(async () => {
68
- // from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
69
- await loadFixtureDataCar(controller, 'bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i-single-layer-hamt-with-multi-block-files.car');
70
- });
71
- it('loads path /ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', async () => {
72
- const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt');
73
- expect(resp).to.be.ok();
74
- const text = await resp.text();
75
- // npx kubo@0.25.0 cat '/ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
76
- expect(text).to.equal(`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non imperdiet nunc. Proin ac quam ut nibh eleifend aliquet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Sed ligula dolor, imperdiet sagittis arcu et, semper tincidunt urna. Donec et tempor augue, quis sollicitudin metus. Curabitur semper ullamcorper aliquet. Mauris hendrerit sodales lectus eget fermentum. Proin sollicitudin vestibulum commodo. Vivamus nec lectus eu augue aliquet dignissim nec condimentum justo. In hac habitasse platea dictumst. Mauris vel sem neque.
77
-
78
- Vivamus finibus, enim at lacinia semper, arcu erat gravida lacus, sit amet gravida magna orci sit amet est. Sed non leo lacus. Nullam viverra ipsum a tincidunt dapibus. Nulla pulvinar ligula sit amet ante ultrices tempus. Proin purus urna, semper sed lobortis quis, gravida vitae ipsum. Aliquam mi urna, pulvinar eu bibendum quis, convallis ac dolor. In gravida justo sed risus ullamcorper, vitae luctus massa hendrerit. Pellentesque habitant amet.`);
79
- });
80
- });
81
- });
82
- //# sourceMappingURL=verified-fetch-unixfs-dir.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verified-fetch-unixfs-dir.spec.js","sourceRoot":"","sources":["../../src/verified-fetch-unixfs-dir.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAIpE,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACxD,IAAI,UAAsB,CAAA;IAC1B,IAAI,aAA4B,CAAA;IAEhC,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,UAAU,GAAG,MAAM,cAAc,EAAE,CAAA;QACnC,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;QAExB,aAAa,GAAG,MAAM,mBAAmB,CAAC;YACxC,QAAQ,EAAE,CAAC,UAAU,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YAChF,OAAO,EAAE,CAAC,UAAU,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;SAChF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,KAA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YAC7K,MAAM,kBAAkB,CAAC,UAAU,EAAE,0GAA0G,CAAC,CAAA;QAClJ,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,sFAAsF,EAAE,KAAK,IAAI,EAAE;YACpG,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,4EAA4E,CAAC,CAAA;YAC9G,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAA;YACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;YAC9B,kGAAkG;YAClG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;;icAEqa,CAAC,CAAA;QAC9b,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=verified-fetch-websites.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verified-fetch-websites.spec.d.ts","sourceRoot":"","sources":["../../src/verified-fetch-websites.spec.ts"],"names":[],"mappings":""}
@@ -1,76 +0,0 @@
1
- /* eslint-env mocha */
2
- import { createVerifiedFetch } from '@helia/verified-fetch';
3
- import { expect } from 'aegir/chai';
4
- import { createKuboNode } from './fixtures/create-kubo.js';
5
- import { loadFixtureDataCar } from './fixtures/load-fixture-data.js';
6
- describe('@helia/verified-fetch - websites', () => {
7
- describe('helia-identify.on.fleek.co', () => {
8
- let controller;
9
- let verifiedFetch;
10
- before(async () => {
11
- controller = await createKuboNode();
12
- await controller.start();
13
- // 2024-01-22 CID for _dnslink.helia-identify.on.fleek.co
14
- await loadFixtureDataCar(controller, 'QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv-helia-identify-website.car');
15
- verifiedFetch = await createVerifiedFetch({
16
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
17
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
18
- });
19
- });
20
- after(async () => {
21
- await controller.stop();
22
- await verifiedFetch.stop();
23
- });
24
- it('loads index.html when passed helia-identify.on.fleek.co root CID', async () => {
25
- const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv');
26
- expect(resp).to.be.ok();
27
- const html = await resp.text();
28
- expect(html).to.be.ok();
29
- expect(html).to.include('<title>Run Identify on a remote node with Helia</title>');
30
- });
31
- it('loads helia-identify.on.fleek.co index.html directly ', async () => {
32
- const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html');
33
- expect(resp).to.be.ok();
34
- const html = await resp.text();
35
- expect(html).to.be.ok();
36
- expect(html).to.include('<title>Run Identify on a remote node with Helia</title>');
37
- });
38
- });
39
- /**
40
- *
41
- * Created on 2024-01-23. /ipns/blog.libp2p.io/index.html resolved to QmVZNGy6SPvUbvQCXXaGDdp8kvfJm9MMozjU12dyzH6hKf
42
- *
43
- * ```shell
44
- * mkdir fake-blog.libp2p.io
45
- * npx kubo@0.25.0 cat '/ipfs/QmVZNGy6SPvUbvQCXXaGDdp8kvfJm9MMozjU12dyzH6hKf' > fake-blog.libp2p.io/index.html
46
- * npx kubo@0.25.0 add -r fake-blog.libp2p.io
47
- * npx kubo@0.25.0 dag export QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw > QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw-fake-blog.libp2p.io.car
48
- * ```
49
- */
50
- describe('fake blog.libp2p.io', () => {
51
- let controller;
52
- let verifiedFetch;
53
- before(async () => {
54
- controller = await createKuboNode();
55
- await controller.start();
56
- await loadFixtureDataCar(controller, 'QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw-fake-blog.libp2p.io.car');
57
- verifiedFetch = await createVerifiedFetch({
58
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
59
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
60
- });
61
- });
62
- after(async () => {
63
- await controller.stop();
64
- await verifiedFetch.stop();
65
- });
66
- it('loads index.html when passed fake-blog.libp2p.io root CID', async () => {
67
- const resp = await verifiedFetch('ipfs://QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw');
68
- expect(resp).to.be.ok();
69
- const html = await resp.text();
70
- expect(html).to.be.ok();
71
- expect(html).to.include('<title>Home | libp2p Blog &#x26; News</title>');
72
- expect(html).to.include('<link href="https://libp2p.io/" rel="canonical">');
73
- });
74
- });
75
- });
76
- //# sourceMappingURL=verified-fetch-websites.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verified-fetch-websites.spec.js","sourceRoot":"","sources":["../../src/verified-fetch-websites.spec.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAGpE,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC1C,IAAI,UAA4B,CAAA;QAChC,IAAI,aAA8D,CAAA;QAElE,MAAM,CAAC,KAAK,IAAI,EAAE;YAChB,UAAU,GAAG,MAAM,cAAc,EAAE,CAAA;YACnC,MAAM,UAAU,CAAC,KAAK,EAAE,CAAA;YACxB,yDAAyD;YACzD,MAAM,kBAAkB,CAAC,UAAU,EAAE,2EAA2E,CAAC,CAAA;YACjH,aAAa,GAAG,MAAM,mBAAmB,CAAC;gBACxC,QAAQ,EAAE,CAAC,UAAU,UAAU,CAAC,GAAG,CAAC,WAAW,IAAI,UAAU,CAA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E,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,47 +0,0 @@
1
- /* eslint-env mocha */
2
- import { createVerifiedFetch } from '@helia/verified-fetch'
3
- import { expect } from 'aegir/chai'
4
- import { CID } from 'multiformats/cid'
5
- import { createKuboNode } from './fixtures/create-kubo.js'
6
- import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
7
- import type { Controller } from 'ipfsd-ctl'
8
-
9
- describe('@helia/verified-fetch - json', () => {
10
- describe('unixfs - multiblock', () => {
11
- let controller: Controller<'go'>
12
- let verifiedFetch: Awaited<ReturnType<typeof createVerifiedFetch>>
13
-
14
- before(async () => {
15
- controller = await createKuboNode()
16
- await controller.start()
17
- // As of 2024-01-18, https://cloudflare-ipfs.com/ipns/tokens.uniswap.org resolves to:
18
- // root: QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr
19
- // child1: QmNik5N4ryNwzzXYq5hCYKGcRjAf9QtigxtiJh9o8aXXbG // partial JSON
20
- // child2: QmWNBJX6fZyNTLWNYBHxAHpBctCP43R2zeqV2G8uavqFZn // partial JSON
21
- await loadFixtureDataCar(controller, 'QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr-tokens.uniswap.org-2024-01-18.car')
22
- verifiedFetch = await createVerifiedFetch({
23
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
24
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
25
- })
26
- })
27
-
28
- after(async () => {
29
- await controller.stop()
30
- await verifiedFetch.stop()
31
- })
32
-
33
- it('handles UnixFS-chunked JSON file', async () => {
34
- const resp = await verifiedFetch(CID.parse('QmQJ8fxavY54CUsxMSx9aE9Rdcmvhx8awJK2jzJp4iAqCr'))
35
- expect(resp).to.be.ok()
36
- const jsonObj = await resp.json()
37
- expect(jsonObj).to.be.ok()
38
- expect(jsonObj).to.have.property('name').equal('Uniswap Labs Default')
39
- expect(jsonObj).to.have.property('timestamp').equal('2023-12-13T18:25:25.830Z')
40
- expect(jsonObj).to.have.property('version').to.deep.equal({ major: 11, minor: 11, patch: 0 })
41
- expect(jsonObj).to.have.property('tags')
42
- expect(jsonObj).to.have.property('logoURI').equal('ipfs://QmNa8mQkrNKp1WEEeGjFezDmDeodkWRevGFN8JCV7b4Xir')
43
- expect(jsonObj).to.have.property('keywords').to.deep.equal(['uniswap', 'default'])
44
- expect(jsonObj.tokens).to.be.an('array').of.length(767)
45
- })
46
- })
47
- })
@@ -1,95 +0,0 @@
1
- /* eslint-env mocha */
2
- import { createVerifiedFetch } from '@helia/verified-fetch'
3
- import { expect } from 'aegir/chai'
4
- import { filetypemime } from 'magic-bytes.js'
5
- import { createKuboNode } from './fixtures/create-kubo.js'
6
- import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
7
- import type { VerifiedFetch } from '@helia/verified-fetch'
8
- import type { Controller } from 'ipfsd-ctl'
9
-
10
- describe('@helia/verified-fetch - unixfs directory', () => {
11
- let controller: Controller
12
- let verifiedFetch: VerifiedFetch
13
-
14
- before(async () => {
15
- controller = await createKuboNode()
16
- await controller.start()
17
-
18
- verifiedFetch = await createVerifiedFetch({
19
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
20
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
21
- })
22
- })
23
-
24
- after(async () => {
25
- await controller.stop()
26
- await verifiedFetch.stop()
27
- })
28
-
29
- describe('XKCD Barrel Part 1', () => {
30
- before(async () => {
31
- // This is the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
32
- await loadFixtureDataCar(controller, 'QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR-xkcd-Barrel-part-1.car')
33
- })
34
-
35
- it('fails to load when passed the root', async () => {
36
- // The spec says we should generate HTML with directory listings, but we don't do that yet, so expect a failure
37
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR')
38
- expect(resp).to.be.ok()
39
- expect(resp.status).to.equal(501) // TODO: we should do a directory listing instead
40
- })
41
-
42
- it('can return a string for unixfs pathed data', async () => {
43
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1 - alt.txt')
44
- expect(resp).to.be.ok()
45
- const text = await resp.text()
46
- expect(text).to.equal('Don\'t we all.')
47
- })
48
-
49
- it('can return an image for unixfs pathed data', async () => {
50
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png')
51
- expect(resp).to.be.ok()
52
- const imgData = await resp.blob()
53
- expect(imgData).to.be.ok()
54
- expect(imgData.size).to.equal(24848)
55
- })
56
- })
57
-
58
- describe('content type parser', () => {
59
- before(async () => {
60
- await verifiedFetch.stop()
61
- verifiedFetch = await createVerifiedFetch({
62
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
63
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
64
- }, {
65
- contentTypeParser: (bytes) => {
66
- return filetypemime(bytes)?.[0]
67
- }
68
- })
69
- })
70
-
71
- it('can return an image content-type for unixfs pathed data', async () => {
72
- const resp = await verifiedFetch('ipfs://QmbQDovX7wRe9ek7u6QXe9zgCXkTzoUSsTFJEkrYV1HrVR/1 - Barrel - Part 1.png')
73
- // tediously this is actually a jpeg file with a .png extension
74
- expect(resp.headers.get('content-type')).to.equal('image/jpeg')
75
- })
76
- })
77
-
78
- // TODO: find a smaller car file so the test doesn't timeout locally or flake on CI
79
- describe.skip('HAMT-sharded directory', () => {
80
- before(async () => {
81
- // from https://github.com/ipfs/gateway-conformance/blob/193833b91f2e9b17daf45c84afaeeae61d9d7c7e/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car
82
- await loadFixtureDataCar(controller, 'bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i-single-layer-hamt-with-multi-block-files.car')
83
- })
84
-
85
- it('loads path /ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt', async () => {
86
- const resp = await verifiedFetch('ipfs://bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt')
87
- expect(resp).to.be.ok()
88
- const text = await resp.text()
89
- // npx kubo@0.25.0 cat '/ipfs/bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i/685.txt'
90
- expect(text).to.equal(`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc non imperdiet nunc. Proin ac quam ut nibh eleifend aliquet. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Sed ligula dolor, imperdiet sagittis arcu et, semper tincidunt urna. Donec et tempor augue, quis sollicitudin metus. Curabitur semper ullamcorper aliquet. Mauris hendrerit sodales lectus eget fermentum. Proin sollicitudin vestibulum commodo. Vivamus nec lectus eu augue aliquet dignissim nec condimentum justo. In hac habitasse platea dictumst. Mauris vel sem neque.
91
-
92
- Vivamus finibus, enim at lacinia semper, arcu erat gravida lacus, sit amet gravida magna orci sit amet est. Sed non leo lacus. Nullam viverra ipsum a tincidunt dapibus. Nulla pulvinar ligula sit amet ante ultrices tempus. Proin purus urna, semper sed lobortis quis, gravida vitae ipsum. Aliquam mi urna, pulvinar eu bibendum quis, convallis ac dolor. In gravida justo sed risus ullamcorper, vitae luctus massa hendrerit. Pellentesque habitant amet.`)
93
- })
94
- })
95
- })
@@ -1,85 +0,0 @@
1
- /* eslint-env mocha */
2
- import { createVerifiedFetch } from '@helia/verified-fetch'
3
- import { expect } from 'aegir/chai'
4
- import { createKuboNode } from './fixtures/create-kubo.js'
5
- import { loadFixtureDataCar } from './fixtures/load-fixture-data.js'
6
- import type { Controller } from 'ipfsd-ctl'
7
-
8
- describe('@helia/verified-fetch - websites', () => {
9
- describe('helia-identify.on.fleek.co', () => {
10
- let controller: Controller<'go'>
11
- let verifiedFetch: Awaited<ReturnType<typeof createVerifiedFetch>>
12
-
13
- before(async () => {
14
- controller = await createKuboNode()
15
- await controller.start()
16
- // 2024-01-22 CID for _dnslink.helia-identify.on.fleek.co
17
- await loadFixtureDataCar(controller, 'QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv-helia-identify-website.car')
18
- verifiedFetch = await createVerifiedFetch({
19
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
20
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
21
- })
22
- })
23
-
24
- after(async () => {
25
- await controller.stop()
26
- await verifiedFetch.stop()
27
- })
28
-
29
- it('loads index.html when passed helia-identify.on.fleek.co root CID', async () => {
30
- const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv')
31
- expect(resp).to.be.ok()
32
- const html = await resp.text()
33
- expect(html).to.be.ok()
34
- expect(html).to.include('<title>Run Identify on a remote node with Helia</title>')
35
- })
36
-
37
- it('loads helia-identify.on.fleek.co index.html directly ', async () => {
38
- const resp = await verifiedFetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html')
39
- expect(resp).to.be.ok()
40
- const html = await resp.text()
41
- expect(html).to.be.ok()
42
- expect(html).to.include('<title>Run Identify on a remote node with Helia</title>')
43
- })
44
- })
45
-
46
- /**
47
- *
48
- * Created on 2024-01-23. /ipns/blog.libp2p.io/index.html resolved to QmVZNGy6SPvUbvQCXXaGDdp8kvfJm9MMozjU12dyzH6hKf
49
- *
50
- * ```shell
51
- * mkdir fake-blog.libp2p.io
52
- * npx kubo@0.25.0 cat '/ipfs/QmVZNGy6SPvUbvQCXXaGDdp8kvfJm9MMozjU12dyzH6hKf' > fake-blog.libp2p.io/index.html
53
- * npx kubo@0.25.0 add -r fake-blog.libp2p.io
54
- * npx kubo@0.25.0 dag export QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw > QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw-fake-blog.libp2p.io.car
55
- * ```
56
- */
57
- describe('fake blog.libp2p.io', () => {
58
- let controller: Controller<'go'>
59
- let verifiedFetch: Awaited<ReturnType<typeof createVerifiedFetch>>
60
-
61
- before(async () => {
62
- controller = await createKuboNode()
63
- await controller.start()
64
- await loadFixtureDataCar(controller, 'QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw-fake-blog.libp2p.io.car')
65
- verifiedFetch = await createVerifiedFetch({
66
- gateways: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`],
67
- routers: [`http://${controller.api.gatewayHost}:${controller.api.gatewayPort}`]
68
- })
69
- })
70
-
71
- after(async () => {
72
- await controller.stop()
73
- await verifiedFetch.stop()
74
- })
75
-
76
- it('loads index.html when passed fake-blog.libp2p.io root CID', async () => {
77
- const resp = await verifiedFetch('ipfs://QmeiDMLtPUS3RT2xAcUwsNyZz169wPke2q7im9vZpVLSYw')
78
- expect(resp).to.be.ok()
79
- const html = await resp.text()
80
- expect(html).to.be.ok()
81
- expect(html).to.include('<title>Home | libp2p Blog &#x26; News</title>')
82
- expect(html).to.include('<link href="https://libp2p.io/" rel="canonical">')
83
- })
84
- })
85
- })