@bsv/sdk 1.4.1 → 1.4.2
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/dist/cjs/package.json +1 -1
- package/dist/cjs/src/storage/StorageDownloader.js +82 -0
- package/dist/cjs/src/storage/StorageDownloader.js.map +1 -0
- package/dist/cjs/src/storage/__test/StorageDownloader.test.js +144 -0
- package/dist/cjs/src/storage/__test/StorageDownloader.test.js.map +1 -0
- package/dist/cjs/src/storage/index.js +3 -1
- package/dist/cjs/src/storage/index.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/storage/StorageDownloader.js +75 -0
- package/dist/esm/src/storage/StorageDownloader.js.map +1 -0
- package/dist/esm/src/storage/__test/StorageDownloader.test.js +139 -0
- package/dist/esm/src/storage/__test/StorageDownloader.test.js.map +1 -0
- package/dist/esm/src/storage/index.js +1 -0
- package/dist/esm/src/storage/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/storage/StorageDownloader.d.ts +25 -0
- package/dist/types/src/storage/StorageDownloader.d.ts.map +1 -0
- package/dist/types/src/storage/__test/StorageDownloader.test.d.ts +2 -0
- package/dist/types/src/storage/__test/StorageDownloader.test.d.ts.map +1 -0
- package/dist/types/src/storage/index.d.ts +1 -0
- package/dist/types/src/storage/index.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/storage.md +51 -0
- package/package.json +1 -1
- package/src/storage/StorageDownloader.ts +91 -0
- package/src/storage/__test/StorageDownloader.test.ts +170 -0
- package/src/storage/index.ts +3 -0
package/dist/cjs/package.json
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StorageDownloader = void 0;
|
|
7
|
+
const index_js_1 = require("../overlay-tools/index.js");
|
|
8
|
+
const index_js_2 = require("./index.js");
|
|
9
|
+
const PushDrop_js_1 = __importDefault(require("../script/templates/PushDrop.js"));
|
|
10
|
+
const Transaction_js_1 = __importDefault(require("../transaction/Transaction.js"));
|
|
11
|
+
const index_js_3 = require("../primitives/index.js");
|
|
12
|
+
/**
|
|
13
|
+
* Locates HTTP URLs where content can be downloaded. It uses the passed or the default one.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} obj All parameters are passed in an object.
|
|
16
|
+
* @param {String} obj.uhrpUrl The UHRP url to resolve.
|
|
17
|
+
* @param {string} obj.confederacyHost HTTPS URL for for the with default setting.
|
|
18
|
+
*
|
|
19
|
+
* @return {Array<String>} An array of HTTP URLs where content can be downloaded.
|
|
20
|
+
* @throws {Error} If UHRP url parameter invalid or is not an array
|
|
21
|
+
* or there is an error retrieving url(s) stored in the UHRP token.
|
|
22
|
+
*/
|
|
23
|
+
class StorageDownloader {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
this.networkPreset = 'mainnet';
|
|
26
|
+
this.networkPreset = config === null || config === void 0 ? void 0 : config.networkPreset;
|
|
27
|
+
}
|
|
28
|
+
async resolve(uhrpUrl) {
|
|
29
|
+
// Use UHRP lookup service
|
|
30
|
+
const lookupResolver = new index_js_1.LookupResolver({ networkPreset: this.networkPreset });
|
|
31
|
+
const response = await lookupResolver.query({ service: 'ls_uhrp', query: { uhrpUrl } });
|
|
32
|
+
if (response.type !== 'output-list') {
|
|
33
|
+
throw new Error('Lookup answer must be an output list');
|
|
34
|
+
}
|
|
35
|
+
const decodedResults = [];
|
|
36
|
+
for (let i = 0; i < response.outputs.length; i++) {
|
|
37
|
+
const tx = Transaction_js_1.default.fromBEEF(response.outputs[i].beef);
|
|
38
|
+
const { fields } = PushDrop_js_1.default.decode(tx.outputs[response.outputs[i].outputIndex].lockingScript);
|
|
39
|
+
decodedResults.push(index_js_3.Utils.toUTF8(fields[2]));
|
|
40
|
+
}
|
|
41
|
+
return decodedResults;
|
|
42
|
+
}
|
|
43
|
+
async download(uhrpUrl) {
|
|
44
|
+
if (!index_js_2.StorageUtils.isValidURL(uhrpUrl)) {
|
|
45
|
+
throw new Error('Invalid parameter UHRP url');
|
|
46
|
+
}
|
|
47
|
+
const hash = index_js_2.StorageUtils.getHashFromURL(uhrpUrl);
|
|
48
|
+
const downloadURLs = await this.resolve(uhrpUrl);
|
|
49
|
+
if (!Array.isArray(downloadURLs) || downloadURLs.length === 0) {
|
|
50
|
+
throw new Error('No one currently hosts this file!');
|
|
51
|
+
}
|
|
52
|
+
for (let i = 0; i < downloadURLs.length; i++) {
|
|
53
|
+
try {
|
|
54
|
+
// The url is fetched
|
|
55
|
+
const result = await fetch(downloadURLs[i], { method: 'GET' });
|
|
56
|
+
// If the request fails, continue to the next url
|
|
57
|
+
if (!result.ok || result.status >= 400) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const body = await result.arrayBuffer();
|
|
61
|
+
// The body is loaded into a number array
|
|
62
|
+
const content = [...new Uint8Array(body)];
|
|
63
|
+
const contentHash = index_js_3.Hash.sha256(content);
|
|
64
|
+
for (let i = 0; i < contentHash.length; ++i) {
|
|
65
|
+
if (contentHash[i] !== hash[i]) {
|
|
66
|
+
throw new Error('Value of content does not match hash of the url given');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
data: content,
|
|
71
|
+
mimeType: result.headers.get('Content-Type')
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
throw new Error(`Unable to download content from ${uhrpUrl}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.StorageDownloader = StorageDownloader;
|
|
82
|
+
//# sourceMappingURL=StorageDownloader.js.map
|
|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3C,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE;wBAC9B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;qBACzE;iBACF;gBAED,OAAO;oBACL,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;iBAC7C,CAAA;aACF;YAAC,OAAO,KAAK,EAAE;gBACd,SAAQ;aACT;SACF;QACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAA;IAC/D,CAAC;CACF;AAhED,8CAgEC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const StorageDownloader_js_1 = require("../StorageDownloader.js");
|
|
7
|
+
const index_js_1 = require("../index.js");
|
|
8
|
+
const index_js_2 = require("../../overlay-tools/index.js");
|
|
9
|
+
const Transaction_js_1 = __importDefault(require("../../transaction/Transaction.js"));
|
|
10
|
+
const PushDrop_js_1 = __importDefault(require("../../script/templates/PushDrop.js"));
|
|
11
|
+
const index_js_3 = require("../../primitives/index.js");
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
jest.restoreAllMocks();
|
|
14
|
+
});
|
|
15
|
+
describe('StorageDownloader', () => {
|
|
16
|
+
let downloader;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
// Create a fresh instance
|
|
19
|
+
downloader = new StorageDownloader_js_1.StorageDownloader();
|
|
20
|
+
});
|
|
21
|
+
describe('resolve()', () => {
|
|
22
|
+
it('throws if the lookup response is not "output-list"', async () => {
|
|
23
|
+
// Mock the LookupResolver to return something invalid
|
|
24
|
+
jest.spyOn(index_js_2.LookupResolver.prototype, 'query').mockResolvedValue({
|
|
25
|
+
type: 'something-else',
|
|
26
|
+
outputs: []
|
|
27
|
+
});
|
|
28
|
+
await expect(downloader.resolve('fakeUhrpUrl'))
|
|
29
|
+
.rejects
|
|
30
|
+
.toThrow('Lookup answer must be an output list');
|
|
31
|
+
});
|
|
32
|
+
it('decodes each output with Transaction.fromBEEF and PushDrop.decode', async () => {
|
|
33
|
+
// 1) Mock lookup response
|
|
34
|
+
jest.spyOn(index_js_2.LookupResolver.prototype, 'query').mockResolvedValue({
|
|
35
|
+
type: 'output-list',
|
|
36
|
+
outputs: [
|
|
37
|
+
{ beef: 'fake-beef-a', outputIndex: 0 },
|
|
38
|
+
{ beef: 'fake-beef-b', outputIndex: 1 }
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
// 2) Mock Transaction.fromBEEF -> returns a dummy transaction
|
|
42
|
+
jest.spyOn(Transaction_js_1.default, 'fromBEEF').mockImplementation(() => {
|
|
43
|
+
// Each transaction might have multiple outputs; we only care about `outputIndex`
|
|
44
|
+
return {
|
|
45
|
+
outputs: [
|
|
46
|
+
{ lockingScript: {} },
|
|
47
|
+
{ lockingScript: {} } // index 1
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
// 3) Mock PushDrop.decode -> returns { fields: number[][] }
|
|
52
|
+
jest.spyOn(PushDrop_js_1.default, 'decode').mockImplementation(() => {
|
|
53
|
+
// The decode function returns an object with `fields`,
|
|
54
|
+
return {
|
|
55
|
+
lockingPublicKey: {},
|
|
56
|
+
fields: [
|
|
57
|
+
[11],
|
|
58
|
+
[22],
|
|
59
|
+
[104, 116, 116, 112, 58, 47, 47, 97, 46, 99, 111, 109]
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
// 4) Mock Utils.toUTF8 to convert that number[] to a string
|
|
64
|
+
jest.spyOn(index_js_3.Utils, 'toUTF8').mockReturnValue('http://a.com');
|
|
65
|
+
const resolved = await downloader.resolve('fakeUhrpUrl');
|
|
66
|
+
expect(resolved).toEqual(['http://a.com', 'http://a.com']);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('download()', () => {
|
|
70
|
+
it('throws if UHRP URL is invalid', async () => {
|
|
71
|
+
jest.spyOn(index_js_1.StorageUtils, 'isValidURL').mockReturnValue(false);
|
|
72
|
+
await expect(downloader.download('invalidUrl'))
|
|
73
|
+
.rejects
|
|
74
|
+
.toThrow('Invalid parameter UHRP url');
|
|
75
|
+
});
|
|
76
|
+
it('throws if no hosts are found', async () => {
|
|
77
|
+
// Valid UHRP URL
|
|
78
|
+
jest.spyOn(index_js_1.StorageUtils, 'isValidURL').mockReturnValue(true);
|
|
79
|
+
// Return some random 32-byte hash so we can pass the check
|
|
80
|
+
jest.spyOn(index_js_1.StorageUtils, 'getHashFromURL').mockReturnValue(new Array(32).fill(0));
|
|
81
|
+
// Force resolve() to return an empty array
|
|
82
|
+
jest.spyOn(downloader, 'resolve').mockResolvedValue([]);
|
|
83
|
+
await expect(downloader.download('validButUnhostedUrl'))
|
|
84
|
+
.rejects
|
|
85
|
+
.toThrow('No one currently hosts this file!');
|
|
86
|
+
});
|
|
87
|
+
it('downloads successfully from the first working host', async () => {
|
|
88
|
+
jest.spyOn(index_js_1.StorageUtils, 'isValidURL').mockReturnValue(true);
|
|
89
|
+
const knownHash = [
|
|
90
|
+
102, 104, 122, 173, 248, 98, 189, 119, 108, 143,
|
|
91
|
+
193, 139, 142, 159, 142, 32, 8, 151, 20, 133,
|
|
92
|
+
110, 226, 51, 179, 144, 42, 89, 29, 13, 95,
|
|
93
|
+
41, 37
|
|
94
|
+
];
|
|
95
|
+
jest.spyOn(index_js_1.StorageUtils, 'getHashFromURL').mockReturnValue(knownHash);
|
|
96
|
+
// Suppose two possible download URLs
|
|
97
|
+
jest.spyOn(downloader, 'resolve').mockResolvedValue([
|
|
98
|
+
'http://host1/404',
|
|
99
|
+
'http://host2/ok'
|
|
100
|
+
]);
|
|
101
|
+
// The first fetch -> 404, second fetch -> success
|
|
102
|
+
const fetchSpy = jest.spyOn(global, 'fetch')
|
|
103
|
+
.mockResolvedValueOnce(new Response(null, { status: 404 }))
|
|
104
|
+
.mockResolvedValueOnce(new Response(new Uint8Array(32).fill(0), {
|
|
105
|
+
status: 200,
|
|
106
|
+
headers: { 'Content-Type': 'application/test' }
|
|
107
|
+
}));
|
|
108
|
+
const result = await downloader.download('validUrl');
|
|
109
|
+
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
|
110
|
+
expect(result).toEqual({
|
|
111
|
+
data: new Array(32).fill(0),
|
|
112
|
+
mimeType: 'application/test'
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
it('throws if content hash mismatches the UHRP hash', async () => {
|
|
116
|
+
jest.spyOn(index_js_1.StorageUtils, 'isValidURL').mockReturnValue(true);
|
|
117
|
+
// The expected hash is all zeros
|
|
118
|
+
jest.spyOn(index_js_1.StorageUtils, 'getHashFromURL').mockReturnValue(new Array(32).fill(0));
|
|
119
|
+
// One potential host
|
|
120
|
+
jest.spyOn(downloader, 'resolve').mockResolvedValue([
|
|
121
|
+
'http://bad-content.test'
|
|
122
|
+
]);
|
|
123
|
+
// The fetch returns 32 bytes of all 1's => hash mismatch
|
|
124
|
+
jest.spyOn(global, 'fetch').mockResolvedValue(new Response(new Uint8Array(32).fill(1), { status: 200 }));
|
|
125
|
+
await expect(downloader.download('validButBadHashUrl'))
|
|
126
|
+
.rejects
|
|
127
|
+
.toThrow();
|
|
128
|
+
});
|
|
129
|
+
it('throws if all hosts fail or mismatch', async () => {
|
|
130
|
+
jest.spyOn(index_js_1.StorageUtils, 'isValidURL').mockReturnValue(true);
|
|
131
|
+
jest.spyOn(index_js_1.StorageUtils, 'getHashFromURL').mockReturnValue(new Array(32).fill(0));
|
|
132
|
+
jest.spyOn(downloader, 'resolve').mockResolvedValue([
|
|
133
|
+
'http://host1.test',
|
|
134
|
+
'http://host2.test'
|
|
135
|
+
]);
|
|
136
|
+
// Both fetches fail with 500 or something >=400
|
|
137
|
+
jest.spyOn(global, 'fetch').mockResolvedValue(new Response(null, { status: 500 }));
|
|
138
|
+
await expect(downloader.download('validButNoGoodHostUrl'))
|
|
139
|
+
.rejects
|
|
140
|
+
.toThrow('Unable to download content from validButNoGoodHostUrl');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=StorageDownloader.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StorageDownloader.test.js","sourceRoot":"","sources":["../../../../../src/storage/__test/StorageDownloader.test.ts"],"names":[],"mappings":";;;;;AAAA,kEAA2D;AAC3D,0CAA0C;AAC1C,2DAA6D;AAC7D,sFAA0D;AAC1D,qFAAyD;AAEzD,wDAAiD;AAEjD,UAAU,CAAC,GAAG,EAAE;IACZ,IAAI,CAAC,eAAe,EAAE,CAAA;AAC1B,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAC/B,IAAI,UAA6B,CAAA;IAEjC,UAAU,CAAC,GAAG,EAAE;QACZ,0BAA0B;QAC1B,UAAU,GAAG,IAAI,wCAAiB,EAAE,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACvB,EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;YAChE,sDAAsD;YACtD,IAAI,CAAC,KAAK,CAAC,yBAAc,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,iBAAiB,CAAC;gBAC5D,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,EAAE;aACP,CAAC,CAAA;YAET,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;iBAC1C,OAAO;iBACP,OAAO,CAAC,sCAAsC,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,mEAAmE,EAAE,KAAK,IAAI,EAAE;YAC/E,0BAA0B;Y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;gBACnB,mBAAmB;aACtB,CAAC,CAAA;YAEF,gDAAgD;YAChD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,iBAAiB,CACzC,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CACtC,CAAA;YAED,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;iBACrD,OAAO;iBACP,OAAO,CAAC,uDAAuD,CAAC,CAAA;QACzE,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
|
|
@@ -23,8 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.StorageUploader = exports.StorageUtils = void 0;
|
|
26
|
+
exports.StorageDownloader = exports.StorageUploader = exports.StorageUtils = void 0;
|
|
27
27
|
exports.StorageUtils = __importStar(require("./StorageUtils.js"));
|
|
28
28
|
var StorageUploader_js_1 = require("./StorageUploader.js");
|
|
29
29
|
Object.defineProperty(exports, "StorageUploader", { enumerable: true, get: function () { return StorageUploader_js_1.StorageUploader; } });
|
|
30
|
+
var StorageDownloader_js_1 = require("./StorageDownloader.js");
|
|
31
|
+
Object.defineProperty(exports, "StorageDownloader", { enumerable: true, get: function () { return StorageDownloader_js_1.StorageDownloader; } });
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAiD;AAEjD,2DAAsD;AAA7C,qHAAA,eAAe,OAAA;AAExB,+DAA0D;AAAjD,yHAAA,iBAAiB,OAAA"}
|