@loaders.gl/crypto 4.0.0-alpha.4 → 4.0.0-alpha.5

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.
Files changed (56) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/dist.min.js +2 -2
  4. package/dist/dist.min.js.map +7 -1
  5. package/dist/index.d.ts +33 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +1 -1
  8. package/dist/lib/algorithms/crc32.d.ts +10 -0
  9. package/dist/lib/algorithms/crc32.d.ts.map +1 -0
  10. package/dist/lib/algorithms/crc32.js +3 -0
  11. package/dist/lib/algorithms/crc32.js.map +1 -1
  12. package/dist/lib/algorithms/crc32c.d.ts +11 -0
  13. package/dist/lib/algorithms/crc32c.d.ts.map +1 -0
  14. package/dist/lib/algorithms/crc32c.js +5 -0
  15. package/dist/lib/algorithms/crc32c.js.map +1 -1
  16. package/dist/lib/algorithms/md5-wasm.d.ts +2 -0
  17. package/dist/lib/algorithms/md5-wasm.d.ts.map +1 -0
  18. package/dist/lib/algorithms/md5-wasm.js.map +1 -1
  19. package/dist/lib/crc32-hash.d.ts +18 -0
  20. package/dist/lib/crc32-hash.d.ts.map +1 -0
  21. package/dist/lib/crc32c-hash.d.ts +22 -0
  22. package/dist/lib/crc32c-hash.d.ts.map +1 -0
  23. package/dist/lib/crypto-hash.d.ts +32 -0
  24. package/dist/lib/crypto-hash.d.ts.map +1 -0
  25. package/dist/lib/hash.d.ts +22 -0
  26. package/dist/lib/hash.d.ts.map +1 -0
  27. package/dist/lib/md5-hash.d.ts +15 -0
  28. package/dist/lib/md5-hash.d.ts.map +1 -0
  29. package/dist/lib/md5-hash.js.map +1 -1
  30. package/dist/lib/node-hash.d.ts +28 -0
  31. package/dist/lib/node-hash.d.ts.map +1 -0
  32. package/dist/lib/sha256-hash.d.ts +19 -0
  33. package/dist/lib/sha256-hash.d.ts.map +1 -0
  34. package/dist/lib/utils/base64-utils.d.ts +3 -2
  35. package/dist/lib/utils/base64-utils.d.ts.map +1 -0
  36. package/dist/lib/utils/base64-utils.js.map +1 -1
  37. package/dist/lib/utils/digest-utils.d.ts +6 -3
  38. package/dist/lib/utils/digest-utils.d.ts.map +1 -0
  39. package/dist/lib/utils/digest-utils.js +3 -2
  40. package/dist/lib/utils/digest-utils.js.map +1 -1
  41. package/dist/types.d.ts +10 -0
  42. package/dist/types.d.ts.map +1 -0
  43. package/dist/worker.js +2 -5072
  44. package/dist/worker.js.map +7 -1
  45. package/dist/workers/worker.d.ts +4 -0
  46. package/dist/workers/worker.d.ts.map +1 -0
  47. package/package.json +7 -7
  48. package/src/lib/algorithms/{crc32.js → crc32.ts} +2 -0
  49. package/src/lib/algorithms/{crc32c.js → crc32c.ts} +3 -0
  50. package/src/lib/algorithms/{md5-wasm.js → md5-wasm.ts} +2 -2
  51. package/src/lib/md5-hash.ts +1 -0
  52. package/src/lib/utils/{base64-utils.js → base64-utils.ts} +3 -2
  53. package/src/lib/utils/digest-utils.ts +24 -0
  54. package/src/lib/utils/base64-utils.d.ts +0 -5
  55. package/src/lib/utils/digest-utils.d.ts +0 -6
  56. package/src/lib/utils/digest-utils.js +0 -25
@@ -0,0 +1,28 @@
1
+ import { Hash } from './hash';
2
+ declare type CryptoHashOptions = {
3
+ crypto: {
4
+ algorithm: string;
5
+ onEnd?: (result: {
6
+ hash: string;
7
+ }) => any;
8
+ };
9
+ };
10
+ /**
11
+ * Calculates Cryptographic Hash using Node.js crypto library
12
+ * @deprecated Warning, experimental class
13
+ */
14
+ export declare class NodeHash extends Hash {
15
+ readonly name = "crypto-node";
16
+ options: CryptoHashOptions;
17
+ private _algorithm;
18
+ private _hash;
19
+ constructor(options: CryptoHashOptions);
20
+ /**
21
+ * Atomic hash calculation
22
+ * @returns base64 encoded hash
23
+ */
24
+ hash(input: ArrayBuffer): Promise<string>;
25
+ hashBatches(asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>): AsyncIterable<ArrayBuffer>;
26
+ }
27
+ export {};
28
+ //# sourceMappingURL=node-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-hash.d.ts","sourceRoot":"","sources":["../../src/lib/node-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAG5B,aAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE;QACN,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,KAAK,GAAG,CAAC;KACzC,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,qBAAa,QAAS,SAAQ,IAAI;IAChC,QAAQ,CAAC,IAAI,iBAAiB;IAE9B,OAAO,EAAE,iBAAiB,CAAC;IAE3B,OAAO,CAAC,UAAU,CAAC;IAEnB,OAAO,CAAC,KAAK,CAAC;gBAEF,OAAO,EAAE,iBAAiB;IAQtC;;;OAGG;IACG,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAOxC,WAAW,CAChB,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,WAAW,CAAC;CAW9B"}
@@ -0,0 +1,19 @@
1
+ import { CryptoHash } from './crypto-hash';
2
+ declare type CryptoHashOptions = {
3
+ modules: {
4
+ [moduleName: string]: any;
5
+ };
6
+ crypto?: {
7
+ onEnd?: (result: {
8
+ hash: string;
9
+ }) => any;
10
+ };
11
+ };
12
+ /**
13
+ * A transform that calculates Cryptographic Hash
14
+ */
15
+ export declare class SHA256Hash extends CryptoHash {
16
+ constructor(options: CryptoHashOptions);
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=sha256-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256-hash.d.ts","sourceRoot":"","sources":["../../src/lib/sha256-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,aAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IACrC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,KAAK,GAAG,CAAC;KACzC,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,qBAAa,UAAW,SAAQ,UAAU;gBAC5B,OAAO,EAAE,iBAAiB;CAGvC"}
@@ -1,5 +1,6 @@
1
1
  /**
2
- * btoa() polyfill as defined by the HTML and Infra specs, which mostly just references
2
+ * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references
3
3
  * RFC 4648.
4
4
  */
5
- export function toBase64(string: string): string;
5
+ export declare function toBase64(string: string): string | null;
6
+ //# sourceMappingURL=base64-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/base64-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCtD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/utils/base64-utils.js"],"names":["toBase64","string","i","length","charCodeAt","out","groupsOfSix","undefined","j","btoaLookup","idx","String","fromCharCode"],"mappings":"AAIA,OAAO,SAASA,QAAT,CAAkBC,MAAlB,EAA0B;AAE/BA,EAAAA,MAAM,aAAMA,MAAN,CAAN;;AAGA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,EAApC,EAAwC;AACtC,QAAID,MAAM,CAACG,UAAP,CAAkBF,CAAlB,IAAuB,GAA3B,EAAgC;AAC9B,aAAO,IAA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,IAAI,GAAP;AACD,OAFD,MAEO;AACLA,QAAAA,GAAG,IAAII,UAAU,CAACH,WAAW,CAACE,CAAD,CAAZ,CAAjB;AACD;AACF;AACF;;AACD,SAAOH,GAAP;AACD;;AAMD,SAASI,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAIA,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,IAAIN,UAAJ,CAAe,CAAf,CAA1B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AACD,MAAIA,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AAED,SAAOH,SAAP;AACD","sourcesContent":["/**\n * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references\n * RFC 4648.\n */\nexport function toBase64(string) {\n // String conversion as required by Web IDL.\n string = `${string}`;\n // \"The btoa() method must throw an \"InvalidCharacterError\" DOMException if\n // data contains any character whose code point is greater than U+00FF.\"\n for (let i = 0; i < string.length; i++) {\n if (string.charCodeAt(i) > 255) {\n return null;\n }\n }\n let out = '';\n for (let i = 0; i < string.length; i += 3) {\n /** @type {Array[4]} */\n const groupsOfSix = [undefined, undefined, undefined, undefined];\n groupsOfSix[0] = string.charCodeAt(i) >> 2;\n groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;\n if (string.length > i + 1) {\n groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;\n groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;\n }\n if (string.length > i + 2) {\n groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;\n groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;\n }\n for (let j = 0; j < groupsOfSix.length; j++) {\n if (typeof groupsOfSix[j] === 'undefined') {\n out += '=';\n } else {\n out += btoaLookup(groupsOfSix[j]);\n }\n }\n }\n return out;\n}\n\n/**\n * Lookup table for btoa(), which converts a six-bit number into the\n * corresponding ASCII character.\n */\nfunction btoaLookup(idx) {\n if (idx < 26) {\n return String.fromCharCode(idx + 'A'.charCodeAt(0));\n }\n if (idx < 52) {\n return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));\n }\n if (idx < 62) {\n return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));\n }\n if (idx === 62) {\n return '+';\n }\n if (idx === 63) {\n return '/';\n }\n // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the teststring.\n return undefined;\n}\n"],"file":"base64-utils.js"}
1
+ {"version":3,"sources":["../../../src/lib/utils/base64-utils.ts"],"names":["toBase64","string","i","length","charCodeAt","out","groupsOfSix","undefined","j","btoaLookup","idx","String","fromCharCode"],"mappings":"AAIA,OAAO,SAASA,QAAT,CAAkBC,MAAlB,EAAiD;AAEtDA,EAAAA,MAAM,aAAMA,MAAN,CAAN;;AAGA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,EAApC,EAAwC;AACtC,QAAID,MAAM,CAACG,UAAP,CAAkBF,CAAlB,IAAuB,GAA3B,EAAgC;AAC9B,aAAO,IAAP;AACD;AACF;;AACD,MAAIG,GAAG,GAAG,EAAV;;AACA,OAAK,IAAIH,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,IAAI,CAAxC,EAA2C;AAEzC,UAAMI,WAAmC,GAAG,CAACC,SAAD,EAAYA,SAAZ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AAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,IAAIN,UAAJ,CAAe,CAAf,CAA1B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,GAAG,EAAV,EAAc;AACZ,WAAOC,MAAM,CAACC,YAAP,CAAoBF,GAAG,GAAG,EAAN,GAAW,IAAIN,UAAJ,CAAe,CAAf,CAA/B,CAAP;AACD;;AACD,MAAIM,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AACD,MAAIA,GAAG,KAAK,EAAZ,EAAgB;AACd,WAAO,GAAP;AACD;;AAED,SAAOH,SAAP;AACD","sourcesContent":["/**\n * `btoa()` polyfill as defined by the HTML and Infra specs, which mostly just references\n * RFC 4648.\n */\nexport function toBase64(string: string): string | null {\n // String conversion as required by Web IDL.\n string = `${string}`;\n // \"The btoa() method must throw an \"InvalidCharacterError\" DOMException if\n // data contains any character whose code point is greater than U+00FF.\"\n for (let i = 0; i < string.length; i++) {\n if (string.charCodeAt(i) > 255) {\n return null;\n }\n }\n let out = '';\n for (let i = 0; i < string.length; i += 3) {\n /** @type {Array[4]} */\n const groupsOfSix: (number | undefined)[] = [undefined, undefined, undefined, undefined];\n groupsOfSix[0] = string.charCodeAt(i) >> 2;\n groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;\n if (string.length > i + 1) {\n groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;\n groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;\n }\n if (string.length > i + 2) {\n // @ts-expect-error\n groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;\n groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;\n }\n for (let j = 0; j < groupsOfSix.length; j++) {\n if (typeof groupsOfSix[j] === 'undefined') {\n out += '=';\n } else {\n out += btoaLookup(groupsOfSix[j]);\n }\n }\n }\n return out;\n}\n\n/**\n * Lookup table for btoa(), which converts a six-bit number into the\n * corresponding ASCII character.\n */\nfunction btoaLookup(idx) {\n if (idx < 26) {\n return String.fromCharCode(idx + 'A'.charCodeAt(0));\n }\n if (idx < 52) {\n return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));\n }\n if (idx < 62) {\n return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));\n }\n if (idx === 62) {\n return '+';\n }\n if (idx === 63) {\n return '/';\n }\n // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the teststring.\n return undefined;\n}\n"],"file":"base64-utils.js"}
@@ -1,6 +1,9 @@
1
- export function toHex(cipher: number): string;
2
-
1
+ /**
2
+ *
3
+ */
4
+ export declare function toHex(cipher: number): string;
3
5
  /**
4
6
  * @see https://stackoverflow.com/questions/23190056/hex-to-base64-converter-for-javascript
5
7
  */
6
- export function hexToBase64(hexstring: string): string;
8
+ export declare function hexToBase64(hexstring: string): string;
9
+ //# sourceMappingURL=digest-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"digest-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/digest-utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUrD"}
@@ -8,7 +8,8 @@ export function hexToBase64(hexstring) {
8
8
  hexstring = "0".concat(hexstring);
9
9
  }
10
10
 
11
- const string = hexstring.match(/\w{2}/g).map(a => String.fromCharCode(parseInt(a, 16))).join('');
12
- return toBase64(string);
11
+ const matches = hexstring.match(/\w{2}/g) || [];
12
+ const string = matches.map(a => String.fromCharCode(parseInt(a, 16))).join('');
13
+ return toBase64(string) || '';
13
14
  }
14
15
  //# sourceMappingURL=digest-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/utils/digest-utils.js"],"names":["toBase64","toHex","cipher","hexString","toString","hexToBase64","hexstring","length","string","match","map","a","String","fromCharCode","parseInt","join"],"mappings":"AAAA,SAAQA,QAAR,QAAuB,gBAAvB;AAKA,OAAO,SAASC,KAAT,CAAeC,MAAf,EAAuB;AAC5B,QAAMC,SAAS,GAAGD,MAAM,CAACE,QAAP,CAAgB,EAAhB,CAAlB;AACA,SAAOD,SAAS,KAAK,GAAd,cAAwBA,SAAxB,IAAsCA,SAA7C;AACD;AAKD,OAAO,SAASE,WAAT,CAAqBC,SAArB,EAAgC;AAGrC,MAAIA,SAAS,CAACC,MAAV,GAAmB,CAAnB,KAAyB,CAA7B,EAAgC;AAC9BD,IAAAA,SAAS,cAAOA,SAAP,CAAT;AACD;;AACD,QAAME,MAAM,GAAGF,SAAS,CACrBG,KADY,CACN,QADM,EAEZC,GAFY,CAEPC,CAAD,IAAOC,MAAM,CAACC,YAAP,CAAoBC,QAAQ,CAACH,CAAD,EAAI,EAAJ,CAA5B,CAFC,EAGZI,IAHY,CAGP,EAHO,CAAf;AAIA,SAAOf,QAAQ,CAACQ,MAAD,CAAf;AACD","sourcesContent":["import {toBase64} from './base64-utils';\n\n/**\n *\n */\nexport function toHex(cipher) {\n const hexString = cipher.toString(16);\n return hexString === '0' ? `0${hexString}` : hexString;\n}\n\n/**\n *\n */\nexport function hexToBase64(hexstring) {\n // Add leading zero to keep even count of digits\n // eg. f85d741 => 0f85d741\n if (hexstring.length % 2 !== 0) {\n hexstring = `0${hexstring}`;\n }\n const string = hexstring\n .match(/\\w{2}/g)\n .map((a) => String.fromCharCode(parseInt(a, 16)))\n .join('');\n return toBase64(string);\n}\n"],"file":"digest-utils.js"}
1
+ {"version":3,"sources":["../../../src/lib/utils/digest-utils.ts"],"names":["toBase64","toHex","cipher","hexString","toString","hexToBase64","hexstring","length","matches","match","string","map","a","String","fromCharCode","parseInt","join"],"mappings":"AAAA,SAAQA,QAAR,QAAuB,gBAAvB;AAKA,OAAO,SAASC,KAAT,CAAeC,MAAf,EAAuC;AAC5C,QAAMC,SAAS,GAAGD,MAAM,CAACE,QAAP,CAAgB,EAAhB,CAAlB;AACA,SAAOD,SAAS,KAAK,GAAd,cAAwBA,SAAxB,IAAsCA,SAA7C;AACD;AAKD,OAAO,SAASE,WAAT,CAAqBC,SAArB,EAAgD;AAGrD,MAAIA,SAAS,CAACC,MAAV,GAAmB,CAAnB,KAAyB,CAA7B,EAAgC;AAC9BD,IAAAA,SAAS,cAAOA,SAAP,CAAT;AACD;;AACD,QAAME,OAAO,GAAGF,SAAS,CAACG,KAAV,CAAgB,QAAhB,KAA6B,EAA7C;AACA,QAAMC,MAAM,GAAGF,OAAO,CAACG,GAAR,CAAaC,CAAD,IAAOC,MAAM,CAACC,YAAP,CAAoBC,QAAQ,CAACH,CAAD,EAAI,EAAJ,CAA5B,CAAnB,EAAyDI,IAAzD,CAA8D,EAA9D,CAAf;AAEA,SAAOhB,QAAQ,CAACU,MAAD,CAAR,IAAoB,EAA3B;AACD","sourcesContent":["import {toBase64} from './base64-utils';\n\n/**\n *\n */\nexport function toHex(cipher: number): string {\n const hexString = cipher.toString(16);\n return hexString === '0' ? `0${hexString}` : hexString;\n}\n\n/**\n * @see https://stackoverflow.com/questions/23190056/hex-to-base64-converter-for-javascript\n */\nexport function hexToBase64(hexstring: string): string {\n // Add leading zero to keep even count of digits\n // eg. f85d741 => 0f85d741\n if (hexstring.length % 2 !== 0) {\n hexstring = `0${hexstring}`;\n }\n const matches = hexstring.match(/\\w{2}/g) || [];\n const string = matches.map((a) => String.fromCharCode(parseInt(a, 16))).join('');\n // TODO - define how to handle failures\n return toBase64(string) || '';\n}\n"],"file":"digest-utils.js"}
@@ -0,0 +1,10 @@
1
+ export declare type CryptoHashOptions = {
2
+ modules?: {
3
+ [moduleName: string]: any;
4
+ };
5
+ crypto?: {
6
+ algorithm: any;
7
+ onEnd?: any;
8
+ };
9
+ };
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IACtC,MAAM,CAAC,EAAE;QACP,SAAS,MAAC;QACV,KAAK,CAAC,MAAC;KACR,CAAC;CACH,CAAC"}