remove wasm
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
import pako from "pako";
|
||||
import {Buffer} from "buffer";
|
||||
//import {gzip_encode_raw,gzip_decode_raw} from 'wasm-flate';
|
||||
|
||||
const wasmFlate = window.wasm_bindgen;
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
CryptoJS.enc.Uint8Array = {
|
||||
/**
|
||||
@@ -47,7 +44,7 @@ CryptoJS.enc.Uint8Array = {
|
||||
|
||||
export function wrap(text, secretKey) {
|
||||
text = "FLAGNOTE#" + text;
|
||||
let ui8ary = noteZip(text);
|
||||
let ui8ary = noteZip(text);
|
||||
let result = aesEncrypt(convertUint8ArrayToWordArray(ui8ary), secretKey);
|
||||
return result;
|
||||
}
|
||||
@@ -96,7 +93,7 @@ export function base64Encode(text) {
|
||||
|
||||
//base64 decode atob
|
||||
export function base64Decode(text) {
|
||||
return Buffer.from(text,'base64').toString('utf-8');
|
||||
return Buffer.from(text, 'base64').toString('utf-8');
|
||||
}
|
||||
|
||||
export function noteUnzip(wdary) {
|
||||
@@ -112,29 +109,21 @@ export function noteZip(text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
export function zip(data){
|
||||
if(wasmFlate.__wbindgen_wasm_module){
|
||||
return wasmFlate.gzip_encode_raw(data);
|
||||
}
|
||||
|
||||
export function zip(data) {
|
||||
return pako.gzip(data);
|
||||
}
|
||||
|
||||
export function unzip(data){
|
||||
if(wasmFlate.__wbindgen_wasm_module){
|
||||
return wasmFlate.gzip_decode_raw(data);
|
||||
}
|
||||
|
||||
export function unzip(data) {
|
||||
return pako.ungzip(data);
|
||||
}
|
||||
|
||||
|
||||
export function convertBase64ToHexString(base64) {
|
||||
return CryptoJS.enc.Hex.stringify(CryptoJS.enc.Base64.parse(base64));
|
||||
return CryptoJS.enc.Hex.stringify(CryptoJS.enc.Base64.parse(base64));
|
||||
}
|
||||
|
||||
export function convertHexStringToBase64(hexString) {
|
||||
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(hexString));
|
||||
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(hexString));
|
||||
}
|
||||
|
||||
export function convertHexStringToUint8Array(hexString) {
|
||||
|
||||
Reference in New Issue
Block a user