@loaders.gl/crypto 3.4.13 → 3.4.15

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.
@@ -6,25 +6,25 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.toBase64 = toBase64;
7
7
  function toBase64(string) {
8
8
  string = "".concat(string);
9
- for (var i = 0; i < string.length; i++) {
9
+ for (let i = 0; i < string.length; i++) {
10
10
  if (string.charCodeAt(i) > 255) {
11
11
  return null;
12
12
  }
13
13
  }
14
- var out = '';
15
- for (var _i = 0; _i < string.length; _i += 3) {
16
- var groupsOfSix = [undefined, undefined, undefined, undefined];
17
- groupsOfSix[0] = string.charCodeAt(_i) >> 2;
18
- groupsOfSix[1] = (string.charCodeAt(_i) & 0x03) << 4;
19
- if (string.length > _i + 1) {
20
- groupsOfSix[1] |= string.charCodeAt(_i + 1) >> 4;
21
- groupsOfSix[2] = (string.charCodeAt(_i + 1) & 0x0f) << 2;
14
+ let out = '';
15
+ for (let i = 0; i < string.length; i += 3) {
16
+ const groupsOfSix = [undefined, undefined, undefined, undefined];
17
+ groupsOfSix[0] = string.charCodeAt(i) >> 2;
18
+ groupsOfSix[1] = (string.charCodeAt(i) & 0x03) << 4;
19
+ if (string.length > i + 1) {
20
+ groupsOfSix[1] |= string.charCodeAt(i + 1) >> 4;
21
+ groupsOfSix[2] = (string.charCodeAt(i + 1) & 0x0f) << 2;
22
22
  }
23
- if (string.length > _i + 2) {
24
- groupsOfSix[2] |= string.charCodeAt(_i + 2) >> 6;
25
- groupsOfSix[3] = string.charCodeAt(_i + 2) & 0x3f;
23
+ if (string.length > i + 2) {
24
+ groupsOfSix[2] |= string.charCodeAt(i + 2) >> 6;
25
+ groupsOfSix[3] = string.charCodeAt(i + 2) & 0x3f;
26
26
  }
27
- for (var j = 0; j < groupsOfSix.length; j++) {
27
+ for (let j = 0; j < groupsOfSix.length; j++) {
28
28
  if (typeof groupsOfSix[j] === 'undefined') {
29
29
  out += '=';
30
30
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"base64-utils.js","names":["toBase64","string","concat","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_CH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GAAGN,MAAM,CAACI,UAAU,CAACF,EAAC,GAAG,CAAC,CAAC,GAAG,IAAI;IAClD;IACA,KAAK,IAAIM,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,WAAW,CAACH,MAAM,EAAEK,CAAC,EAAE,EAAE;MAC3C,IAAI,OAAOF,WAAW,CAACE,CAAC,CAAC,KAAK,WAAW,EAAE;QACzCH,GAAG,IAAI,GAAG;MACZ,CAAC,MAAM;QACLA,GAAG,IAAII,UAAU,CAACH,WAAW,CAACE,CAAC,CAAC,CAAC;MACnC;IACF;EACF;EACA,OAAOH,GAAG;AACZ;AAMA,SAASI,UAAUA,CAACC,GAAG,EAAE;EACvB,IAAIA,GAAG,GAAG,EAAE,EAAE;IACZ,OAAOC,MAAM,CAACC,YAAY,CAACF,GAAG,GAAG,GAAG,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC;EACrD;EACA,IAAIM,GAAG,GAAG,EAAE,EAAE;IACZ,OAAOC,MAAM,CAACC,YAAY,CAACF,GAAG,GAAG,EAAE,GAAG,GAAG,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC;EAC1D;EACA,IAAIM,GAAG,GAAG,EAAE,EAAE;IACZ,OAAOC,MAAM,CAACC,YAAY,CAACF,GAAG,GAAG,EAAE,GAAG,GAAG,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC;EAC1D;EACA,IAAIM,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,GAAG;EACZ;EACA,IAAIA,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,GAAG;EACZ;EAEA,OAAOH,SAAS;AAClB"}
1
+ {"version":3,"file":"base64-utils.js","names":["toBase64","string","concat","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":";;;;;;AAIO,SAASA,QAAQA,CAACC,MAAc,EAAiB;EAEtDA,MAAM,MAAAC,MAAA,CAAMD,MAAM,CAAE;EAGpB,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACtC,IAAIF,MAAM,CAAC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AAC,MAAM;QACLA,GAAG,IAAII,UAAU,CAACH,WAAW,CAACE,CAAC,CAAC,CAAC;MACnC;IACF;EACF;EACA,OAAOH,GAAG;AACZ;AAMA,SAASI,UAAUA,CAACC,GAAG,EAAE;EACvB,IAAIA,GAAG,GAAG,EAAE,EAAE;IACZ,OAAOC,MAAM,CAACC,YAAY,CAACF,GAAG,GAAG,GAAG,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC;EACrD;EACA,IAAIM,GAAG,GAAG,EAAE,EAAE;IACZ,OAAOC,MAAM,CAACC,YAAY,CAACF,GAAG,GAAG,EAAE,GAAG,GAAG,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC;EAC1D;EACA,IAAIM,GAAG,GAAG,EAAE,EAAE;IACZ,OAAOC,MAAM,CAACC,YAAY,CAACF,GAAG,GAAG,EAAE,GAAG,GAAG,CAACN,UAAU,CAAC,CAAC,CAAC,CAAC;EAC1D;EACA,IAAIM,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,GAAG;EACZ;EACA,IAAIA,GAAG,KAAK,EAAE,EAAE;IACd,OAAO,GAAG;EACZ;EAEA,OAAOH,SAAS;AAClB"}
@@ -7,17 +7,15 @@ exports.hexToBase64 = hexToBase64;
7
7
  exports.toHex = toHex;
8
8
  var _base64Utils = require("./base64-utils");
9
9
  function toHex(cipher) {
10
- var hexString = cipher.toString(16);
10
+ const hexString = cipher.toString(16);
11
11
  return hexString === '0' ? "0".concat(hexString) : hexString;
12
12
  }
13
13
  function hexToBase64(hexstring) {
14
14
  if (hexstring.length % 2 !== 0) {
15
15
  hexstring = "0".concat(hexstring);
16
16
  }
17
- var matches = hexstring.match(/\w{2}/g) || [];
18
- var string = matches.map(function (a) {
19
- return String.fromCharCode(parseInt(a, 16));
20
- }).join('');
17
+ const matches = hexstring.match(/\w{2}/g) || [];
18
+ const string = matches.map(a => String.fromCharCode(parseInt(a, 16))).join('');
21
19
  return (0, _base64Utils.toBase64)(string) || '';
22
20
  }
23
21
  //# sourceMappingURL=digest-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"digest-utils.js","names":["_base64Utils","require","toHex","cipher","hexString","toString","concat","hexToBase64","hexstring","length","matches","match","string","map","a","String","fromCharCode","parseInt","join","toBase64"],"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,IAAAA,YAAA,GAAAC,OAAA;AAKO,SAASC,KAAKA,CAACC,MAAc,EAAU;EAC5C,IAAMC,SAAS,GAAGD,MAAM,CAACE,QAAQ,CAAC,EAAE,CAAC;EACrC,OAAOD,SAAS,KAAK,GAAG,OAAAE,MAAA,CAAOF,SAAS,IAAKA,SAAS;AACxD;AAKO,SAASG,WAAWA,CAACC,SAAiB,EAAU;EAGrD,IAAIA,SAAS,CAACC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;IAC9BD,SAAS,OAAAF,MAAA,CAAOE,SAAS,CAAE;EAC7B;EACA,IAAME,OAAO,GAAGF,SAAS,CAACG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE;EAC/C,IAAMC,MAAM,GAAGF,OAAO,CAACG,GAAG,CAAC,UAACC,CAAC;IAAA,OAAKC,MAAM,CAACC,YAAY,CAACC,QAAQ,CAACH,CAAC,EAAE,EAAE,CAAC,CAAC;EAAA,EAAC,CAACI,IAAI,CAAC,EAAE,CAAC;EAEhF,OAAO,IAAAC,qBAAQ,EAACP,MAAM,CAAC,IAAI,EAAE;AAC/B"}
1
+ {"version":3,"file":"digest-utils.js","names":["_base64Utils","require","toHex","cipher","hexString","toString","concat","hexToBase64","hexstring","length","matches","match","string","map","a","String","fromCharCode","parseInt","join","toBase64"],"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,IAAAA,YAAA,GAAAC,OAAA;AAKO,SAASC,KAAKA,CAACC,MAAc,EAAU;EAC5C,MAAMC,SAAS,GAAGD,MAAM,CAACE,QAAQ,CAAC,EAAE,CAAC;EACrC,OAAOD,SAAS,KAAK,GAAG,OAAAE,MAAA,CAAOF,SAAS,IAAKA,SAAS;AACxD;AAKO,SAASG,WAAWA,CAACC,SAAiB,EAAU;EAGrD,IAAIA,SAAS,CAACC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;IAC9BD,SAAS,OAAAF,MAAA,CAAOE,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,OAAO,IAAAC,qBAAQ,EAACP,MAAM,CAAC,IAAI,EAAE;AAC/B"}
@@ -1,65 +1,38 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  Object.defineProperty(exports, "CRC32CHash", {
8
7
  enumerable: true,
9
- get: function get() {
8
+ get: function () {
10
9
  return _crc32cHash.CRC32CHash;
11
10
  }
12
11
  });
13
12
  Object.defineProperty(exports, "CRC32Hash", {
14
13
  enumerable: true,
15
- get: function get() {
14
+ get: function () {
16
15
  return _crc32Hash.CRC32Hash;
17
16
  }
18
17
  });
19
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
20
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
21
18
  var _workerUtils = require("@loaders.gl/worker-utils");
22
19
  var _crc32Hash = require("../lib/crc32-hash");
23
20
  var _crc32cHash = require("../lib/crc32c-hash");
24
21
  var _md5Hash = require("../lib/md5-hash");
25
- (0, _workerUtils.createWorker)(function () {
26
- var _ref = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(data) {
27
- var options,
28
- operation,
29
- _args = arguments;
30
- return _regenerator.default.wrap(function _callee$(_context) {
31
- while (1) switch (_context.prev = _context.next) {
32
- case 0:
33
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
34
- operation = options.operation;
35
- _context.t0 = operation;
36
- _context.next = _context.t0 === 'crc32' ? 5 : _context.t0 === 'crc32c' ? 8 : _context.t0 === 'md5' ? 11 : 14;
37
- break;
38
- case 5:
39
- _context.next = 7;
40
- return new _crc32Hash.CRC32Hash(options).hash(data);
41
- case 7:
42
- return _context.abrupt("return", _context.sent);
43
- case 8:
44
- _context.next = 10;
45
- return new _crc32cHash.CRC32CHash(options).hash(data);
46
- case 10:
47
- return _context.abrupt("return", _context.sent);
48
- case 11:
49
- _context.next = 13;
50
- return new _md5Hash.MD5Hash(options).hash(data);
51
- case 13:
52
- return _context.abrupt("return", _context.sent);
53
- case 14:
54
- throw new Error("invalid option: ".concat(operation));
55
- case 15:
56
- case "end":
57
- return _context.stop();
58
- }
59
- }, _callee);
60
- }));
61
- return function (_x) {
62
- return _ref.apply(this, arguments);
63
- };
64
- }());
22
+ (0, _workerUtils.createWorker)(async function (data) {
23
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
24
+ const {
25
+ operation
26
+ } = options;
27
+ switch (operation) {
28
+ case 'crc32':
29
+ return await new _crc32Hash.CRC32Hash(options).hash(data);
30
+ case 'crc32c':
31
+ return await new _crc32cHash.CRC32CHash(options).hash(data);
32
+ case 'md5':
33
+ return await new _md5Hash.MD5Hash(options).hash(data);
34
+ default:
35
+ throw new Error("invalid option: ".concat(operation));
36
+ }
37
+ });
65
38
  //# sourceMappingURL=worker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.js","names":["_workerUtils","require","_crc32Hash","_crc32cHash","_md5Hash","createWorker","_ref","_asyncToGenerator2","default","_regenerator","mark","_callee","data","options","operation","_args","arguments","wrap","_callee$","_context","prev","next","length","undefined","t0","CRC32Hash","hash","abrupt","sent","CRC32CHash","MD5Hash","Error","concat","stop","_x","apply"],"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"],"m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ACa,IAAI,CAACd,IAAI,CAAC;QAAA;UAAA,OAAAO,QAAA,CAAAQ,MAAA,WAAAR,QAAA,CAAAS,IAAA;QAAA;UAAA,MAEtC,IAAIG,KAAK,oBAAAC,MAAA,CAAoBlB,SAAS,CAAE,CAAC;QAAA;QAAA;UAAA,OAAAK,QAAA,CAAAc,IAAA;MAAA;IAAA,GAAAtB,OAAA;EAAA,CAEpD;EAAA,iBAAAuB,EAAA;IAAA,OAAA5B,IAAA,CAAA6B,KAAA,OAAAnB,SAAA;EAAA;AAAA,IAAC"}
1
+ {"version":3,"file":"worker.js","names":["_workerUtils","require","_crc32Hash","_crc32cHash","_md5Hash","createWorker","data","options","arguments","length","undefined","operation","CRC32Hash","hash","CRC32CHash","MD5Hash","Error","concat"],"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,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,yBAAY,EAAC,gBAAOC,IAAI,EAAmB;EAAA,IAAjBC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEpC,MAAM;IAACG;EAAS,CAAC,GAAGJ,OAAO;EAE3B,QAAQI,SAAS;IACf,KAAK,OAAO;MACV,OAAO,MAAM,IAAIC,oBAAS,CAACL,OAAO,CAAC,CAACM,IAAI,CAACP,IAAI,CAAC;IAChD,KAAK,QAAQ;MACX,OAAO,MAAM,IAAIQ,sBAAU,CAACP,OAAO,CAAC,CAACM,IAAI,CAACP,IAAI,CAAC;IACjD,KAAK,KAAK;MACR,OAAO,MAAM,IAAIS,gBAAO,CAACR,OAAO,CAAC,CAACM,IAAI,CAACP,IAAI,CAAC;IAC9C;MACE,MAAM,IAAIU,KAAK,oBAAAC,MAAA,CAAoBN,SAAS,CAAE,CAAC;EACnD;AACF,CAAC,CAAC"}
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { SHA256Hash } from './lib/sha256-hash';
5
5
  export { CryptoHash } from './lib/crypto-hash';
6
6
  export { NodeHash } from './lib/node-hash';
7
7
  export { hexToBase64 as _hexToBase64, toHex as _toHex } from './lib/utils/digest-utils';
8
- const VERSION = typeof "3.4.13" !== 'undefined' ? "3.4.13" : 'latest';
8
+ const VERSION = typeof "3.4.15" !== 'undefined' ? "3.4.15" : 'latest';
9
9
  export const CryptoWorker = {
10
10
  id: 'crypto',
11
11
  name: 'CRC32, CRC32c and MD5 Hashes',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/crypto",
3
- "version": "3.4.13",
3
+ "version": "3.4.15",
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.4.13",
37
- "@loaders.gl/worker-utils": "3.4.13",
36
+ "@loaders.gl/loader-utils": "3.4.15",
37
+ "@loaders.gl/worker-utils": "3.4.15",
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": "be8849c02972ce541e01720d29b976f830d6af92"
47
+ "gitHead": "19e941d5805568e449ef9092490d6568a4853298"
48
48
  }