hash improvement
This commit is contained in:
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var chunkPAKJNZBJ_cjs = require('./chunk-PAKJNZBJ.cjs');
|
|
||||||
var stream = require('stream');
|
|
||||||
var digest = require('multiformats/hashes/digest');
|
|
||||||
var cid = require('multiformats/cid');
|
|
||||||
var crypto = require('crypto');
|
|
||||||
var u = require('crc-32');
|
|
||||||
|
|
||||||
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
||||||
|
|
||||||
var u__default = /*#__PURE__*/_interopDefault(u);
|
|
||||||
|
|
||||||
var c=class{_crc=void 0;update(e){return this._crc=u__default.default.buf(e,this._crc),this}digest(){let e=Buffer.alloc(4);return e.writeInt32BE(this._crc,0),e}};var i={cid_crc32:306,cid_md5:213,cid_sha1:17,"cid_sha2-256":18,"cid_sha3-256":22,"cid_sha3-384":21};function m(r){switch(r){case"cid_sha2-256":return crypto.createHash("sha256");case"cid_sha1":return crypto.createHash("sha1");case"cid_md5":return crypto.createHash("md5");case"cid_sha3-256":return crypto.createHash("sha3-256");case"cid_sha3-384":return crypto.createHash("sha3-384");case"cid_crc32":return new c;default:throw new Error(`Unsupported algorithm: ${r}`)}}async function L({stream:r,algorithms:e}){let a=_(e);if(r instanceof stream.Readable)for await(let t of r)a.forEach(s=>s.hasher.update(t));else {let t=r.getReader();for(;;){let{done:s,value:n}=await t.read();if(s)break;a.forEach(f=>f.hasher.update(Buffer.from(n)));}}return H(a)}function _(r){return r.filter(a=>Object.values(chunkPAKJNZBJ_cjs.b).includes(a)).map(a=>({hasher:m(a),code:i[a]}))}async function H(r){return await Promise.all(r.map(async({code:e,hasher:a})=>{let t=a.digest(),s=digest.create(e,t);return cid.CID.createV1(e,s).toString()}))}
|
|
||||||
|
|
||||||
exports.a = L;
|
|
||||||
//# sourceMappingURL=out.js.map
|
|
||||||
//# sourceMappingURL=chunk-33LRP2HS.cjs.map
|
|
||||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
-8
@@ -1,8 +0,0 @@
|
|||||||
import { a } from './chunk-A6J5HDTV.js';
|
|
||||||
import m from 'fs';
|
|
||||||
|
|
||||||
async function s({filePath:r,algorithms:e}){let o=m.createReadStream(r);return a({stream:o,algorithms:e})}
|
|
||||||
|
|
||||||
export { s as a };
|
|
||||||
//# sourceMappingURL=out.js.map
|
|
||||||
//# sourceMappingURL=chunk-6UBSWOQL.js.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"sources":["../src/lib/file-id/ShaComputeWorker.ts"],"names":["fs","computeCIDs","filePath","algorithms","stream"],"mappings":"wCACA,OAAOA,MAAQ,KASf,eAAOC,EAAmC,CAAC,SAAAC,EAAU,WAAAC,CAAU,EAGzC,CAClB,IAAMC,EAASJ,EAAG,iBAAiBE,CAAQ,EAC3C,OAAOD,EAAoB,CAAC,OAAAG,EAAQ,WAAAD,CAAU,CAAC,CACnD","sourcesContent":["import {CID_ALGORITHM_NAMES} from \"@root/hash-compute/MultiHashData\";\nimport fs from \"fs\";\nimport {computeCIDs as computeCIDsInternal} from \"./ComputeHash\";\n\n/**\n * Compute the CIDs of a file using specific algorithms\n * @param filePath The path to the file\n * @param algorithms Array of algorithms ('sha256', 'sha1')\n * @returns Array of CIDs (in the order of the algorithms)\n */\nexport default async function computeCIDs({filePath, algorithms}: {\n filePath: string;\n algorithms: CID_ALGORITHM_NAMES[]\n}): Promise<string[]> {\n const stream = fs.createReadStream(filePath);\n return computeCIDsInternal({stream, algorithms});\n}\n"]}
|
|
||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
import { b } from './chunk-YCFZVUZC.js';
|
|
||||||
import { Readable } from 'stream';
|
|
||||||
import { create } from 'multiformats/hashes/digest';
|
|
||||||
import { CID } from 'multiformats/cid';
|
|
||||||
import { createHash } from 'crypto';
|
|
||||||
import u from 'crc-32';
|
|
||||||
|
|
||||||
var c=class{_crc=void 0;update(e){return this._crc=u.buf(e,this._crc),this}digest(){let e=Buffer.alloc(4);return e.writeInt32BE(this._crc,0),e}};var i={cid_crc32:306,cid_md5:213,cid_sha1:17,"cid_sha2-256":18,"cid_sha3-256":22,"cid_sha3-384":21};function m(r){switch(r){case"cid_sha2-256":return createHash("sha256");case"cid_sha1":return createHash("sha1");case"cid_md5":return createHash("md5");case"cid_sha3-256":return createHash("sha3-256");case"cid_sha3-384":return createHash("sha3-384");case"cid_crc32":return new c;default:throw new Error(`Unsupported algorithm: ${r}`)}}async function L({stream:r,algorithms:e}){let a=_(e);if(r instanceof Readable)for await(let t of r)a.forEach(s=>s.hasher.update(t));else {let t=r.getReader();for(;;){let{done:s,value:n}=await t.read();if(s)break;a.forEach(f=>f.hasher.update(Buffer.from(n)));}}return H(a)}function _(r){return r.filter(a=>Object.values(b).includes(a)).map(a=>({hasher:m(a),code:i[a]}))}async function H(r){return await Promise.all(r.map(async({code:e,hasher:a})=>{let t=a.digest(),s=create(e,t);return CID.createV1(e,s).toString()}))}
|
|
||||||
|
|
||||||
export { L as a };
|
|
||||||
//# sourceMappingURL=out.js.map
|
|
||||||
//# sourceMappingURL=chunk-A6J5HDTV.js.map
|
|
||||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
// src/lib/hash-compute/MultiHashData.ts
|
||||||
|
var CID_ALGORITHM_CODES = /* @__PURE__ */ ((CID_ALGORITHM_CODES2) => {
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["crc32"] = 306] = "crc32";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["md5"] = 213] = "md5";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha1"] = 17] = "sha1";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha256"] = 18] = "sha256";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha3_256"] = 22] = "sha3_256";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha3_384"] = 21] = "sha3_384";
|
||||||
|
return CID_ALGORITHM_CODES2;
|
||||||
|
})(CID_ALGORITHM_CODES || {});
|
||||||
|
var CID_ALGORITHM_NAMES = /* @__PURE__ */ ((CID_ALGORITHM_NAMES2) => {
|
||||||
|
CID_ALGORITHM_NAMES2["crc32"] = "cid_crc32";
|
||||||
|
CID_ALGORITHM_NAMES2["md5"] = "cid_md5";
|
||||||
|
CID_ALGORITHM_NAMES2["sha1"] = "cid_sha1";
|
||||||
|
CID_ALGORITHM_NAMES2["sha256"] = "cid_sha2-256";
|
||||||
|
CID_ALGORITHM_NAMES2["sha3_256"] = "cid_sha3-256";
|
||||||
|
CID_ALGORITHM_NAMES2["sha3_384"] = "cid_sha3-384";
|
||||||
|
return CID_ALGORITHM_NAMES2;
|
||||||
|
})(CID_ALGORITHM_NAMES || {});
|
||||||
|
var CID_ALGORITHM = /* @__PURE__ */ ((CID_ALGORITHM2) => {
|
||||||
|
CID_ALGORITHM2["crc32"] = "crc32";
|
||||||
|
CID_ALGORITHM2["md5"] = "md5";
|
||||||
|
CID_ALGORITHM2["sha1"] = "sha1";
|
||||||
|
CID_ALGORITHM2["sha256"] = "sha2-256";
|
||||||
|
CID_ALGORITHM2["sha3_256"] = "sha3-256";
|
||||||
|
CID_ALGORITHM2["sha3_384"] = "sha3-384";
|
||||||
|
return CID_ALGORITHM2;
|
||||||
|
})(CID_ALGORITHM || {});
|
||||||
|
|
||||||
|
export { CID_ALGORITHM, CID_ALGORITHM_CODES, CID_ALGORITHM_NAMES };
|
||||||
|
//# sourceMappingURL=out.js.map
|
||||||
|
//# sourceMappingURL=chunk-HTZ763NS.js.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["../src/lib/hash-compute/MultiHashData.ts"],"names":["CID_ALGORITHM_CODES","CID_ALGORITHM_NAMES","CID_ALGORITHM"],"mappings":";AAiBO,IAAK,sBAAL,kBAAKA,yBAAL;AACH,EAAAA,0CAAA,WAAQ,OAAR;AACA,EAAAA,0CAAA,SAAM,OAAN;AACA,EAAAA,0CAAA,UAAO,MAAP;AACA,EAAAA,0CAAA,YAAS,MAAT;AACA,EAAAA,0CAAA,cAAW,MAAX;AACA,EAAAA,0CAAA,cAAW,MAAX;AANQ,SAAAA;AAAA,GAAA;AASL,IAAK,sBAAL,kBAAKC,yBAAL;AACH,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,SAAM;AACN,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AANH,SAAAA;AAAA,GAAA;AASL,IAAK,gBAAL,kBAAKC,mBAAL;AACH,EAAAA,eAAA,WAAQ;AACR,EAAAA,eAAA,SAAM;AACN,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,YAAS;AACT,EAAAA,eAAA,cAAW;AACX,EAAAA,eAAA,cAAW;AANH,SAAAA;AAAA,GAAA","sourcesContent":["export interface MultiHashData {\n cid_crc32?: string; //0x0132 CRC32 (SFV)\n cid_md5?: string; // 0xd5 md5\n cid_sha1?: string; // 0x11 sha1\n \"cid_sha2-256\"?: string;//0x12 sha2-256\n \"cid_sha3-256\"?: string; // 0x16 sha3-256\n \"cid_sha3_384\"?: string; // 0x16 sha3-256\n}\n\nexport interface ComputeInterface {\n computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;\n}\n\n/**\n * according to\n * https://ipfs.io/ipfs/QmXec1jjwzxWJoNbxQF5KffL8q6hFXm9QwUGaa3wKGk6dT/#title=Multicodecs&src=https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv\n */\nexport enum CID_ALGORITHM_CODES {\n crc32 = 0x0132,\n md5 = 0xd5,\n sha1 = 0x11,\n sha256 = 0x12,\n sha3_256 = 0x16,\n sha3_384 = 0x15,\n}\n\nexport enum CID_ALGORITHM_NAMES {\n crc32 = 'cid_crc32',\n md5 = 'cid_md5',\n sha1 = 'cid_sha1',\n sha256 = 'cid_sha2-256',\n sha3_256 = 'cid_sha3-256',\n sha3_384 = 'cid_sha3-384',\n}\n\nexport enum CID_ALGORITHM {\n crc32 = 'crc32',\n md5 = 'md5',\n sha1 = 'sha1',\n sha256 = 'sha2-256',\n sha3_256 = 'sha3-256',\n sha3_384 = 'sha3-384',\n}"]}
|
||||||
Vendored
-14
@@ -1,14 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var chunk33LRP2HS_cjs = require('./chunk-33LRP2HS.cjs');
|
|
||||||
var m = require('fs');
|
|
||||||
|
|
||||||
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
||||||
|
|
||||||
var m__default = /*#__PURE__*/_interopDefault(m);
|
|
||||||
|
|
||||||
async function s({filePath:r,algorithms:e}){let o=m__default.default.createReadStream(r);return chunk33LRP2HS_cjs.a({stream:o,algorithms:e})}
|
|
||||||
|
|
||||||
exports.a = s;
|
|
||||||
//# sourceMappingURL=out.js.map
|
|
||||||
//# sourceMappingURL=chunk-KZVIGNTH.cjs.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"sources":["../src/lib/file-id/ShaComputeWorker.ts"],"names":["fs","computeCIDs","filePath","algorithms","stream"],"mappings":"yCACA,OAAOA,MAAQ,KASf,eAAOC,EAAmC,CAAC,SAAAC,EAAU,WAAAC,CAAU,EAGzC,CAClB,IAAMC,EAASJ,EAAG,iBAAiBE,CAAQ,EAC3C,OAAOD,EAAoB,CAAC,OAAAG,EAAQ,WAAAD,CAAU,CAAC,CACnD","sourcesContent":["import {CID_ALGORITHM_NAMES} from \"@root/hash-compute/MultiHashData\";\nimport fs from \"fs\";\nimport {computeCIDs as computeCIDsInternal} from \"./ComputeHash\";\n\n/**\n * Compute the CIDs of a file using specific algorithms\n * @param filePath The path to the file\n * @param algorithms Array of algorithms ('sha256', 'sha1')\n * @returns Array of CIDs (in the order of the algorithms)\n */\nexport default async function computeCIDs({filePath, algorithms}: {\n filePath: string;\n algorithms: CID_ALGORITHM_NAMES[]\n}): Promise<string[]> {\n const stream = fs.createReadStream(filePath);\n return computeCIDsInternal({stream, algorithms});\n}\n"]}
|
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
import { computeCIDs } from './chunk-SV45D2HN.js';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
|
async function computeCIDs2({ filePath, algorithms }) {
|
||||||
|
const stream = fs.createReadStream(filePath);
|
||||||
|
return computeCIDs({ stream, algorithms });
|
||||||
|
}
|
||||||
|
|
||||||
|
export { computeCIDs2 as computeCIDs };
|
||||||
|
//# sourceMappingURL=out.js.map
|
||||||
|
//# sourceMappingURL=chunk-LTWPBXM5.js.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["../src/lib/file-id/ShaComputeWorker.ts"],"names":["computeCIDs"],"mappings":";;;;;AACA,OAAO,QAAQ;AASf,eAAOA,aAAmC,EAAC,UAAU,WAAU,GAGzC;AAClB,QAAM,SAAS,GAAG,iBAAiB,QAAQ;AAC3C,SAAO,YAAoB,EAAC,QAAQ,WAAU,CAAC;AACnD","sourcesContent":["import {CID_ALGORITHM_NAMES} from \"@root/hash-compute/MultiHashData\";\nimport fs from \"fs\";\nimport {computeCIDs as computeCIDsInternal} from \"./ComputeHash\";\n\n/**\n * Compute the CIDs of a file using specific algorithms\n * @param filePath The path to the file\n * @param algorithms Array of algorithms ('sha256', 'sha1')\n * @returns Array of CIDs (in the order of the algorithms)\n */\nexport default async function computeCIDs({filePath, algorithms}: {\n filePath: string;\n algorithms: CID_ALGORITHM_NAMES[]\n}): Promise<string[]> {\n const stream = fs.createReadStream(filePath);\n return computeCIDsInternal({stream, algorithms});\n}\n"]}
|
||||||
Vendored
+94
@@ -0,0 +1,94 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var chunkS7BSPELE_cjs = require('./chunk-S7BSPELE.cjs');
|
||||||
|
var stream = require('stream');
|
||||||
|
var digest = require('multiformats/hashes/digest');
|
||||||
|
var cid = require('multiformats/cid');
|
||||||
|
var crypto = require('crypto');
|
||||||
|
var crc32 = require('crc-32');
|
||||||
|
|
||||||
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
|
||||||
|
var crc32__default = /*#__PURE__*/_interopDefault(crc32);
|
||||||
|
|
||||||
|
var Crc32Hash = class {
|
||||||
|
_crc = void 0;
|
||||||
|
update(data) {
|
||||||
|
this._crc = crc32__default.default.buf(data, this._crc);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
digest() {
|
||||||
|
const buffer = Buffer.alloc(4);
|
||||||
|
buffer.writeInt32BE(this._crc, 0);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/lib/file-id/CreateHasher.ts
|
||||||
|
var codeTable = {
|
||||||
|
["cid_crc32" /* crc32 */]: 306 /* crc32 */,
|
||||||
|
["cid_md5" /* md5 */]: 213 /* md5 */,
|
||||||
|
["cid_sha1" /* sha1 */]: 17 /* sha1 */,
|
||||||
|
["cid_sha2-256" /* sha256 */]: 18 /* sha256 */,
|
||||||
|
["cid_sha3-256" /* sha3_256 */]: 22 /* sha3_256 */,
|
||||||
|
["cid_sha3-384" /* sha3_384 */]: 21 /* sha3_384 */
|
||||||
|
};
|
||||||
|
async function createHasher(algo) {
|
||||||
|
switch (algo) {
|
||||||
|
case "cid_sha2-256" /* sha256 */:
|
||||||
|
return crypto.createHash("sha256");
|
||||||
|
case "cid_sha1" /* sha1 */:
|
||||||
|
return crypto.createHash("sha1");
|
||||||
|
case "cid_md5" /* md5 */:
|
||||||
|
return crypto.createHash("md5");
|
||||||
|
case "cid_sha3-256" /* sha3_256 */:
|
||||||
|
return crypto.createHash("sha3-256");
|
||||||
|
case "cid_sha3-384" /* sha3_384 */:
|
||||||
|
return crypto.createHash("sha3-384");
|
||||||
|
case "cid_crc32" /* crc32 */:
|
||||||
|
return new Crc32Hash();
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported algorithm: ${algo}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/lib/file-id/ComputeHash.ts
|
||||||
|
async function computeCIDs({ stream: stream$1, algorithms }) {
|
||||||
|
const hashers = await hasherDefiner(algorithms);
|
||||||
|
if (stream$1 instanceof stream.Readable) {
|
||||||
|
for await (const chunk of stream$1) {
|
||||||
|
for (const item of hashers) {
|
||||||
|
await item.hasher.update(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const reader = stream$1.getReader();
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done)
|
||||||
|
break;
|
||||||
|
for (const item of hashers) {
|
||||||
|
await item.hasher.update(Buffer.from(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cidFinalize(hashers);
|
||||||
|
}
|
||||||
|
async function hasherDefiner(algorithms) {
|
||||||
|
const hashers = algorithms.filter((algo) => Object.values(chunkS7BSPELE_cjs.CID_ALGORITHM_NAMES).includes(algo)).map(async (algo) => ({
|
||||||
|
hasher: await createHasher(algo),
|
||||||
|
code: codeTable[algo]
|
||||||
|
}));
|
||||||
|
return await Promise.all(hashers);
|
||||||
|
}
|
||||||
|
async function cidFinalize(hashers) {
|
||||||
|
return await Promise.all(hashers.map(async ({ code, hasher }) => {
|
||||||
|
const hashBuffer = await hasher.digest();
|
||||||
|
const digest$1 = digest.create(code, hashBuffer);
|
||||||
|
return cid.CID.createV1(code, digest$1).toString();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.computeCIDs = computeCIDs;
|
||||||
|
//# sourceMappingURL=out.js.map
|
||||||
|
//# sourceMappingURL=chunk-OHUFSPVO.cjs.map
|
||||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
-9
@@ -1,9 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var s=(a=>(a[a.crc32=306]="crc32",a[a.md5=213]="md5",a[a.sha1=17]="sha1",a[a.sha256=18]="sha256",a[a.sha3_256=22]="sha3_256",a[a.sha3_384=21]="sha3_384",a))(s||{}),c=(a=>(a.crc32="cid_crc32",a.md5="cid_md5",a.sha1="cid_sha1",a.sha256="cid_sha2-256",a.sha3_256="cid_sha3-256",a.sha3_384="cid_sha3-384",a))(c||{}),h=(a=>(a.crc32="crc32",a.md5="md5",a.sha1="sha1",a.sha256="sha2-256",a.sha3_256="sha3-256",a.sha3_384="sha3-384",a))(h||{});
|
|
||||||
|
|
||||||
exports.a = s;
|
|
||||||
exports.b = c;
|
|
||||||
exports.c = h;
|
|
||||||
//# sourceMappingURL=out.js.map
|
|
||||||
//# sourceMappingURL=chunk-PAKJNZBJ.cjs.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"sources":["../src/lib/hash-compute/MultiHashData.ts"],"names":["CID_ALGORITHM_CODES","CID_ALGORITHM_NAMES","CID_ALGORITHM"],"mappings":"AAiBO,IAAKA,OACRA,IAAA,MAAQ,KAAR,QACAA,IAAA,IAAM,KAAN,MACAA,IAAA,KAAO,IAAP,OACAA,IAAA,OAAS,IAAT,SACAA,IAAA,SAAW,IAAX,WACAA,IAAA,SAAW,IAAX,WANQA,OAAA,IASAC,OACRA,EAAA,MAAQ,YACRA,EAAA,IAAM,UACNA,EAAA,KAAO,WACPA,EAAA,OAAS,eACTA,EAAA,SAAW,eACXA,EAAA,SAAW,eANHA,OAAA,IASAC,OACRA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,KAAO,OACPA,EAAA,OAAS,WACTA,EAAA,SAAW,WACXA,EAAA,SAAW,WANHA,OAAA","sourcesContent":["export interface MultiHashData {\n cid_crc32?: string; //0x0132 CRC32 (SFV)\n cid_md5?: string; // 0xd5 md5\n cid_sha1?: string; // 0x11 sha1\n \"cid_sha2-256\"?: string;//0x12 sha2-256\n \"cid_sha3-256\"?: string; // 0x16 sha3-256\n \"cid_sha3_384\"?: string; // 0x16 sha3-256\n}\n\nexport interface ComputeInterface {\n computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;\n}\n\n/**\n * according to\n * https://ipfs.io/ipfs/QmXec1jjwzxWJoNbxQF5KffL8q6hFXm9QwUGaa3wKGk6dT/#title=Multicodecs&src=https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv\n */\nexport enum CID_ALGORITHM_CODES {\n crc32 = 0x0132,\n md5 = 0xd5,\n sha1 = 0x11,\n sha256 = 0x12,\n sha3_256 = 0x16,\n sha3_384 = 0x15,\n}\n\nexport enum CID_ALGORITHM_NAMES {\n crc32 = 'cid_crc32',\n md5 = 'cid_md5',\n sha1 = 'cid_sha1',\n sha256 = 'cid_sha2-256',\n sha3_256 = 'cid_sha3-256',\n sha3_384 = 'cid_sha3-384',\n}\n\nexport enum CID_ALGORITHM {\n crc32 = 'crc32',\n md5 = 'md5',\n sha1 = 'sha1',\n sha256 = 'sha2-256',\n sha3_256 = 'sha3-256',\n sha3_384 = 'sha3-384',\n}"]}
|
|
||||||
Vendored
+36
@@ -0,0 +1,36 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
// src/lib/hash-compute/MultiHashData.ts
|
||||||
|
var CID_ALGORITHM_CODES = /* @__PURE__ */ ((CID_ALGORITHM_CODES2) => {
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["crc32"] = 306] = "crc32";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["md5"] = 213] = "md5";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha1"] = 17] = "sha1";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha256"] = 18] = "sha256";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha3_256"] = 22] = "sha3_256";
|
||||||
|
CID_ALGORITHM_CODES2[CID_ALGORITHM_CODES2["sha3_384"] = 21] = "sha3_384";
|
||||||
|
return CID_ALGORITHM_CODES2;
|
||||||
|
})(CID_ALGORITHM_CODES || {});
|
||||||
|
var CID_ALGORITHM_NAMES = /* @__PURE__ */ ((CID_ALGORITHM_NAMES2) => {
|
||||||
|
CID_ALGORITHM_NAMES2["crc32"] = "cid_crc32";
|
||||||
|
CID_ALGORITHM_NAMES2["md5"] = "cid_md5";
|
||||||
|
CID_ALGORITHM_NAMES2["sha1"] = "cid_sha1";
|
||||||
|
CID_ALGORITHM_NAMES2["sha256"] = "cid_sha2-256";
|
||||||
|
CID_ALGORITHM_NAMES2["sha3_256"] = "cid_sha3-256";
|
||||||
|
CID_ALGORITHM_NAMES2["sha3_384"] = "cid_sha3-384";
|
||||||
|
return CID_ALGORITHM_NAMES2;
|
||||||
|
})(CID_ALGORITHM_NAMES || {});
|
||||||
|
var CID_ALGORITHM = /* @__PURE__ */ ((CID_ALGORITHM2) => {
|
||||||
|
CID_ALGORITHM2["crc32"] = "crc32";
|
||||||
|
CID_ALGORITHM2["md5"] = "md5";
|
||||||
|
CID_ALGORITHM2["sha1"] = "sha1";
|
||||||
|
CID_ALGORITHM2["sha256"] = "sha2-256";
|
||||||
|
CID_ALGORITHM2["sha3_256"] = "sha3-256";
|
||||||
|
CID_ALGORITHM2["sha3_384"] = "sha3-384";
|
||||||
|
return CID_ALGORITHM2;
|
||||||
|
})(CID_ALGORITHM || {});
|
||||||
|
|
||||||
|
exports.CID_ALGORITHM = CID_ALGORITHM;
|
||||||
|
exports.CID_ALGORITHM_CODES = CID_ALGORITHM_CODES;
|
||||||
|
exports.CID_ALGORITHM_NAMES = CID_ALGORITHM_NAMES;
|
||||||
|
//# sourceMappingURL=out.js.map
|
||||||
|
//# sourceMappingURL=chunk-S7BSPELE.cjs.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["../src/lib/hash-compute/MultiHashData.ts"],"names":["CID_ALGORITHM_CODES","CID_ALGORITHM_NAMES","CID_ALGORITHM"],"mappings":";AAiBO,IAAK,sBAAL,kBAAKA,yBAAL;AACH,EAAAA,0CAAA,WAAQ,OAAR;AACA,EAAAA,0CAAA,SAAM,OAAN;AACA,EAAAA,0CAAA,UAAO,MAAP;AACA,EAAAA,0CAAA,YAAS,MAAT;AACA,EAAAA,0CAAA,cAAW,MAAX;AACA,EAAAA,0CAAA,cAAW,MAAX;AANQ,SAAAA;AAAA,GAAA;AASL,IAAK,sBAAL,kBAAKC,yBAAL;AACH,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,SAAM;AACN,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AANH,SAAAA;AAAA,GAAA;AASL,IAAK,gBAAL,kBAAKC,mBAAL;AACH,EAAAA,eAAA,WAAQ;AACR,EAAAA,eAAA,SAAM;AACN,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,YAAS;AACT,EAAAA,eAAA,cAAW;AACX,EAAAA,eAAA,cAAW;AANH,SAAAA;AAAA,GAAA","sourcesContent":["export interface MultiHashData {\n cid_crc32?: string; //0x0132 CRC32 (SFV)\n cid_md5?: string; // 0xd5 md5\n cid_sha1?: string; // 0x11 sha1\n \"cid_sha2-256\"?: string;//0x12 sha2-256\n \"cid_sha3-256\"?: string; // 0x16 sha3-256\n \"cid_sha3_384\"?: string; // 0x16 sha3-256\n}\n\nexport interface ComputeInterface {\n computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;\n}\n\n/**\n * according to\n * https://ipfs.io/ipfs/QmXec1jjwzxWJoNbxQF5KffL8q6hFXm9QwUGaa3wKGk6dT/#title=Multicodecs&src=https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv\n */\nexport enum CID_ALGORITHM_CODES {\n crc32 = 0x0132,\n md5 = 0xd5,\n sha1 = 0x11,\n sha256 = 0x12,\n sha3_256 = 0x16,\n sha3_384 = 0x15,\n}\n\nexport enum CID_ALGORITHM_NAMES {\n crc32 = 'cid_crc32',\n md5 = 'cid_md5',\n sha1 = 'cid_sha1',\n sha256 = 'cid_sha2-256',\n sha3_256 = 'cid_sha3-256',\n sha3_384 = 'cid_sha3-384',\n}\n\nexport enum CID_ALGORITHM {\n crc32 = 'crc32',\n md5 = 'md5',\n sha1 = 'sha1',\n sha256 = 'sha2-256',\n sha3_256 = 'sha3-256',\n sha3_384 = 'sha3-384',\n}"]}
|
||||||
Vendored
+88
@@ -0,0 +1,88 @@
|
|||||||
|
import { CID_ALGORITHM_NAMES } from './chunk-HTZ763NS.js';
|
||||||
|
import { Readable } from 'stream';
|
||||||
|
import { create } from 'multiformats/hashes/digest';
|
||||||
|
import { CID } from 'multiformats/cid';
|
||||||
|
import { createHash } from 'crypto';
|
||||||
|
import crc32 from 'crc-32';
|
||||||
|
|
||||||
|
var Crc32Hash = class {
|
||||||
|
_crc = void 0;
|
||||||
|
update(data) {
|
||||||
|
this._crc = crc32.buf(data, this._crc);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
digest() {
|
||||||
|
const buffer = Buffer.alloc(4);
|
||||||
|
buffer.writeInt32BE(this._crc, 0);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// src/lib/file-id/CreateHasher.ts
|
||||||
|
var codeTable = {
|
||||||
|
["cid_crc32" /* crc32 */]: 306 /* crc32 */,
|
||||||
|
["cid_md5" /* md5 */]: 213 /* md5 */,
|
||||||
|
["cid_sha1" /* sha1 */]: 17 /* sha1 */,
|
||||||
|
["cid_sha2-256" /* sha256 */]: 18 /* sha256 */,
|
||||||
|
["cid_sha3-256" /* sha3_256 */]: 22 /* sha3_256 */,
|
||||||
|
["cid_sha3-384" /* sha3_384 */]: 21 /* sha3_384 */
|
||||||
|
};
|
||||||
|
async function createHasher(algo) {
|
||||||
|
switch (algo) {
|
||||||
|
case "cid_sha2-256" /* sha256 */:
|
||||||
|
return createHash("sha256");
|
||||||
|
case "cid_sha1" /* sha1 */:
|
||||||
|
return createHash("sha1");
|
||||||
|
case "cid_md5" /* md5 */:
|
||||||
|
return createHash("md5");
|
||||||
|
case "cid_sha3-256" /* sha3_256 */:
|
||||||
|
return createHash("sha3-256");
|
||||||
|
case "cid_sha3-384" /* sha3_384 */:
|
||||||
|
return createHash("sha3-384");
|
||||||
|
case "cid_crc32" /* crc32 */:
|
||||||
|
return new Crc32Hash();
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported algorithm: ${algo}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// src/lib/file-id/ComputeHash.ts
|
||||||
|
async function computeCIDs({ stream, algorithms }) {
|
||||||
|
const hashers = await hasherDefiner(algorithms);
|
||||||
|
if (stream instanceof Readable) {
|
||||||
|
for await (const chunk of stream) {
|
||||||
|
for (const item of hashers) {
|
||||||
|
await item.hasher.update(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const reader = stream.getReader();
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read();
|
||||||
|
if (done)
|
||||||
|
break;
|
||||||
|
for (const item of hashers) {
|
||||||
|
await item.hasher.update(Buffer.from(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cidFinalize(hashers);
|
||||||
|
}
|
||||||
|
async function hasherDefiner(algorithms) {
|
||||||
|
const hashers = algorithms.filter((algo) => Object.values(CID_ALGORITHM_NAMES).includes(algo)).map(async (algo) => ({
|
||||||
|
hasher: await createHasher(algo),
|
||||||
|
code: codeTable[algo]
|
||||||
|
}));
|
||||||
|
return await Promise.all(hashers);
|
||||||
|
}
|
||||||
|
async function cidFinalize(hashers) {
|
||||||
|
return await Promise.all(hashers.map(async ({ code, hasher }) => {
|
||||||
|
const hashBuffer = await hasher.digest();
|
||||||
|
const digest = create(code, hashBuffer);
|
||||||
|
return CID.createV1(code, digest).toString();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export { computeCIDs };
|
||||||
|
//# sourceMappingURL=out.js.map
|
||||||
|
//# sourceMappingURL=chunk-SV45D2HN.js.map
|
||||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var chunkOHUFSPVO_cjs = require('./chunk-OHUFSPVO.cjs');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
||||||
|
|
||||||
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
||||||
|
|
||||||
|
async function computeCIDs2({ filePath, algorithms }) {
|
||||||
|
const stream = fs__default.default.createReadStream(filePath);
|
||||||
|
return chunkOHUFSPVO_cjs.computeCIDs({ stream, algorithms });
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.computeCIDs = computeCIDs2;
|
||||||
|
//# sourceMappingURL=out.js.map
|
||||||
|
//# sourceMappingURL=chunk-Y5FIE5OK.cjs.map
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["../src/lib/file-id/ShaComputeWorker.ts"],"names":["computeCIDs"],"mappings":";;;;;AACA,OAAO,QAAQ;AASf,eAAOA,aAAmC,EAAC,UAAU,WAAU,GAGzC;AAClB,QAAM,SAAS,GAAG,iBAAiB,QAAQ;AAC3C,SAAO,YAAoB,EAAC,QAAQ,WAAU,CAAC;AACnD","sourcesContent":["import {CID_ALGORITHM_NAMES} from \"@root/hash-compute/MultiHashData\";\nimport fs from \"fs\";\nimport {computeCIDs as computeCIDsInternal} from \"./ComputeHash\";\n\n/**\n * Compute the CIDs of a file using specific algorithms\n * @param filePath The path to the file\n * @param algorithms Array of algorithms ('sha256', 'sha1')\n * @returns Array of CIDs (in the order of the algorithms)\n */\nexport default async function computeCIDs({filePath, algorithms}: {\n filePath: string;\n algorithms: CID_ALGORITHM_NAMES[]\n}): Promise<string[]> {\n const stream = fs.createReadStream(filePath);\n return computeCIDsInternal({stream, algorithms});\n}\n"]}
|
||||||
Vendored
-5
@@ -1,5 +0,0 @@
|
|||||||
var s=(a=>(a[a.crc32=306]="crc32",a[a.md5=213]="md5",a[a.sha1=17]="sha1",a[a.sha256=18]="sha256",a[a.sha3_256=22]="sha3_256",a[a.sha3_384=21]="sha3_384",a))(s||{}),c=(a=>(a.crc32="cid_crc32",a.md5="cid_md5",a.sha1="cid_sha1",a.sha256="cid_sha2-256",a.sha3_256="cid_sha3-256",a.sha3_384="cid_sha3-384",a))(c||{}),h=(a=>(a.crc32="crc32",a.md5="md5",a.sha1="sha1",a.sha256="sha2-256",a.sha3_256="sha3-256",a.sha3_384="sha3-384",a))(h||{});
|
|
||||||
|
|
||||||
export { s as a, c as b, h as c };
|
|
||||||
//# sourceMappingURL=out.js.map
|
|
||||||
//# sourceMappingURL=chunk-YCFZVUZC.js.map
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
{"version":3,"sources":["../src/lib/hash-compute/MultiHashData.ts"],"names":["CID_ALGORITHM_CODES","CID_ALGORITHM_NAMES","CID_ALGORITHM"],"mappings":"AAiBO,IAAKA,OACRA,IAAA,MAAQ,KAAR,QACAA,IAAA,IAAM,KAAN,MACAA,IAAA,KAAO,IAAP,OACAA,IAAA,OAAS,IAAT,SACAA,IAAA,SAAW,IAAX,WACAA,IAAA,SAAW,IAAX,WANQA,OAAA,IASAC,OACRA,EAAA,MAAQ,YACRA,EAAA,IAAM,UACNA,EAAA,KAAO,WACPA,EAAA,OAAS,eACTA,EAAA,SAAW,eACXA,EAAA,SAAW,eANHA,OAAA,IASAC,OACRA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,KAAO,OACPA,EAAA,OAAS,WACTA,EAAA,SAAW,WACXA,EAAA,SAAW,WANHA,OAAA","sourcesContent":["export interface MultiHashData {\n cid_crc32?: string; //0x0132 CRC32 (SFV)\n cid_md5?: string; // 0xd5 md5\n cid_sha1?: string; // 0x11 sha1\n \"cid_sha2-256\"?: string;//0x12 sha2-256\n \"cid_sha3-256\"?: string; // 0x16 sha3-256\n \"cid_sha3_384\"?: string; // 0x16 sha3-256\n}\n\nexport interface ComputeInterface {\n computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;\n}\n\n/**\n * according to\n * https://ipfs.io/ipfs/QmXec1jjwzxWJoNbxQF5KffL8q6hFXm9QwUGaa3wKGk6dT/#title=Multicodecs&src=https://raw.githubusercontent.com/multiformats/multicodec/master/table.csv\n */\nexport enum CID_ALGORITHM_CODES {\n crc32 = 0x0132,\n md5 = 0xd5,\n sha1 = 0x11,\n sha256 = 0x12,\n sha3_256 = 0x16,\n sha3_384 = 0x15,\n}\n\nexport enum CID_ALGORITHM_NAMES {\n crc32 = 'cid_crc32',\n md5 = 'cid_md5',\n sha1 = 'cid_sha1',\n sha256 = 'cid_sha2-256',\n sha3_256 = 'cid_sha3-256',\n sha3_384 = 'cid_sha3-384',\n}\n\nexport enum CID_ALGORITHM {\n crc32 = 'crc32',\n md5 = 'md5',\n sha1 = 'sha1',\n sha256 = 'sha2-256',\n sha3_256 = 'sha3-256',\n sha3_384 = 'sha3-384',\n}"]}
|
|
||||||
Vendored
+24
-8
@@ -1,27 +1,43 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('./chunk-KWYLOVWT.cjs');
|
require('./chunk-KWYLOVWT.cjs');
|
||||||
var chunk33LRP2HS_cjs = require('./chunk-33LRP2HS.cjs');
|
var chunkOHUFSPVO_cjs = require('./chunk-OHUFSPVO.cjs');
|
||||||
var chunkPAKJNZBJ_cjs = require('./chunk-PAKJNZBJ.cjs');
|
var chunkS7BSPELE_cjs = require('./chunk-S7BSPELE.cjs');
|
||||||
|
|
||||||
var a=class{constructor(r){this.targetHash=r;}async computeMissingHash(r,e){let t=this.targetHash.filter(o=>!e[o]);if(t.length===0)return;let i=await chunk33LRP2HS_cjs.a({stream:r,algorithms:t});for(let[o,c]of i.entries()){let n=t[o];e[n]=c;}}};
|
// src/lib/hash-compute/HashComputer.ts
|
||||||
|
var HashComputer = class {
|
||||||
|
constructor(targetHash) {
|
||||||
|
this.targetHash = targetHash;
|
||||||
|
}
|
||||||
|
async computeMissingHash(stream, metadata) {
|
||||||
|
const neededHashes = this.targetHash.filter((hashName) => !metadata[hashName]);
|
||||||
|
if (neededHashes.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cids = await chunkOHUFSPVO_cjs.computeCIDs({ stream, algorithms: neededHashes });
|
||||||
|
for (const [index, cid] of cids.entries()) {
|
||||||
|
const hashType = neededHashes[index];
|
||||||
|
metadata[hashType] = cid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Object.defineProperty(exports, "computeCIDs", {
|
Object.defineProperty(exports, "computeCIDs", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunk33LRP2HS_cjs.a; }
|
get: function () { return chunkOHUFSPVO_cjs.computeCIDs; }
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, "CID_ALGORITHM", {
|
Object.defineProperty(exports, "CID_ALGORITHM", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunkPAKJNZBJ_cjs.c; }
|
get: function () { return chunkS7BSPELE_cjs.CID_ALGORITHM; }
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, "CID_ALGORITHM_CODES", {
|
Object.defineProperty(exports, "CID_ALGORITHM_CODES", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunkPAKJNZBJ_cjs.a; }
|
get: function () { return chunkS7BSPELE_cjs.CID_ALGORITHM_CODES; }
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, "CID_ALGORITHM_NAMES", {
|
Object.defineProperty(exports, "CID_ALGORITHM_NAMES", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunkPAKJNZBJ_cjs.b; }
|
get: function () { return chunkS7BSPELE_cjs.CID_ALGORITHM_NAMES; }
|
||||||
});
|
});
|
||||||
exports.HashComputer = a;
|
exports.HashComputer = HashComputer;
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
//# sourceMappingURL=index-browser.cjs.map
|
//# sourceMappingURL=index-browser.cjs.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"sources":["../src/lib/hash-compute/HashComputer.ts"],"names":["HashComputer","targetHash","stream","metadata","neededHashes","hashName","cids","computeCIDs","index","cid","hashType"],"mappings":"6HAKO,IAAMA,EAAN,KAAkB,CAErB,YAAoBC,EAAmC,CAAnC,gBAAAA,CACpB,CAEA,MAAM,mBAAmBC,EAAkBC,EAAwC,CAE/E,IAAMC,EAAe,KAAK,WAAW,OAAOC,GAAY,CAACF,EAASE,CAAQ,CAAC,EAG3E,GAAID,EAAa,SAAW,EACxB,OAIJ,IAAME,EAAO,MAAMC,EAAY,CAAC,OAAAL,EAAQ,WAAWE,CAAY,CAAC,EAGhE,OAAW,CAACI,EAAOC,CAAG,IAAKH,EAAK,QAAQ,EAAG,CACvC,IAAMI,EAAWN,EAAaI,CAAK,EACnCL,EAASO,CAAQ,EAAID,CACzB,CACJ,CACJ","sourcesContent":["import {CID_ALGORITHM_NAMES, MultiHashData} from \"./MultiHashData\";\nimport {Readable} from \"stream\";\n\nimport {computeCIDs} from \"@root/file-id/ComputeHash\";\n\nexport class HashComputer{\n\n constructor(private targetHash: CID_ALGORITHM_NAMES[]) {\n }\n\n async computeMissingHash(stream: Readable, metadata: MultiHashData): Promise<void> {\n // Dynamically determine which hashes are needed\n const neededHashes = this.targetHash.filter(hashName => !metadata[hashName]);\n\n // If all hashes are already computed, skip the processing\n if (neededHashes.length === 0) {\n return;\n }\n\n // Compute only the needed CIDs\n const cids = await computeCIDs({stream, algorithms:neededHashes});\n\n // Map the computed CIDs back to their respective metadata properties\n for (const [index, cid] of cids.entries()) {\n const hashType = neededHashes[index];\n metadata[hashType] = cid;\n }\n }\n}\n"]}
|
{"version":3,"sources":["../src/lib/hash-compute/HashComputer.ts"],"names":[],"mappings":";;;;;;;;;;;AAKO,IAAM,eAAN,MAAkB;AAAA,EAErB,YAAoB,YAAmC;AAAnC;AAAA,EACpB;AAAA,EAEA,MAAM,mBAAmB,QAAkB,UAAwC;AAE/E,UAAM,eAAe,KAAK,WAAW,OAAO,cAAY,CAAC,SAAS,QAAQ,CAAC;AAG3E,QAAI,aAAa,WAAW,GAAG;AAC3B;AAAA,IACJ;AAGA,UAAM,OAAO,MAAM,YAAY,EAAC,QAAQ,YAAW,aAAY,CAAC;AAGhE,eAAW,CAAC,OAAO,GAAG,KAAK,KAAK,QAAQ,GAAG;AACvC,YAAM,WAAW,aAAa,KAAK;AACnC,eAAS,QAAQ,IAAI;AAAA,IACzB;AAAA,EACJ;AACJ","sourcesContent":["import {CID_ALGORITHM_NAMES, MultiHashData} from \"./MultiHashData\";\nimport {Readable} from \"stream\";\n\nimport {computeCIDs} from \"@root/file-id/ComputeHash\";\n\nexport class HashComputer{\n\n constructor(private targetHash: CID_ALGORITHM_NAMES[]) {\n }\n\n async computeMissingHash(stream: Readable, metadata: MultiHashData): Promise<void> {\n // Dynamically determine which hashes are needed\n const neededHashes = this.targetHash.filter(hashName => !metadata[hashName]);\n\n // If all hashes are already computed, skip the processing\n if (neededHashes.length === 0) {\n return;\n }\n\n // Compute only the needed CIDs\n const cids = await computeCIDs({stream, algorithms:neededHashes});\n\n // Map the computed CIDs back to their respective metadata properties\n for (const [index, cid] of cids.entries()) {\n const hashType = neededHashes[index];\n metadata[hashType] = cid;\n }\n }\n}\n"]}
|
||||||
Vendored
+21
-5
@@ -1,10 +1,26 @@
|
|||||||
import './chunk-XCJZALP2.js';
|
import './chunk-XCJZALP2.js';
|
||||||
import { a as a$1 } from './chunk-A6J5HDTV.js';
|
import { computeCIDs } from './chunk-SV45D2HN.js';
|
||||||
export { a as computeCIDs } from './chunk-A6J5HDTV.js';
|
export { computeCIDs } from './chunk-SV45D2HN.js';
|
||||||
export { c as CID_ALGORITHM, a as CID_ALGORITHM_CODES, b as CID_ALGORITHM_NAMES } from './chunk-YCFZVUZC.js';
|
export { CID_ALGORITHM, CID_ALGORITHM_CODES, CID_ALGORITHM_NAMES } from './chunk-HTZ763NS.js';
|
||||||
|
|
||||||
var a=class{constructor(r){this.targetHash=r;}async computeMissingHash(r,e){let t=this.targetHash.filter(o=>!e[o]);if(t.length===0)return;let i=await a$1({stream:r,algorithms:t});for(let[o,c]of i.entries()){let n=t[o];e[n]=c;}}};
|
// src/lib/hash-compute/HashComputer.ts
|
||||||
|
var HashComputer = class {
|
||||||
|
constructor(targetHash) {
|
||||||
|
this.targetHash = targetHash;
|
||||||
|
}
|
||||||
|
async computeMissingHash(stream, metadata) {
|
||||||
|
const neededHashes = this.targetHash.filter((hashName) => !metadata[hashName]);
|
||||||
|
if (neededHashes.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cids = await computeCIDs({ stream, algorithms: neededHashes });
|
||||||
|
for (const [index, cid] of cids.entries()) {
|
||||||
|
const hashType = neededHashes[index];
|
||||||
|
metadata[hashType] = cid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export { a as HashComputer };
|
export { HashComputer };
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
//# sourceMappingURL=index-browser.js.map
|
//# sourceMappingURL=index-browser.js.map
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"sources":["../src/lib/hash-compute/HashComputer.ts"],"names":["HashComputer","targetHash","stream","metadata","neededHashes","hashName","cids","computeCIDs","index","cid","hashType"],"mappings":"0HAKO,IAAMA,EAAN,KAAkB,CAErB,YAAoBC,EAAmC,CAAnC,gBAAAA,CACpB,CAEA,MAAM,mBAAmBC,EAAkBC,EAAwC,CAE/E,IAAMC,EAAe,KAAK,WAAW,OAAOC,GAAY,CAACF,EAASE,CAAQ,CAAC,EAG3E,GAAID,EAAa,SAAW,EACxB,OAIJ,IAAME,EAAO,MAAMC,EAAY,CAAC,OAAAL,EAAQ,WAAWE,CAAY,CAAC,EAGhE,OAAW,CAACI,EAAOC,CAAG,IAAKH,EAAK,QAAQ,EAAG,CACvC,IAAMI,EAAWN,EAAaI,CAAK,EACnCL,EAASO,CAAQ,EAAID,CACzB,CACJ,CACJ","sourcesContent":["import {CID_ALGORITHM_NAMES, MultiHashData} from \"./MultiHashData\";\nimport {Readable} from \"stream\";\n\nimport {computeCIDs} from \"@root/file-id/ComputeHash\";\n\nexport class HashComputer{\n\n constructor(private targetHash: CID_ALGORITHM_NAMES[]) {\n }\n\n async computeMissingHash(stream: Readable, metadata: MultiHashData): Promise<void> {\n // Dynamically determine which hashes are needed\n const neededHashes = this.targetHash.filter(hashName => !metadata[hashName]);\n\n // If all hashes are already computed, skip the processing\n if (neededHashes.length === 0) {\n return;\n }\n\n // Compute only the needed CIDs\n const cids = await computeCIDs({stream, algorithms:neededHashes});\n\n // Map the computed CIDs back to their respective metadata properties\n for (const [index, cid] of cids.entries()) {\n const hashType = neededHashes[index];\n metadata[hashType] = cid;\n }\n }\n}\n"]}
|
{"version":3,"sources":["../src/lib/hash-compute/HashComputer.ts"],"names":[],"mappings":";;;;;;;;;;;AAKO,IAAM,eAAN,MAAkB;AAAA,EAErB,YAAoB,YAAmC;AAAnC;AAAA,EACpB;AAAA,EAEA,MAAM,mBAAmB,QAAkB,UAAwC;AAE/E,UAAM,eAAe,KAAK,WAAW,OAAO,cAAY,CAAC,SAAS,QAAQ,CAAC;AAG3E,QAAI,aAAa,WAAW,GAAG;AAC3B;AAAA,IACJ;AAGA,UAAM,OAAO,MAAM,YAAY,EAAC,QAAQ,YAAW,aAAY,CAAC;AAGhE,eAAW,CAAC,OAAO,GAAG,KAAK,KAAK,QAAQ,GAAG;AACvC,YAAM,WAAW,aAAa,KAAK;AACnC,eAAS,QAAQ,IAAI;AAAA,IACzB;AAAA,EACJ;AACJ","sourcesContent":["import {CID_ALGORITHM_NAMES, MultiHashData} from \"./MultiHashData\";\nimport {Readable} from \"stream\";\n\nimport {computeCIDs} from \"@root/file-id/ComputeHash\";\n\nexport class HashComputer{\n\n constructor(private targetHash: CID_ALGORITHM_NAMES[]) {\n }\n\n async computeMissingHash(stream: Readable, metadata: MultiHashData): Promise<void> {\n // Dynamically determine which hashes are needed\n const neededHashes = this.targetHash.filter(hashName => !metadata[hashName]);\n\n // If all hashes are already computed, skip the processing\n if (neededHashes.length === 0) {\n return;\n }\n\n // Compute only the needed CIDs\n const cids = await computeCIDs({stream, algorithms:neededHashes});\n\n // Map the computed CIDs back to their respective metadata properties\n for (const [index, cid] of cids.entries()) {\n const hashType = neededHashes[index];\n metadata[hashType] = cid;\n }\n }\n}\n"]}
|
||||||
Vendored
+4
-4
@@ -1,21 +1,21 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('./chunk-KWYLOVWT.cjs');
|
require('./chunk-KWYLOVWT.cjs');
|
||||||
var chunkPAKJNZBJ_cjs = require('./chunk-PAKJNZBJ.cjs');
|
var chunkS7BSPELE_cjs = require('./chunk-S7BSPELE.cjs');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Object.defineProperty(exports, "CID_ALGORITHM", {
|
Object.defineProperty(exports, "CID_ALGORITHM", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunkPAKJNZBJ_cjs.c; }
|
get: function () { return chunkS7BSPELE_cjs.CID_ALGORITHM; }
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, "CID_ALGORITHM_CODES", {
|
Object.defineProperty(exports, "CID_ALGORITHM_CODES", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunkPAKJNZBJ_cjs.a; }
|
get: function () { return chunkS7BSPELE_cjs.CID_ALGORITHM_CODES; }
|
||||||
});
|
});
|
||||||
Object.defineProperty(exports, "CID_ALGORITHM_NAMES", {
|
Object.defineProperty(exports, "CID_ALGORITHM_NAMES", {
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
get: function () { return chunkPAKJNZBJ_cjs.b; }
|
get: function () { return chunkS7BSPELE_cjs.CID_ALGORITHM_NAMES; }
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
//# sourceMappingURL=index-interface.cjs.map
|
//# sourceMappingURL=index-interface.cjs.map
|
||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import './chunk-XCJZALP2.js';
|
import './chunk-XCJZALP2.js';
|
||||||
export { c as CID_ALGORITHM, a as CID_ALGORITHM_CODES, b as CID_ALGORITHM_NAMES } from './chunk-YCFZVUZC.js';
|
export { CID_ALGORITHM, CID_ALGORITHM_CODES, CID_ALGORITHM_NAMES } from './chunk-HTZ763NS.js';
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
//# sourceMappingURL=index-interface.js.map
|
//# sourceMappingURL=index-interface.js.map
|
||||||
Vendored
+452
-19
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+442
-9
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var chunkKZVIGNTH_cjs = require('./chunk-KZVIGNTH.cjs');
|
var chunkY5FIE5OK_cjs = require('./chunk-Y5FIE5OK.cjs');
|
||||||
require('./chunk-33LRP2HS.cjs');
|
require('./chunk-OHUFSPVO.cjs');
|
||||||
require('./chunk-PAKJNZBJ.cjs');
|
require('./chunk-S7BSPELE.cjs');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = chunkKZVIGNTH_cjs.a;
|
module.exports = chunkY5FIE5OK_cjs.computeCIDs;
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
//# sourceMappingURL=worker.cjs.map
|
//# sourceMappingURL=worker.cjs.map
|
||||||
Vendored
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
export { a as default } from './chunk-6UBSWOQL.js';
|
export { computeCIDs as default } from './chunk-LTWPBXM5.js';
|
||||||
import './chunk-A6J5HDTV.js';
|
import './chunk-SV45D2HN.js';
|
||||||
import './chunk-YCFZVUZC.js';
|
import './chunk-HTZ763NS.js';
|
||||||
//# sourceMappingURL=out.js.map
|
//# sourceMappingURL=out.js.map
|
||||||
//# sourceMappingURL=worker.js.map
|
//# sourceMappingURL=worker.js.map
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@libp2p/crypto": "^4.0.5",
|
||||||
"@types/node": "^20.12.2",
|
"@types/node": "^20.12.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"tsup": "^8.0.2",
|
"tsup": "^8.0.2",
|
||||||
|
|||||||
@@ -15,13 +15,15 @@ export async function computeCIDs({stream, algorithms}: {
|
|||||||
stream: Readable | ReadableStream;
|
stream: Readable | ReadableStream;
|
||||||
algorithms: CID_ALGORITHM_NAMES[]
|
algorithms: CID_ALGORITHM_NAMES[]
|
||||||
}): Promise<string[]> {
|
}): Promise<string[]> {
|
||||||
const hashers = hasherDefiner(algorithms);
|
const hashers = await hasherDefiner(algorithms);
|
||||||
|
|
||||||
// Check if the environment is Node.js or Browser and handle the stream accordingly
|
// Check if the environment is Node.js or Browser and handle the stream accordingly
|
||||||
if (stream instanceof Readable) {
|
if (stream instanceof Readable) {
|
||||||
// Node.js environment
|
// Node.js environment
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
hashers.forEach(item => item.hasher.update(chunk as Buffer));
|
for (const item of hashers) {
|
||||||
|
await item.hasher.update(chunk as Buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Browser environment
|
// Browser environment
|
||||||
@@ -30,28 +32,30 @@ export async function computeCIDs({stream, algorithms}: {
|
|||||||
const {done, value} = await reader.read();
|
const {done, value} = await reader.read();
|
||||||
if (done) break;
|
if (done) break;
|
||||||
// Assuming the hasher can handle Uint8Array directly
|
// Assuming the hasher can handle Uint8Array directly
|
||||||
hashers.forEach(item => item.hasher.update(Buffer.from(value)));
|
for (const item of hashers) {
|
||||||
|
await item.hasher.update(Buffer.from(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cidFinalize(hashers);
|
return cidFinalize(hashers);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasherDefiner(algorithms: CID_ALGORITHM_NAMES[]): {
|
async function hasherDefiner(algorithms: CID_ALGORITHM_NAMES[]): Promise<{
|
||||||
hasher: SimpleHash,
|
hasher: SimpleHash,
|
||||||
code: CID_ALGORITHM_CODES
|
code: CID_ALGORITHM_CODES
|
||||||
}[] {
|
}[]> {
|
||||||
const hashers = algorithms.filter(algo => Object.values(CID_ALGORITHM_NAMES).includes(algo))
|
const hashers = algorithms.filter(algo => Object.values(CID_ALGORITHM_NAMES).includes(algo))
|
||||||
.map(algo => ({
|
.map(async algo => ({
|
||||||
hasher: createHasher(algo),
|
hasher: await createHasher(algo),
|
||||||
code: codeTable[algo]
|
code: codeTable[algo]
|
||||||
}));
|
}));
|
||||||
return hashers;
|
return await Promise.all(hashers);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cidFinalize(hashers: { hasher: SimpleHash, code: number }[]): Promise<string[]> {
|
async function cidFinalize(hashers: { hasher: SimpleHash, code: number }[]): Promise<string[]> {
|
||||||
return await Promise.all(hashers.map(async ({code, hasher}) => {
|
return await Promise.all(hashers.map(async ({code, hasher}) => {
|
||||||
const hashBuffer = hasher.digest();
|
const hashBuffer = await hasher.digest();
|
||||||
const digest = create(code, hashBuffer);
|
const digest = create(code, hashBuffer);
|
||||||
return CID.createV1(code, digest).toString();
|
return CID.createV1(code, digest).toString();
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {SimpleHash} from "@root/file-id/SimpleHash";
|
|||||||
export class Crc32Hash implements SimpleHash {
|
export class Crc32Hash implements SimpleHash {
|
||||||
private _crc: number = undefined;
|
private _crc: number = undefined;
|
||||||
|
|
||||||
update(data: Buffer): Crc32Hash {
|
update(data: Buffer): SimpleHash {
|
||||||
// Update the CRC-32 checksum with the new chunk of data
|
// Update the CRC-32 checksum with the new chunk of data
|
||||||
this._crc = crc32.buf(data, this._crc);
|
this._crc = crc32.buf(data, this._crc);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import {CID_ALGORITHM_CODES, CID_ALGORITHM_NAMES} from "../hash-compute/MultiHashData";
|
import {CID_ALGORITHM_CODES, CID_ALGORITHM_NAMES} from "../hash-compute/MultiHashData";
|
||||||
import {Readable} from "stream";
|
|
||||||
import {ReadableStream} from "stream/web";
|
|
||||||
import {SimpleHash} from "./SimpleHash";
|
import {SimpleHash} from "./SimpleHash";
|
||||||
import {createHash} from "crypto";
|
import {createHash} from "crypto";
|
||||||
import {Crc32Hash} from "./Crc32Hash";
|
import {Crc32Hash} from "./Crc32Hash";
|
||||||
@@ -19,7 +17,7 @@ export const codeTable = {
|
|||||||
* @returns Array of CIDs (in the order of the algorithms)
|
* @returns Array of CIDs (in the order of the algorithms)
|
||||||
* @param algo
|
* @param algo
|
||||||
*/
|
*/
|
||||||
export function createHasher(algo: CID_ALGORITHM_NAMES): SimpleHash {
|
export async function createHasher(algo: CID_ALGORITHM_NAMES): Promise<SimpleHash> {
|
||||||
switch (algo) {
|
switch (algo) {
|
||||||
case CID_ALGORITHM_NAMES.sha256:
|
case CID_ALGORITHM_NAMES.sha256:
|
||||||
return createHash("sha256");
|
return createHash("sha256");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export interface SimpleHash {
|
export interface SimpleHash {
|
||||||
update(data: Buffer),
|
update(data: Buffer): SimpleHash | Promise<SimpleHash>;
|
||||||
|
|
||||||
digest(): Buffer;
|
digest(): Buffer | Promise<Buffer>;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -12,6 +12,6 @@ export default defineConfig({
|
|||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
clean: true,
|
clean: true,
|
||||||
dts:true,
|
dts:true,
|
||||||
minify:true,
|
minify:false,
|
||||||
format: ['cjs', 'esm'],
|
format: ['cjs', 'esm'],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,6 +5,22 @@ __metadata:
|
|||||||
version: 8
|
version: 8
|
||||||
cacheKey: 10c0
|
cacheKey: 10c0
|
||||||
|
|
||||||
|
"@chainsafe/is-ip@npm:^2.0.1":
|
||||||
|
version: 2.0.2
|
||||||
|
resolution: "@chainsafe/is-ip@npm:2.0.2"
|
||||||
|
checksum: 10c0/0bb8b9d0babe583642d31ffafad603ac5e5dc48884266feae57479d81f4e81ef903628527d81b39d5305657a957bf435bd2ef38b98a4526a7aab366febf793ad
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@chainsafe/netmask@npm:^2.0.0":
|
||||||
|
version: 2.0.0
|
||||||
|
resolution: "@chainsafe/netmask@npm:2.0.0"
|
||||||
|
dependencies:
|
||||||
|
"@chainsafe/is-ip": "npm:^2.0.1"
|
||||||
|
checksum: 10c0/a9069e52b0a1470b00c88d3fb16ff4fe14274e5055770faab974b29f7bc69ebf76172775461da1e88b7fe73539a9228f6af0406253d46e987193ddf21a073da1
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@cspotcode/source-map-support@npm:^0.8.0":
|
"@cspotcode/source-map-support@npm:^0.8.0":
|
||||||
version: 0.8.1
|
version: 0.8.1
|
||||||
resolution: "@cspotcode/source-map-support@npm:0.8.1"
|
resolution: "@cspotcode/source-map-support@npm:0.8.1"
|
||||||
@@ -411,10 +427,48 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@leichtgewicht/ip-codec@npm:^2.0.1":
|
||||||
|
version: 2.0.5
|
||||||
|
resolution: "@leichtgewicht/ip-codec@npm:2.0.5"
|
||||||
|
checksum: 10c0/14a0112bd59615eef9e3446fea018045720cd3da85a98f801a685a818b0d96ef2a1f7227e8d271def546b2e2a0fe91ef915ba9dc912ab7967d2317b1a051d66b
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@libp2p/crypto@npm:^4.0.5":
|
||||||
|
version: 4.0.5
|
||||||
|
resolution: "@libp2p/crypto@npm:4.0.5"
|
||||||
|
dependencies:
|
||||||
|
"@libp2p/interface": "npm:^1.1.6"
|
||||||
|
"@noble/curves": "npm:^1.4.0"
|
||||||
|
"@noble/hashes": "npm:^1.4.0"
|
||||||
|
asn1js: "npm:^3.0.5"
|
||||||
|
multiformats: "npm:^13.1.0"
|
||||||
|
protons-runtime: "npm:^5.4.0"
|
||||||
|
uint8arraylist: "npm:^2.4.8"
|
||||||
|
uint8arrays: "npm:^5.0.3"
|
||||||
|
checksum: 10c0/d0abefa43da0a6bc9037c844257ff385e08d4be49bf67d4026c48e7866528b74a10a98ae1f2cb71525f2b02fa4e3b12f7b1d99977e2914a5dc0b05c08483e763
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@libp2p/interface@npm:^1.0.0, @libp2p/interface@npm:^1.1.6":
|
||||||
|
version: 1.1.6
|
||||||
|
resolution: "@libp2p/interface@npm:1.1.6"
|
||||||
|
dependencies:
|
||||||
|
"@multiformats/multiaddr": "npm:^12.2.1"
|
||||||
|
it-pushable: "npm:^3.2.3"
|
||||||
|
it-stream-types: "npm:^2.0.1"
|
||||||
|
multiformats: "npm:^13.1.0"
|
||||||
|
progress-events: "npm:^1.0.0"
|
||||||
|
uint8arraylist: "npm:^2.4.8"
|
||||||
|
checksum: 10c0/7aa5fb619e2d5d8a468f105427587962a92c1fb1167e201a92d0fd11f166617d9abf138e6fdb27076613ade790224f7d93b68c5c5e7ce61be8d1f3d5b1d79711
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@metazla/meta-hash@workspace:.":
|
"@metazla/meta-hash@workspace:.":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@metazla/meta-hash@workspace:."
|
resolution: "@metazla/meta-hash@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@libp2p/crypto": "npm:^4.0.5"
|
||||||
"@types/node": "npm:^20.12.2"
|
"@types/node": "npm:^20.12.2"
|
||||||
chokidar: "npm:^3.6.0"
|
chokidar: "npm:^3.6.0"
|
||||||
crc-32: "npm:^1.2.2"
|
crc-32: "npm:^1.2.2"
|
||||||
@@ -430,6 +484,52 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"@multiformats/dns@npm:^1.0.3":
|
||||||
|
version: 1.0.6
|
||||||
|
resolution: "@multiformats/dns@npm:1.0.6"
|
||||||
|
dependencies:
|
||||||
|
"@types/dns-packet": "npm:^5.6.5"
|
||||||
|
buffer: "npm:^6.0.3"
|
||||||
|
dns-packet: "npm:^5.6.1"
|
||||||
|
hashlru: "npm:^2.3.0"
|
||||||
|
p-queue: "npm:^8.0.1"
|
||||||
|
progress-events: "npm:^1.0.0"
|
||||||
|
uint8arrays: "npm:^5.0.2"
|
||||||
|
checksum: 10c0/ab0323ec9e697fb345a47b68e9e6ee5e2def2f00e99467ac6c53c9b6f613cff2dc2b792e9270cfe385500b6cdcc565a1c6e6e7871c584a6bc49366441bc4fa7f
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@multiformats/multiaddr@npm:^12.2.1":
|
||||||
|
version: 12.2.1
|
||||||
|
resolution: "@multiformats/multiaddr@npm:12.2.1"
|
||||||
|
dependencies:
|
||||||
|
"@chainsafe/is-ip": "npm:^2.0.1"
|
||||||
|
"@chainsafe/netmask": "npm:^2.0.0"
|
||||||
|
"@libp2p/interface": "npm:^1.0.0"
|
||||||
|
"@multiformats/dns": "npm:^1.0.3"
|
||||||
|
multiformats: "npm:^13.0.0"
|
||||||
|
uint8-varint: "npm:^2.0.1"
|
||||||
|
uint8arrays: "npm:^5.0.0"
|
||||||
|
checksum: 10c0/b32026406ee3635ce3a8e919663bf2e911e139890f1c18c74e64f5043966f14d6396280f198b7aa11d0faf2c0b27f3e6db0d546167832657b01b9769a7143abc
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@noble/curves@npm:^1.4.0":
|
||||||
|
version: 1.4.0
|
||||||
|
resolution: "@noble/curves@npm:1.4.0"
|
||||||
|
dependencies:
|
||||||
|
"@noble/hashes": "npm:1.4.0"
|
||||||
|
checksum: 10c0/31fbc370df91bcc5a920ca3f2ce69c8cf26dc94775a36124ed8a5a3faf0453badafd2ee4337061ffea1b43c623a90ee8b286a5a81604aaf9563bdad7ff795d18
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@noble/hashes@npm:1.4.0, @noble/hashes@npm:^1.4.0":
|
||||||
|
version: 1.4.0
|
||||||
|
resolution: "@noble/hashes@npm:1.4.0"
|
||||||
|
checksum: 10c0/8c3f005ee72e7b8f9cff756dfae1241485187254e3f743873e22073d63906863df5d4f13d441b7530ea614b7a093f0d889309f28b59850f33b66cb26a779a4a5
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@nodelib/fs.scandir@npm:2.1.5":
|
"@nodelib/fs.scandir@npm:2.1.5":
|
||||||
version: 2.1.5
|
version: 2.1.5
|
||||||
resolution: "@nodelib/fs.scandir@npm:2.1.5"
|
resolution: "@nodelib/fs.scandir@npm:2.1.5"
|
||||||
@@ -626,6 +726,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/dns-packet@npm:^5.6.5":
|
||||||
|
version: 5.6.5
|
||||||
|
resolution: "@types/dns-packet@npm:5.6.5"
|
||||||
|
dependencies:
|
||||||
|
"@types/node": "npm:*"
|
||||||
|
checksum: 10c0/70fa9cb77a614f65288a48749d28cc9f40ce6c60980e2b75b25eac0b4e1e4109d14edf5151fa5e7b10aae1ec6b1094a2f171b9941191ff4c9a7afe23116b9edc
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/estree@npm:1.0.5, @types/estree@npm:^1.0.0":
|
"@types/estree@npm:1.0.5, @types/estree@npm:^1.0.0":
|
||||||
version: 1.0.5
|
version: 1.0.5
|
||||||
resolution: "@types/estree@npm:1.0.5"
|
resolution: "@types/estree@npm:1.0.5"
|
||||||
@@ -633,6 +742,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/node@npm:*":
|
||||||
|
version: 20.12.7
|
||||||
|
resolution: "@types/node@npm:20.12.7"
|
||||||
|
dependencies:
|
||||||
|
undici-types: "npm:~5.26.4"
|
||||||
|
checksum: 10c0/dce80d63a3b91892b321af823d624995c61e39c6a223cc0ac481a44d337640cc46931d33efb3beeed75f5c85c3bda1d97cef4c5cd4ec333caf5dee59cff6eca0
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/node@npm:^20.12.2":
|
"@types/node@npm:^20.12.2":
|
||||||
version: 20.12.2
|
version: 20.12.2
|
||||||
resolution: "@types/node@npm:20.12.2"
|
resolution: "@types/node@npm:20.12.2"
|
||||||
@@ -806,6 +924,17 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"asn1js@npm:^3.0.5":
|
||||||
|
version: 3.0.5
|
||||||
|
resolution: "asn1js@npm:3.0.5"
|
||||||
|
dependencies:
|
||||||
|
pvtsutils: "npm:^1.3.2"
|
||||||
|
pvutils: "npm:^1.1.3"
|
||||||
|
tslib: "npm:^2.4.0"
|
||||||
|
checksum: 10c0/bb8eaf4040c8f49dd475566874986f5976b81bae65a6b5526e2208a13cdca323e69ce297bcd435fdda3eb6933defe888e71974d705b6fcb14f2734a907f8aed4
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"assertion-error@npm:^1.1.0":
|
"assertion-error@npm:^1.1.0":
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
resolution: "assertion-error@npm:1.1.0"
|
resolution: "assertion-error@npm:1.1.0"
|
||||||
@@ -820,6 +949,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"base64-js@npm:^1.3.1":
|
||||||
|
version: 1.5.1
|
||||||
|
resolution: "base64-js@npm:1.5.1"
|
||||||
|
checksum: 10c0/f23823513b63173a001030fae4f2dabe283b99a9d324ade3ad3d148e218134676f1ee8568c877cd79ec1c53158dcf2d2ba527a97c606618928ba99dd930102bf
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"binary-extensions@npm:^2.0.0":
|
"binary-extensions@npm:^2.0.0":
|
||||||
version: 2.3.0
|
version: 2.3.0
|
||||||
resolution: "binary-extensions@npm:2.3.0"
|
resolution: "binary-extensions@npm:2.3.0"
|
||||||
@@ -845,6 +981,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"buffer@npm:^6.0.3":
|
||||||
|
version: 6.0.3
|
||||||
|
resolution: "buffer@npm:6.0.3"
|
||||||
|
dependencies:
|
||||||
|
base64-js: "npm:^1.3.1"
|
||||||
|
ieee754: "npm:^1.2.1"
|
||||||
|
checksum: 10c0/2a905fbbcde73cc5d8bd18d1caa23715d5f83a5935867c2329f0ac06104204ba7947be098fe1317fbd8830e26090ff8e764f08cd14fefc977bb248c3487bcbd0
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"bundle-require@npm:^4.0.0":
|
"bundle-require@npm:^4.0.0":
|
||||||
version: 4.0.2
|
version: 4.0.2
|
||||||
resolution: "bundle-require@npm:4.0.2"
|
resolution: "bundle-require@npm:4.0.2"
|
||||||
@@ -1048,6 +1194,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"dns-packet@npm:^5.6.1":
|
||||||
|
version: 5.6.1
|
||||||
|
resolution: "dns-packet@npm:5.6.1"
|
||||||
|
dependencies:
|
||||||
|
"@leichtgewicht/ip-codec": "npm:^2.0.1"
|
||||||
|
checksum: 10c0/8948d3d03063fb68e04a1e386875f8c3bcc398fc375f535f2b438fad8f41bf1afa6f5e70893ba44f4ae884c089247e0a31045722fa6ff0f01d228da103f1811d
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"eastasianwidth@npm:^0.2.0":
|
"eastasianwidth@npm:^0.2.0":
|
||||||
version: 0.2.0
|
version: 0.2.0
|
||||||
resolution: "eastasianwidth@npm:0.2.0"
|
resolution: "eastasianwidth@npm:0.2.0"
|
||||||
@@ -1453,6 +1608,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"hashlru@npm:^2.3.0":
|
||||||
|
version: 2.3.0
|
||||||
|
resolution: "hashlru@npm:2.3.0"
|
||||||
|
checksum: 10c0/90f351db1a320c43aeb681c7e806f35af6877a86d3fa9b970636ea21f111d0f0b819e046dc9b5fe6a8ab211a3d98178eb37aacbad29ea4f6f53554a4541a6f0d
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"http-cache-semantics@npm:^4.1.1":
|
"http-cache-semantics@npm:^4.1.1":
|
||||||
version: 4.1.1
|
version: 4.1.1
|
||||||
resolution: "http-cache-semantics@npm:4.1.1"
|
resolution: "http-cache-semantics@npm:4.1.1"
|
||||||
@@ -1503,6 +1665,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"ieee754@npm:^1.2.1":
|
||||||
|
version: 1.2.1
|
||||||
|
resolution: "ieee754@npm:1.2.1"
|
||||||
|
checksum: 10c0/b0782ef5e0935b9f12883a2e2aa37baa75da6e66ce6515c168697b42160807d9330de9a32ec1ed73149aea02e0d822e572bca6f1e22bdcbd2149e13b050b17bb
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"ignore@npm:^5.2.0":
|
"ignore@npm:^5.2.0":
|
||||||
version: 5.3.1
|
version: 5.3.1
|
||||||
resolution: "ignore@npm:5.3.1"
|
resolution: "ignore@npm:5.3.1"
|
||||||
@@ -1608,6 +1777,22 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"it-pushable@npm:^3.2.3":
|
||||||
|
version: 3.2.3
|
||||||
|
resolution: "it-pushable@npm:3.2.3"
|
||||||
|
dependencies:
|
||||||
|
p-defer: "npm:^4.0.0"
|
||||||
|
checksum: 10c0/ba99744f0a6fe9e555bdde76ce2144a3e35c37a33830c69d65f5512129fb5a58272f1bbb4b9741fca69be868c301109fc910b26629c8eb0961f0503dd80a4830
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"it-stream-types@npm:^2.0.1":
|
||||||
|
version: 2.0.1
|
||||||
|
resolution: "it-stream-types@npm:2.0.1"
|
||||||
|
checksum: 10c0/f76119277679807195a5852fbf3e8e2245e0ed0e8c6a68174049ca521119fe0933fe8fb60c3f7883558e46b3ef8f7ae0852ae8d397f0474858415ed366090174
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"jackspeak@npm:^2.3.6":
|
"jackspeak@npm:^2.3.6":
|
||||||
version: 2.3.6
|
version: 2.3.6
|
||||||
resolution: "jackspeak@npm:2.3.6"
|
resolution: "jackspeak@npm:2.3.6"
|
||||||
@@ -1906,7 +2091,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"multiformats@npm:^13.1.0":
|
"multiformats@npm:^13.0.0, multiformats@npm:^13.1.0":
|
||||||
version: 13.1.0
|
version: 13.1.0
|
||||||
resolution: "multiformats@npm:13.1.0"
|
resolution: "multiformats@npm:13.1.0"
|
||||||
checksum: 10c0/b04e51a443a6b5c0b9ca50aec8ef137bb1f46ca28a3827ca96336e7d7cb2a3367cfafcccd618b0c4147ceed674498635fb1ce115ab94e8b33c763b8168f0ab78
|
checksum: 10c0/b04e51a443a6b5c0b9ca50aec8ef137bb1f46ca28a3827ca96336e7d7cb2a3367cfafcccd618b0c4147ceed674498635fb1ce115ab94e8b33c763b8168f0ab78
|
||||||
@@ -2052,6 +2237,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"p-defer@npm:^4.0.0":
|
||||||
|
version: 4.0.1
|
||||||
|
resolution: "p-defer@npm:4.0.1"
|
||||||
|
checksum: 10c0/592f5bd32f8c6a57f892b00976e5272b3bbbd792b503f4cf3bc22094d08d7a973413c59c15deccff4759d860b38467a08b5b3363e865da6f00f44a031777118c
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"p-limit@npm:^5.0.0":
|
"p-limit@npm:^5.0.0":
|
||||||
version: 5.0.0
|
version: 5.0.0
|
||||||
resolution: "p-limit@npm:5.0.0"
|
resolution: "p-limit@npm:5.0.0"
|
||||||
@@ -2223,6 +2415,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"progress-events@npm:^1.0.0":
|
||||||
|
version: 1.0.0
|
||||||
|
resolution: "progress-events@npm:1.0.0"
|
||||||
|
checksum: 10c0/b634e9c0796bf2d7f9ccda469029cbb456c1cf3d18e6ab1c2ad6a6a6b9163b2669112f3217a6490d2ac039cae82486b4806e05db246776cb644d3bbc0e060805
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"promise-retry@npm:^2.0.1":
|
"promise-retry@npm:^2.0.1":
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
resolution: "promise-retry@npm:2.0.1"
|
resolution: "promise-retry@npm:2.0.1"
|
||||||
@@ -2233,6 +2432,17 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"protons-runtime@npm:^5.4.0":
|
||||||
|
version: 5.4.0
|
||||||
|
resolution: "protons-runtime@npm:5.4.0"
|
||||||
|
dependencies:
|
||||||
|
uint8-varint: "npm:^2.0.2"
|
||||||
|
uint8arraylist: "npm:^2.4.3"
|
||||||
|
uint8arrays: "npm:^5.0.1"
|
||||||
|
checksum: 10c0/5a3c462aa6a637971b67f3ec3f82bd7857996fb9c5feb34cba608a102410235f484ad0f19cc8eec76524f1c112a1964c5132683de0d5edcc2f0d6cab4dcd0e36
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"punycode@npm:^2.1.0":
|
"punycode@npm:^2.1.0":
|
||||||
version: 2.3.1
|
version: 2.3.1
|
||||||
resolution: "punycode@npm:2.3.1"
|
resolution: "punycode@npm:2.3.1"
|
||||||
@@ -2240,6 +2450,22 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"pvtsutils@npm:^1.3.2":
|
||||||
|
version: 1.3.5
|
||||||
|
resolution: "pvtsutils@npm:1.3.5"
|
||||||
|
dependencies:
|
||||||
|
tslib: "npm:^2.6.1"
|
||||||
|
checksum: 10c0/d425aed316907e0b447a459bfb97c55d22270c3cfdba5a07ec90da0737b0e40f4f1771a444636f85bb6a453de90ff8c6b5f4f6ddba7597977166af49974b4534
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"pvutils@npm:^1.1.3":
|
||||||
|
version: 1.1.3
|
||||||
|
resolution: "pvutils@npm:1.1.3"
|
||||||
|
checksum: 10c0/23489e6b3c76b6afb6964a20f891d6bef092939f401c78bba186b2bfcdc7a13904a0af0a78f7933346510f8c1228d5ab02d3c80e968fd84d3c76ff98d8ec9aac
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"queue-microtask@npm:^1.2.2":
|
"queue-microtask@npm:^1.2.2":
|
||||||
version: 1.2.3
|
version: 1.2.3
|
||||||
resolution: "queue-microtask@npm:1.2.3"
|
resolution: "queue-microtask@npm:1.2.3"
|
||||||
@@ -2695,6 +2921,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"tslib@npm:^2.4.0, tslib@npm:^2.6.1":
|
||||||
|
version: 2.6.2
|
||||||
|
resolution: "tslib@npm:2.6.2"
|
||||||
|
checksum: 10c0/e03a8a4271152c8b26604ed45535954c0a45296e32445b4b87f8a5abdb2421f40b59b4ca437c4346af0f28179780d604094eb64546bee2019d903d01c6c19bdb
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"tsup@npm:^8.0.2":
|
"tsup@npm:^8.0.2":
|
||||||
version: 8.0.2
|
version: 8.0.2
|
||||||
resolution: "tsup@npm:8.0.2"
|
resolution: "tsup@npm:8.0.2"
|
||||||
@@ -2768,6 +3001,34 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"uint8-varint@npm:^2.0.1, uint8-varint@npm:^2.0.2":
|
||||||
|
version: 2.0.4
|
||||||
|
resolution: "uint8-varint@npm:2.0.4"
|
||||||
|
dependencies:
|
||||||
|
uint8arraylist: "npm:^2.0.0"
|
||||||
|
uint8arrays: "npm:^5.0.0"
|
||||||
|
checksum: 10c0/850bce72c2b639d317db6af2c30544f7f8c6451fa328d674aca74d7e263a9510acd3af555ed04ffbc20b9ff68fd5d2e06b91a5c9ffde781cf6ee6233606f34dc
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"uint8arraylist@npm:^2.0.0, uint8arraylist@npm:^2.4.3, uint8arraylist@npm:^2.4.8":
|
||||||
|
version: 2.4.8
|
||||||
|
resolution: "uint8arraylist@npm:2.4.8"
|
||||||
|
dependencies:
|
||||||
|
uint8arrays: "npm:^5.0.1"
|
||||||
|
checksum: 10c0/a997289ad66d4ffff24d85524b70af9fb6914ef1657400907a792afbff4c4600e7dde7ab3de83da8309c7b22c093c93bc8a95b3d288eeac4c935133bfb925bac
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"uint8arrays@npm:^5.0.0, uint8arrays@npm:^5.0.1, uint8arrays@npm:^5.0.2, uint8arrays@npm:^5.0.3":
|
||||||
|
version: 5.0.3
|
||||||
|
resolution: "uint8arrays@npm:5.0.3"
|
||||||
|
dependencies:
|
||||||
|
multiformats: "npm:^13.0.0"
|
||||||
|
checksum: 10c0/2c0d0bbb6eff6912c32d5ffb8f35fcc2fa3643b90bde06848222889aaaf869e973e684c8731cc2797b4117121c86cda83063c1363927d6bb882965e355785058
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"undici-types@npm:~5.26.4":
|
"undici-types@npm:~5.26.4":
|
||||||
version: 5.26.5
|
version: 5.26.5
|
||||||
resolution: "undici-types@npm:5.26.5"
|
resolution: "undici-types@npm:5.26.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user