@loaders.gl/crypto 3.3.0-alpha.1 → 3.3.0-alpha.11

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 (76) hide show
  1. package/dist/crypto-worker.js +1 -1
  2. package/dist/crypto-worker.js.map +1 -1
  3. package/dist/dist.min.js.map +1 -1
  4. package/dist/es5/bundle.js +0 -1
  5. package/dist/es5/bundle.js.map +1 -1
  6. package/dist/es5/index.js +16 -21
  7. package/dist/es5/index.js.map +1 -1
  8. package/dist/es5/lib/algorithms/crc32.js +0 -9
  9. package/dist/es5/lib/algorithms/crc32.js.map +1 -1
  10. package/dist/es5/lib/algorithms/crc32c.js +1 -10
  11. package/dist/es5/lib/algorithms/crc32c.js.map +1 -1
  12. package/dist/es5/lib/algorithms/md5-wasm.js +32 -66
  13. package/dist/es5/lib/algorithms/md5-wasm.js.map +1 -1
  14. package/dist/es5/lib/crc32-hash.js +32 -90
  15. package/dist/es5/lib/crc32-hash.js.map +1 -1
  16. package/dist/es5/lib/crc32c-hash.js +36 -91
  17. package/dist/es5/lib/crc32c-hash.js.map +1 -1
  18. package/dist/es5/lib/crypto-hash.js +30 -98
  19. package/dist/es5/lib/crypto-hash.js.map +1 -1
  20. package/dist/es5/lib/hash.js +35 -82
  21. package/dist/es5/lib/hash.js.map +1 -1
  22. package/dist/es5/lib/md5-hash.js +3 -25
  23. package/dist/es5/lib/md5-hash.js.map +1 -1
  24. package/dist/es5/lib/node-hash.js +30 -86
  25. package/dist/es5/lib/node-hash.js.map +1 -1
  26. package/dist/es5/lib/sha256-hash.js +4 -19
  27. package/dist/es5/lib/sha256-hash.js.map +1 -1
  28. package/dist/es5/lib/utils/base64-utils.js +0 -13
  29. package/dist/es5/lib/utils/base64-utils.js.map +1 -1
  30. package/dist/es5/lib/utils/digest-utils.js +1 -4
  31. package/dist/es5/lib/utils/digest-utils.js.map +1 -1
  32. package/dist/es5/types.js.map +1 -1
  33. package/dist/es5/workers/worker.js +6 -22
  34. package/dist/es5/workers/worker.js.map +1 -1
  35. package/dist/esm/bundle.js +1 -1
  36. package/dist/esm/bundle.js.map +1 -1
  37. package/dist/esm/index.js +6 -1
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/esm/lib/algorithms/crc32.js +2 -6
  40. package/dist/esm/lib/algorithms/crc32.js.map +1 -1
  41. package/dist/esm/lib/algorithms/crc32c.js +4 -9
  42. package/dist/esm/lib/algorithms/crc32c.js.map +1 -1
  43. package/dist/esm/lib/algorithms/md5-wasm.js +34 -64
  44. package/dist/esm/lib/algorithms/md5-wasm.js.map +1 -1
  45. package/dist/esm/lib/crc32-hash.js +3 -14
  46. package/dist/esm/lib/crc32-hash.js.map +1 -1
  47. package/dist/esm/lib/crc32c-hash.js +3 -13
  48. package/dist/esm/lib/crc32c-hash.js.map +1 -1
  49. package/dist/esm/lib/crypto-hash.js +2 -21
  50. package/dist/esm/lib/crypto-hash.js.map +1 -1
  51. package/dist/esm/lib/hash.js +2 -9
  52. package/dist/esm/lib/hash.js.map +1 -1
  53. package/dist/esm/lib/md5-hash.js +5 -6
  54. package/dist/esm/lib/md5-hash.js.map +1 -1
  55. package/dist/esm/lib/node-hash.js +2 -13
  56. package/dist/esm/lib/node-hash.js.map +1 -1
  57. package/dist/esm/lib/sha256-hash.js +5 -3
  58. package/dist/esm/lib/sha256-hash.js.map +1 -1
  59. package/dist/esm/lib/utils/base64-utils.js +1 -12
  60. package/dist/esm/lib/utils/base64-utils.js.map +1 -1
  61. package/dist/esm/lib/utils/digest-utils.js +2 -1
  62. package/dist/esm/lib/utils/digest-utils.js.map +1 -1
  63. package/dist/esm/types.js.map +1 -1
  64. package/dist/esm/workers/worker.js +3 -5
  65. package/dist/esm/workers/worker.js.map +1 -1
  66. package/dist/lib/crypto-hash.d.ts +1 -1
  67. package/dist/lib/crypto-hash.d.ts.map +1 -1
  68. package/dist/lib/hash.d.ts +1 -1
  69. package/dist/lib/hash.d.ts.map +1 -1
  70. package/dist/lib/node-hash.d.ts +1 -1
  71. package/dist/lib/node-hash.d.ts.map +1 -1
  72. package/dist/lib/sha256-hash.d.ts +1 -1
  73. package/dist/lib/sha256-hash.d.ts.map +1 -1
  74. package/dist/types.d.ts +1 -1
  75. package/dist/types.d.ts.map +1 -1
  76. package/package.json +4 -4
@@ -1,22 +1,17 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import { Hash } from './hash';
3
3
  import { createHash } from 'crypto';
4
+
4
5
  export class NodeHash extends Hash {
6
+
5
7
  constructor(options) {
6
8
  var _this$options, _this$options$crypto;
7
-
8
9
  super();
9
-
10
10
  _defineProperty(this, "name", 'crypto-node');
11
-
12
11
  _defineProperty(this, "options", void 0);
13
-
14
12
  _defineProperty(this, "_algorithm", void 0);
15
-
16
13
  _defineProperty(this, "_hash", void 0);
17
-
18
14
  this.options = options;
19
-
20
15
  if (!((_this$options = this.options) !== null && _this$options !== void 0 && (_this$options$crypto = _this$options.crypto) !== null && _this$options$crypto !== void 0 && _this$options$crypto.algorithm)) {
21
16
  throw new Error(this.name);
22
17
  }
@@ -24,29 +19,23 @@ export class NodeHash extends Hash {
24
19
 
25
20
  async hash(input) {
26
21
  var _this$options2, _this$options2$crypto, _this$options2$crypto2;
27
-
28
22
  await this.preload();
29
23
  const hash = createHash((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : (_this$options2$crypto = _this$options2.crypto) === null || _this$options2$crypto === void 0 ? void 0 : (_this$options2$crypto2 = _this$options2$crypto.algorithm) === null || _this$options2$crypto2 === void 0 ? void 0 : _this$options2$crypto2.toLowerCase());
30
24
  const inputArray = new Uint8Array(input);
31
25
  return hash.update(inputArray).digest('base64');
32
26
  }
33
-
34
27
  async *hashBatches(asyncIterator) {
35
28
  var _this$options3, _this$options3$crypto, _this$options3$crypto2, _this$options4, _this$options4$crypto, _this$options4$crypto2;
36
-
37
29
  await this.preload();
38
30
  const hash = createHash((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : (_this$options3$crypto = _this$options3.crypto) === null || _this$options3$crypto === void 0 ? void 0 : (_this$options3$crypto2 = _this$options3$crypto.algorithm) === null || _this$options3$crypto2 === void 0 ? void 0 : _this$options3$crypto2.toLowerCase());
39
-
40
31
  for await (const chunk of asyncIterator) {
41
32
  const inputArray = new Uint8Array(chunk);
42
33
  hash.update(inputArray);
43
34
  yield chunk;
44
35
  }
45
-
46
36
  (_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : (_this$options4$crypto = _this$options4.crypto) === null || _this$options4$crypto === void 0 ? void 0 : (_this$options4$crypto2 = _this$options4$crypto.onEnd) === null || _this$options4$crypto2 === void 0 ? void 0 : _this$options4$crypto2.call(_this$options4$crypto, {
47
37
  hash: hash.digest('base64')
48
38
  });
49
39
  }
50
-
51
40
  }
52
41
  //# sourceMappingURL=node-hash.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/node-hash.ts"],"names":["Hash","createHash","NodeHash","constructor","options","crypto","algorithm","Error","name","hash","input","preload","toLowerCase","inputArray","Uint8Array","update","digest","hashBatches","asyncIterator","chunk","onEnd"],"mappings":";AACA,SAAQA,IAAR,QAAmB,QAAnB;AACA,SAAQC,UAAR,QAAyB,QAAzB;AAaA,OAAO,MAAMC,QAAN,SAAuBF,IAAvB,CAA4B;AASjCG,EAAAA,WAAW,CAACC,OAAD,EAA6B;AAAA;;AACtC;;AADsC,kCARxB,aAQwB;;AAAA;;AAAA;;AAAA;;AAEtC,SAAKA,OAAL,GAAeA,OAAf;;AACA,QAAI,mBAAC,KAAKA,OAAN,kEAAC,cAAcC,MAAf,iDAAC,qBAAsBC,SAAvB,CAAJ,EAAsC;AACpC,YAAM,IAAIC,KAAJ,CAAU,KAAKC,IAAf,CAAN;AACD;AACF;;AAMS,QAAJC,IAAI,CAACC,KAAD,EAAsC;AAAA;;AAC9C,UAAM,KAAKC,OAAL,EAAN;AACA,UAAMF,IAAI,GAAGR,UAAU,mBAAC,KAAKG,OAAN,4EAAC,eAAcC,MAAf,oFAAC,sBAAsBC,SAAvB,2DAAC,uBAAiCM,WAAjC,EAAD,CAAvB;AACA,UAAMC,UAAU,GAAG,IAAIC,UAAJ,CAAeJ,KAAf,CAAnB;AACA,WAAOD,IAAI,CAACM,MAAL,CAAYF,UAAZ,EAAwBG,MAAxB,CAA+B,QAA/B,CAAP;AACD;;AAEiB,SAAXC,WAAW,CAChBC,aADgB,EAEY;AAAA;;AAC5B,UAAM,KAAKP,OAAL,EAAN;AACA,UAAMF,IAAI,GAAGR,UAAU,mBAAC,KAAKG,OAAN,4EAAC,eAAcC,MAAf,oFAAC,sBAAsBC,SAAvB,2DAAC,uBAAiCM,WAAjC,EAAD,CAAvB;;AACA,eAAW,MAAMO,KAAjB,IAA0BD,aAA1B,EAAyC;AAEvC,YAAML,UAAU,GAAG,IAAIC,UAAJ,CAAeK,KAAf,CAAnB;AACAV,MAAAA,IAAI,CAACM,MAAL,CAAYF,UAAZ;AACA,YAAMM,KAAN;AACD;;AACD,2BAAKf,OAAL,2FAAcC,MAAd,0GAAsBe,KAAtB,8GAA8B;AAACX,MAAAA,IAAI,EAAEA,IAAI,CAACO,MAAL,CAAY,QAAZ;AAAP,KAA9B;AACD;;AAxCgC","sourcesContent":["// This dependency is too big, application must provide it\nimport {Hash} from './hash';\nimport {createHash} from 'crypto'; // Node.js builtin\n\ntype CryptoHashOptions = {\n crypto: {\n algorithm: string;\n onEnd?: (result: {hash: string}) => any;\n };\n};\n\n/**\n * Calculates Cryptographic Hash using Node.js crypto library\n * @deprecated Warning, experimental class\n */\nexport class NodeHash extends Hash {\n readonly name = 'crypto-node';\n\n options: CryptoHashOptions;\n // @ts-ignore\n private _algorithm;\n // @ts-ignore\n private _hash;\n\n constructor(options: CryptoHashOptions) {\n super();\n this.options = options;\n if (!this.options?.crypto?.algorithm) {\n throw new Error(this.name);\n }\n }\n\n /**\n * Atomic hash calculation\n * @returns base64 encoded hash\n */\n async hash(input: ArrayBuffer): Promise<string> {\n await this.preload();\n const hash = createHash(this.options?.crypto?.algorithm?.toLowerCase());\n const inputArray = new Uint8Array(input);\n return hash.update(inputArray).digest('base64');\n }\n\n async *hashBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n ): AsyncIterable<ArrayBuffer> {\n await this.preload();\n const hash = createHash(this.options?.crypto?.algorithm?.toLowerCase());\n for await (const chunk of asyncIterator) {\n // https://stackoverflow.com/questions/25567468/how-to-decrypt-an-arraybuffer\n const inputArray = new Uint8Array(chunk);\n hash.update(inputArray);\n yield chunk;\n }\n this.options?.crypto?.onEnd?.({hash: hash.digest('base64')});\n }\n}\n"],"file":"node-hash.js"}
1
+ {"version":3,"file":"node-hash.js","names":["Hash","createHash","NodeHash","constructor","options","crypto","algorithm","Error","name","hash","input","preload","toLowerCase","inputArray","Uint8Array","update","digest","hashBatches","asyncIterator","chunk","onEnd"],"sources":["../../../src/lib/node-hash.ts"],"sourcesContent":["// This dependency is too big, application must provide it\nimport {Hash} from './hash';\nimport {createHash} from 'crypto'; // Node.js builtin\n\ntype CryptoHashOptions = {\n crypto: {\n algorithm: string;\n onEnd?: (result: {hash: string}) => any;\n };\n};\n\n/**\n * Calculates Cryptographic Hash using Node.js crypto library\n * @deprecated Warning, experimental class\n */\nexport class NodeHash extends Hash {\n readonly name = 'crypto-node';\n\n options: CryptoHashOptions;\n // @ts-ignore\n private _algorithm;\n // @ts-ignore\n private _hash;\n\n constructor(options: CryptoHashOptions) {\n super();\n this.options = options;\n if (!this.options?.crypto?.algorithm) {\n throw new Error(this.name);\n }\n }\n\n /**\n * Atomic hash calculation\n * @returns base64 encoded hash\n */\n async hash(input: ArrayBuffer): Promise<string> {\n await this.preload();\n const hash = createHash(this.options?.crypto?.algorithm?.toLowerCase());\n const inputArray = new Uint8Array(input);\n return hash.update(inputArray).digest('base64');\n }\n\n async *hashBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>\n ): AsyncIterable<ArrayBuffer> {\n await this.preload();\n const hash = createHash(this.options?.crypto?.algorithm?.toLowerCase());\n for await (const chunk of asyncIterator) {\n // https://stackoverflow.com/questions/25567468/how-to-decrypt-an-arraybuffer\n const inputArray = new Uint8Array(chunk);\n hash.update(inputArray);\n yield chunk;\n }\n this.options?.crypto?.onEnd?.({hash: hash.digest('base64')});\n }\n}\n"],"mappings":";AACA,SAAQA,IAAI,QAAO,QAAQ;AAC3B,SAAQC,UAAU,QAAO,QAAQ;;AAajC,OAAO,MAAMC,QAAQ,SAASF,IAAI,CAAC;;EASjCG,WAAW,CAACC,OAA0B,EAAE;IAAA;IACtC,KAAK,EAAE;IAAC,8BATM,aAAa;IAAA;IAAA;IAAA;IAU3B,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,mBAAC,IAAI,CAACA,OAAO,kEAAZ,cAAcC,MAAM,iDAApB,qBAAsBC,SAAS,GAAE;MACpC,MAAM,IAAIC,KAAK,CAAC,IAAI,CAACC,IAAI,CAAC;IAC5B;EACF;;EAMA,MAAMC,IAAI,CAACC,KAAkB,EAAmB;IAAA;IAC9C,MAAM,IAAI,CAACC,OAAO,EAAE;IACpB,MAAMF,IAAI,GAAGR,UAAU,mBAAC,IAAI,CAACG,OAAO,4EAAZ,eAAcC,MAAM,oFAApB,sBAAsBC,SAAS,2DAA/B,uBAAiCM,WAAW,EAAE,CAAC;IACvE,MAAMC,UAAU,GAAG,IAAIC,UAAU,CAACJ,KAAK,CAAC;IACxC,OAAOD,IAAI,CAACM,MAAM,CAACF,UAAU,CAAC,CAACG,MAAM,CAAC,QAAQ,CAAC;EACjD;EAEA,OAAOC,WAAW,CAChBC,aAAiE,EACrC;IAAA;IAC5B,MAAM,IAAI,CAACP,OAAO,EAAE;IACpB,MAAMF,IAAI,GAAGR,UAAU,mBAAC,IAAI,CAACG,OAAO,4EAAZ,eAAcC,MAAM,oFAApB,sBAAsBC,SAAS,2DAA/B,uBAAiCM,WAAW,EAAE,CAAC;IACvE,WAAW,MAAMO,KAAK,IAAID,aAAa,EAAE;MAEvC,MAAML,UAAU,GAAG,IAAIC,UAAU,CAACK,KAAK,CAAC;MACxCV,IAAI,CAACM,MAAM,CAACF,UAAU,CAAC;MACvB,MAAMM,KAAK;IACb;IACA,sBAAI,CAACf,OAAO,4EAAZ,eAAcC,MAAM,oFAApB,sBAAsBe,KAAK,2DAA3B,mDAA8B;MAACX,IAAI,EAAEA,IAAI,CAACO,MAAM,CAAC,QAAQ;IAAC,CAAC,CAAC;EAC9D;AACF"}
@@ -1,12 +1,14 @@
1
+
1
2
  import { CryptoHash } from './crypto-hash';
2
3
  export class SHA256Hash extends CryptoHash {
3
4
  constructor(options) {
4
- super({ ...options,
5
- crypto: { ...options.crypto,
5
+ super({
6
+ ...options,
7
+ crypto: {
8
+ ...options.crypto,
6
9
  algorithm: 'SHA256'
7
10
  }
8
11
  });
9
12
  }
10
-
11
13
  }
12
14
  //# sourceMappingURL=sha256-hash.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/sha256-hash.ts"],"names":["CryptoHash","SHA256Hash","constructor","options","crypto","algorithm"],"mappings":"AACA,SAAQA,UAAR,QAAyB,eAAzB;AAYA,OAAO,MAAMC,UAAN,SAAyBD,UAAzB,CAAoC;AACzCE,EAAAA,WAAW,CAACC,OAAD,EAA6B;AACtC,UAAM,EAAC,GAAGA,OAAJ;AAAaC,MAAAA,MAAM,EAAE,EAAC,GAAGD,OAAO,CAACC,MAAZ;AAAoBC,QAAAA,SAAS,EAAE;AAA/B;AAArB,KAAN;AACD;;AAHwC","sourcesContent":["//\nimport {CryptoHash} from './crypto-hash';\n\ntype CryptoHashOptions = {\n modules: {[moduleName: string]: any};\n crypto?: {\n onEnd?: (result: {hash: string}) => any;\n };\n};\n\n/**\n * A transform that calculates Cryptographic Hash\n */\nexport class SHA256Hash extends CryptoHash {\n constructor(options: CryptoHashOptions) {\n super({...options, crypto: {...options.crypto, algorithm: 'SHA256'}});\n }\n}\n"],"file":"sha256-hash.js"}
1
+ {"version":3,"file":"sha256-hash.js","names":["CryptoHash","SHA256Hash","constructor","options","crypto","algorithm"],"sources":["../../../src/lib/sha256-hash.ts"],"sourcesContent":["//\nimport {CryptoHash} from './crypto-hash';\n\ntype CryptoHashOptions = {\n modules: {[moduleName: string]: any};\n crypto?: {\n onEnd?: (result: {hash: string}) => any;\n };\n};\n\n/**\n * A transform that calculates Cryptographic Hash\n */\nexport class SHA256Hash extends CryptoHash {\n constructor(options: CryptoHashOptions) {\n super({...options, crypto: {...options.crypto, algorithm: 'SHA256'}});\n }\n}\n"],"mappings":";AACA,SAAQA,UAAU,QAAO,eAAe;AAYxC,OAAO,MAAMC,UAAU,SAASD,UAAU,CAAC;EACzCE,WAAW,CAACC,OAA0B,EAAE;IACtC,KAAK,CAAC;MAAC,GAAGA,OAAO;MAAEC,MAAM,EAAE;QAAC,GAAGD,OAAO,CAACC,MAAM;QAAEC,SAAS,EAAE;MAAQ;IAAC,CAAC,CAAC;EACvE;AACF"}
@@ -1,29 +1,24 @@
1
+
1
2
  export function toBase64(string) {
2
3
  string = "".concat(string);
3
-
4
4
  for (let i = 0; i < string.length; i++) {
5
5
  if (string.charCodeAt(i) > 255) {
6
6
  return null;
7
7
  }
8
8
  }
9
-
10
9
  let out = '';
11
-
12
10
  for (let i = 0; i < string.length; i += 3) {
13
11
  const groupsOfSix = [undefined, undefined, undefined, undefined];
14
12
  groupsOfSix[0] = string.charCodeAt(i) >> 2;
15
13
  groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;
16
-
17
14
  if (string.length > i + 1) {
18
15
  groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;
19
16
  groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;
20
17
  }
21
-
22
18
  if (string.length > i + 2) {
23
19
  groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;
24
20
  groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;
25
21
  }
26
-
27
22
  for (let j = 0; j < groupsOfSix.length; j++) {
28
23
  if (typeof groupsOfSix[j] === 'undefined') {
29
24
  out += '=';
@@ -32,7 +27,6 @@ export function toBase64(string) {
32
27
  }
33
28
  }
34
29
  }
35
-
36
30
  return out;
37
31
  }
38
32
 
@@ -40,23 +34,18 @@ function btoaLookup(idx) {
40
34
  if (idx < 26) {
41
35
  return String.fromCharCode(idx + 'A'.charCodeAt(0));
42
36
  }
43
-
44
37
  if (idx < 52) {
45
38
  return String.fromCharCode(idx - 26 + 'a'.charCodeAt(0));
46
39
  }
47
-
48
40
  if (idx < 62) {
49
41
  return String.fromCharCode(idx - 52 + '0'.charCodeAt(0));
50
42
  }
51
-
52
43
  if (idx === 62) {
53
44
  return '+';
54
45
  }
55
-
56
46
  if (idx === 63) {
57
47
  return '/';
58
48
  }
59
-
60
49
  return undefined;
61
50
  }
62
51
  //# sourceMappingURL=base64-utils.js.map
@@ -1 +1 @@
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,EAAuBA,SAAvB,EAAkCA,SAAlC,CAA5C;AACAD,IAAAA,WAAW,CAAC,CAAD,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AAJ,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
+ {"version":3,"file":"base64-utils.js","names":["toBase64","string","i","length","charCodeAt","out","groupsOfSix","undefined","j","btoaLookup","idx","String","fromCharCode"],"sources":["../../../../src/lib/utils/base64-utils.ts"],"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"],"mappings":";AAIA,OAAO,SAASA,QAAQ,CAACC,MAAc,EAAiB;EAEtDA,MAAM,aAAMA,MAAM,CAAE;EAGpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;IACtC,IAAID,MAAM,CAACG,UAAU,CAACF,CAAC,CAAC,GAAG,GAAG,EAAE;MAC9B,OAAO,IAAI;IACb;EACF;EACA,IAAIG,GAAG,GAAG,EAAE;EACZ,KAAK,IAAIH,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,CAACE,MAAM,EAAED,CAAC,IAAI,CAAC,EAAE;IAEzC,MAAMI,WAAmC,GAAG,CAACC,SAAS,EAAEA,SAAS,EAAEA,SAAS,EAAEA,SAAS,CAAC;IACxFD,WAAW,CAAC,CAAC,CAAC,GAAGL,MAAM,CAACG,UAAU,CAACF,CAAC,CAAC,IAAI,CAAC;IAC1CI,WAAW,CAAC,CAAC,CAAC,GAAG,CAACL,MAAM,CAACG,UAAU,CAACF,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC;IACnD,IAAID,MAAM,CAACE,MAAM,GAAGD,CAAC,GAAG,CAAC,EAAE;MACzBI,WAAW,CAAC,CAAC,CAAC,IAAIL,MAAM,CAACG,UAAU,CAACF,CAAC,GAAG,CAAC,CA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;EACA,IAAIA,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,GAAG;EACZ;EAEA,OAAOH,SAAS;AAClB"}
@@ -1,13 +1,14 @@
1
1
  import { toBase64 } from './base64-utils';
2
+
2
3
  export function toHex(cipher) {
3
4
  const hexString = cipher.toString(16);
4
5
  return hexString === '0' ? "0".concat(hexString) : hexString;
5
6
  }
7
+
6
8
  export function hexToBase64(hexstring) {
7
9
  if (hexstring.length % 2 !== 0) {
8
10
  hexstring = "0".concat(hexstring);
9
11
  }
10
-
11
12
  const matches = hexstring.match(/\w{2}/g) || [];
12
13
  const string = matches.map(a => String.fromCharCode(parseInt(a, 16))).join('');
13
14
  return toBase64(string) || '';
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"digest-utils.js","names":["toBase64","toHex","cipher","hexString","toString","hexToBase64","hexstring","length","matches","match","string","map","a","String","fromCharCode","parseInt","join"],"sources":["../../../../src/lib/utils/digest-utils.ts"],"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"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,gBAAgB;;AAKvC,OAAO,SAASC,KAAK,CAACC,MAAc,EAAU;EAC5C,MAAMC,SAAS,GAAGD,MAAM,CAACE,QAAQ,CAAC,EAAE,CAAC;EACrC,OAAOD,SAAS,KAAK,GAAG,cAAOA,SAAS,IAAKA,SAAS;AACxD;;AAKA,OAAO,SAASE,WAAW,CAACC,SAAiB,EAAU;EAGrD,IAAIA,SAAS,CAACC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;IAC9BD,SAAS,cAAOA,SAAS,CAAE;EAC7B;EACA,MAAME,OAAO,GAAGF,SAAS,CAACG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE;EAC/C,MAAMC,MAAM,GAAGF,OAAO,CAACG,GAAG,CAAEC,CAAC,IAAKC,MAAM,CAACC,YAAY,CAACC,QAAQ,CAACH,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAACI,IAAI,CAAC,EAAE,CAAC;EAEhF,OAAOhB,QAAQ,CAACU,MAAM,CAAC,IAAI,EAAE;AAC/B"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/types.ts"],"sourcesContent":["export type CryptoHashOptions = {\n modules?: {[moduleName: string]: any};\n crypto?: {\n algorithm;\n onEnd?;\n };\n};\n"],"mappings":""}
@@ -2,22 +2,20 @@ import { createWorker } from '@loaders.gl/worker-utils';
2
2
  import { CRC32Hash } from '../lib/crc32-hash';
3
3
  import { CRC32CHash } from '../lib/crc32c-hash';
4
4
  import { MD5Hash } from '../lib/md5-hash';
5
+
5
6
  export { CRC32Hash, CRC32CHash };
6
- createWorker(async (data, options = {}) => {
7
+ createWorker(async function (data) {
8
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7
9
  const {
8
10
  operation
9
11
  } = options;
10
-
11
12
  switch (operation) {
12
13
  case 'crc32':
13
14
  return await new CRC32Hash(options).hash(data);
14
-
15
15
  case 'crc32c':
16
16
  return await new CRC32CHash(options).hash(data);
17
-
18
17
  case 'md5':
19
18
  return await new MD5Hash(options).hash(data);
20
-
21
19
  default:
22
20
  throw new Error("invalid option: ".concat(operation));
23
21
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/workers/worker.ts"],"names":["createWorker","CRC32Hash","CRC32CHash","MD5Hash","data","options","operation","hash","Error"],"mappings":"AAAA,SAAQA,YAAR,QAA2B,0BAA3B;AACA,SAAQC,SAAR,QAAwB,mBAAxB;AACA,SAAQC,UAAR,QAAyB,oBAAzB;AACA,SAAQC,OAAR,QAAsB,iBAAtB;AAGA,SAAQF,SAAR,EAAmBC,UAAnB;AAEAF,YAAY,CAAC,OAAOI,IAAP,EAAaC,OAAO,GAAG,EAAvB,KAA8B;AAEzC,QAAM;AAACC,IAAAA;AAAD,MAAcD,OAApB;;AAEA,UAAQC,SAAR;AACE,SAAK,OAAL;AACE,aAAO,MAAM,IAAIL,SAAJ,CAAcI,OAAd,EAAuBE,IAAvB,CAA4BH,IAA5B,CAAb;;AACF,SAAK,QAAL;AACE,aAAO,MAAM,IAAIF,UAAJ,CAAeG,OAAf,EAAwBE,IAAxB,CAA6BH,IAA7B,CAAb;;AACF,SAAK,KAAL;AACE,aAAO,MAAM,IAAID,OAAJ,CAAYE,OAAZ,EAAqBE,IAArB,CAA0BH,IAA1B,CAAb;;AACF;AACE,YAAM,IAAII,KAAJ,2BAA6BF,SAA7B,EAAN;AARJ;AAUD,CAdW,CAAZ","sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"file":"worker.js"}
1
+ {"version":3,"file":"worker.js","names":["createWorker","CRC32Hash","CRC32CHash","MD5Hash","data","options","operation","hash","Error"],"sources":["../../../src/workers/worker.ts"],"sourcesContent":["import {createWorker} from '@loaders.gl/worker-utils';\nimport {CRC32Hash} from '../lib/crc32-hash';\nimport {CRC32CHash} from '../lib/crc32c-hash';\nimport {MD5Hash} from '../lib/md5-hash';\n\n// Assuming we can bundle as module\nexport {CRC32Hash, CRC32CHash};\n\ncreateWorker(async (data, options = {}) => {\n // @ts-ignore\n const {operation} = options;\n\n switch (operation) {\n case 'crc32':\n return await new CRC32Hash(options).hash(data);\n case 'crc32c':\n return await new CRC32CHash(options).hash(data);\n case 'md5':\n return await new MD5Hash(options).hash(data);\n default:\n throw new Error(`invalid option: ${operation}`);\n }\n});\n"],"mappings":"AAAA,SAAQA,YAAY,QAAO,0BAA0B;AACrD,SAAQC,SAAS,QAAO,mBAAmB;AAC3C,SAAQC,UAAU,QAAO,oBAAoB;AAC7C,SAAQC,OAAO,QAAO,iBAAiB;;AAGvC,SAAQF,SAAS,EAAEC,UAAU;AAE7BF,YAAY,CAAC,gBAAOI,IAAI,EAAmB;EAAA,IAAjBC,OAAO,uEAAG,CAAC,CAAC;EAEpC,MAAM;IAACC;EAAS,CAAC,GAAGD,OAAO;EAE3B,QAAQC,SAAS;IACf,KAAK,OAAO;MACV,OAAO,MAAM,IAAIL,SAAS,CAACI,OAAO,CAAC,CAACE,IAAI,CAACH,IAAI,CAAC;IAChD,KAAK,QAAQ;MACX,OAAO,MAAM,IAAIF,UAAU,CAACG,OAAO,CAAC,CAACE,IAAI,CAACH,IAAI,CAAC;IACjD,KAAK,KAAK;MACR,OAAO,MAAM,IAAID,OAAO,CAACE,OAAO,CAAC,CAACE,IAAI,CAACH,IAAI,CAAC;IAC9C;MACE,MAAM,IAAII,KAAK,2BAAoBF,SAAS,EAAG;EAAC;AAEtD,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Hash } from './hash';
2
- declare type CryptoHashOptions = {
2
+ type CryptoHashOptions = {
3
3
  modules: {
4
4
  [moduleName: string]: any;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"crypto-hash.d.ts","sourceRoot":"","sources":["../../src/lib/crypto-hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,aAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IACrC,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;AAIF;;;GAGG;AACH,qBAAa,UAAW,SAAQ,IAAI;IAClC,QAAQ,CAAC,IAAI,MAAC;IAEd,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC;gBAEF,OAAO,EAAE,iBAAiB;IAUhC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB9B;;;OAGG;IACG,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IASxC,WAAW,CAChB,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,WAAW,CAAC;CAa9B"}
1
+ {"version":3,"file":"crypto-hash.d.ts","sourceRoot":"","sources":["../../src/lib/crypto-hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IACrC,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;AAIF;;;GAGG;AACH,qBAAa,UAAW,SAAQ,IAAI;IAClC,QAAQ,CAAC,IAAI,MAAC;IAEd,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC;gBAEF,OAAO,EAAE,iBAAiB;IAUhC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB9B;;;OAGG;IACG,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IASxC,WAAW,CAChB,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,WAAW,CAAC;CAa9B"}
@@ -1,4 +1,4 @@
1
- declare type HashOptions = {
1
+ type HashOptions = {
2
2
  modules?: {
3
3
  [moduleName: string]: any;
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/lib/hash.ts"],"names":[],"mappings":"AAGA,aAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IACtC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,KAAK,GAAG,CAAC;KACzC,CAAC;CACH,CAAC;AAEF,+BAA+B;AAC/B,8BAAsB,IAAI;IACxB,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;gBAE3B,OAAO,GAAE,WAAgB;IAI/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAEjD,WAAW,CAChB,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,WAAW,CAAC;cAab,WAAW,CAAC,aAAa,KAAA,GAAG,OAAO,CAAC,WAAW,CAAC;CAGjE"}
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/lib/hash.ts"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE;QAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IACtC,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE;YAAC,IAAI,EAAE,MAAM,CAAA;SAAC,KAAK,GAAG,CAAC;KACzC,CAAC;CACH,CAAC;AAEF,+BAA+B;AAC/B,8BAAsB,IAAI;IACxB,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;gBAE3B,OAAO,GAAE,WAAgB;IAI/B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAEjD,WAAW,CAChB,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,WAAW,CAAC;cAab,WAAW,CAAC,aAAa,KAAA,GAAG,OAAO,CAAC,WAAW,CAAC;CAGjE"}
@@ -1,5 +1,5 @@
1
1
  import { Hash } from './hash';
2
- declare type CryptoHashOptions = {
2
+ type CryptoHashOptions = {
3
3
  crypto: {
4
4
  algorithm: string;
5
5
  onEnd?: (result: {
@@ -1 +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,M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,QAAQ,CAAC,WAAW,CAAC,GAChE,aAAa,CAAC,WAAW,CAAC;CAW9B"}
@@ -1,5 +1,5 @@
1
1
  import { CryptoHash } from './crypto-hash';
2
- declare type CryptoHashOptions = {
2
+ type CryptoHashOptions = {
3
3
  modules: {
4
4
  [moduleName: string]: any;
5
5
  };
@@ -1 +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
+ {"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,KAAK,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"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare type CryptoHashOptions = {
1
+ export type CryptoHashOptions = {
2
2
  modules?: {
3
3
  [moduleName: string]: any;
4
4
  };
@@ -1 +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"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/crypto",
3
- "version": "3.3.0-alpha.1",
3
+ "version": "3.3.0-alpha.11",
4
4
  "description": "Cryptographic/hashing plugins for loaders.gl",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/runtime": "^7.3.1",
36
- "@loaders.gl/loader-utils": "3.3.0-alpha.1",
37
- "@loaders.gl/worker-utils": "3.3.0-alpha.1",
36
+ "@loaders.gl/loader-utils": "3.3.0-alpha.11",
37
+ "@loaders.gl/worker-utils": "3.3.0-alpha.11",
38
38
  "@types/crypto-js": "^4.0.1"
39
39
  },
40
40
  "devDependencies": {
@@ -44,5 +44,5 @@
44
44
  "crypto": false,
45
45
  "sse4_crc32": false
46
46
  },
47
- "gitHead": "85ed2df7d17dd0d204c8bd8feb44779f70bc693b"
47
+ "gitHead": "1863a8875f63d578c0fdf5bdb3b7d6827f799db9"
48
48
  }