Skip to content
Snippets Groups Projects
Commit 326eb6fc authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

Merge branch 'debug-seal' into 'master'

Replace compression library

See merge request !88
parents d617bdd3 41d54358
No related branches found
No related tags found
1 merge request!88Replace compression library
Pipeline #48926 passed
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
...@@ -10,7 +29,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge ...@@ -10,7 +29,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.isNode = exports.getMerkleTreeRootHash = exports.decodeBase64URL = exports.encodeBase64Url = exports.arrayBufferToHex = exports.decompressData = exports.compressData = exports.ensureUint8Array = exports.ensureArrayBuffer = exports.ensureBase64 = exports.base64ToArrayBuffer = exports.arrayBufferToBase64 = void 0; exports.isNode = exports.getMerkleTreeRootHash = exports.decodeBase64URL = exports.encodeBase64Url = exports.arrayBufferToHex = exports.decompressData = exports.compressData = exports.ensureUint8Array = exports.ensureArrayBuffer = exports.ensureBase64 = exports.base64ToArrayBuffer = exports.arrayBufferToBase64 = void 0;
const zlib_min_1 = require("zlibjs/bin/zlib.min"); const fflate = __importStar(require("fflate"));
const index_1 = require("../index"); const index_1 = require("../index");
const arrayBufferToBase64 = (buffer) => { const arrayBufferToBase64 = (buffer) => {
return Buffer.from(buffer).toString("base64"); return Buffer.from(buffer).toString("base64");
...@@ -39,13 +58,11 @@ const ensureUint8Array = (data) => { ...@@ -39,13 +58,11 @@ const ensureUint8Array = (data) => {
}; };
exports.ensureUint8Array = ensureUint8Array; exports.ensureUint8Array = ensureUint8Array;
const compressData = (binary) => { const compressData = (binary) => {
const deflate = new zlib_min_1.Zlib.Deflate((0, exports.ensureUint8Array)(binary)); return fflate.gzipSync((0, exports.ensureUint8Array)(binary));
return deflate.compress();
}; };
exports.compressData = compressData; exports.compressData = compressData;
const decompressData = (binary) => { const decompressData = (binary) => {
const inflate = new zlib_min_1.Zlib.Inflate((0, exports.ensureUint8Array)(binary)); return fflate.decompressSync((0, exports.ensureUint8Array)(binary));
return inflate.decompress();
}; };
exports.decompressData = decompressData; exports.decompressData = decompressData;
const arrayBufferToHex = (buffer) => { const arrayBufferToHex = (buffer) => {
......
{ {
"name": "@vereign/light-utils", "name": "@vereign/light-utils",
"version": "v2.0.7", "version": "v2.0.8",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
...@@ -41,12 +41,12 @@ ...@@ -41,12 +41,12 @@
"easyqrcodejs": "^4.3.1", "easyqrcodejs": "^4.3.1",
"easyqrcodejs-nodejs": "^4.4.2", "easyqrcodejs-nodejs": "^4.4.2",
"eventemitter2": "^6.4.3", "eventemitter2": "^6.4.3",
"fflate": "^0.7.3",
"google-protobuf": "^3.13.0", "google-protobuf": "^3.13.0",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"penpal": "^5.3.0", "penpal": "^5.3.0",
"protobufjs": "^6.10.1", "protobufjs": "^6.10.1",
"url-parse": "^1.4.7", "url-parse": "^1.4.7"
"zlibjs": "^0.3.1"
}, },
"peerDependencies": {} "peerDependencies": {}
} }
import { Zlib } from "zlibjs/bin/zlib.min"; import * as fflate from "fflate";
import { CryptoService } from "../index"; import { CryptoService } from "../index";
export const arrayBufferToBase64 = (buffer: ArrayBuffer): string => { export const arrayBufferToBase64 = (buffer: ArrayBuffer): string => {
...@@ -30,13 +30,11 @@ export const ensureUint8Array = ( ...@@ -30,13 +30,11 @@ export const ensureUint8Array = (
}; };
export const compressData = (binary: string | ArrayBuffer): ArrayBuffer => { export const compressData = (binary: string | ArrayBuffer): ArrayBuffer => {
const deflate = new Zlib.Deflate(ensureUint8Array(binary)); return fflate.gzipSync(ensureUint8Array(binary));
return deflate.compress();
}; };
export const decompressData = (binary: string | ArrayBuffer): ArrayBuffer => { export const decompressData = (binary: string | ArrayBuffer): ArrayBuffer => {
const inflate = new Zlib.Inflate(ensureUint8Array(binary)); return fflate.decompressSync(ensureUint8Array(binary));
return inflate.decompress();
}; };
export const arrayBufferToHex = (buffer: ArrayBuffer): string => { export const arrayBufferToHex = (buffer: ArrayBuffer): string => {
......
...@@ -2662,6 +2662,11 @@ fd-slicer@~1.1.0: ...@@ -2662,6 +2662,11 @@ fd-slicer@~1.1.0:
dependencies: dependencies:
pend "~1.2.0" pend "~1.2.0"
fflate@^0.7.3:
version "0.7.3"
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.7.3.tgz#288b034ff0e9c380eaa2feff48c787b8371b7fa5"
integrity sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw==
file-entry-cache@^6.0.1: file-entry-cache@^6.0.1:
version "6.0.1" version "6.0.1"
resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
...@@ -5722,8 +5727,3 @@ yocto-queue@^0.1.0: ...@@ -5722,8 +5727,3 @@ yocto-queue@^0.1.0:
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
zlibjs@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/zlibjs/-/zlibjs-0.3.1.tgz#50197edb28a1c42ca659cc8b4e6a9ddd6d444554"
integrity sha1-UBl+2yihxCymWcyLTmqd3W1ERVQ=
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment