chore(frontend): partially disable storage-manager util (broken and currently not used)
This commit is contained in:
parent
fd1edb292c
commit
e85dfde4d9
@ -5,7 +5,7 @@
|
|||||||
/* global:writable */
|
/* global:writable */
|
||||||
|
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import sodium from 'sodium-javascript';
|
// import sodium from 'sodium-javascript';
|
||||||
|
|
||||||
import { HttpClient } from '../../services/http-client/http-client';
|
import { HttpClient } from '../../services/http-client/http-client';
|
||||||
|
|
||||||
@ -499,14 +499,14 @@ function encrypt(plaintext, key) {
|
|||||||
if (!key) throw new Error('Cannot encrypt plaintext without a valid key!');
|
if (!key) throw new Error('Cannot encrypt plaintext without a valid key!');
|
||||||
|
|
||||||
// TODO use const if possible
|
// TODO use const if possible
|
||||||
let plaintextB = Buffer.from(plaintext);
|
// let plaintextB = Buffer.from(plaintext);
|
||||||
let cipherB = Buffer.alloc(plaintextB.length + sodium.crypto_secretbox_MACBYTES);
|
// let cipherB = Buffer.alloc(plaintextB.length + sodium.crypto_secretbox_MACBYTES);
|
||||||
let nonceB = Buffer.alloc(sodium.crypto_secretbox_NONCEBYTES);
|
// let nonceB = Buffer.alloc(sodium.crypto_secretbox_NONCEBYTES);
|
||||||
let keyB = Buffer.from(key);
|
// let keyB = Buffer.from(key);
|
||||||
|
|
||||||
sodium.crypto_secretbox_easy(cipherB, plaintextB, nonceB, keyB);
|
// sodium.crypto_secretbox_easy(cipherB, plaintextB, nonceB, keyB);
|
||||||
|
|
||||||
const result = cipherB;
|
const result = null; // cipherB;
|
||||||
console.log('encrypt result', result);
|
console.log('encrypt result', result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -519,12 +519,12 @@ function decrypt(ciphertext, key) {
|
|||||||
if (!key) throw new Error('Cannot decrypt ciphertext without a valid key!');
|
if (!key) throw new Error('Cannot decrypt ciphertext without a valid key!');
|
||||||
|
|
||||||
// TODO use const if possible
|
// TODO use const if possible
|
||||||
let cipherB = Buffer.from(ciphertext);
|
// let cipherB = Buffer.from(ciphertext);
|
||||||
let plaintextB = undefined; Buffer.alloc(cipherB.length - sodium.crypto_secretbox_MACBYTES);
|
let plaintextB = null; // Buffer.alloc(cipherB.length - sodium.crypto_secretbox_MACBYTES);
|
||||||
let nonceB = undefined; Buffer.alloc(sodium.crypto_secretbox_NONCEBYTES);
|
// let nonceB = undefined; Buffer.alloc(sodium.crypto_secretbox_NONCEBYTES);
|
||||||
let keyB = Buffer.from(key);
|
// let keyB = Buffer.from(key);
|
||||||
|
|
||||||
sodium.crypto_secretbox_open_easy(plaintextB, cipherB, nonceB, keyB);
|
// sodium.crypto_secretbox_open_easy(plaintextB, cipherB, nonceB, keyB);
|
||||||
|
|
||||||
const result = plaintextB.toString();
|
const result = plaintextB.toString();
|
||||||
console.log('decrypt result', result);
|
console.log('decrypt result', result);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user