Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@burstjs/crypto

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@burstjs/crypto - npm Package Compare versions

Comparing version 0.5.0-alpha.2 to 0.5.0-alpha.3

21

out/decryptAES.js

@@ -5,22 +5,5 @@ "use strict";

exports.decryptAES = (encryptedBase64, key) => {
const encoded = encryptedBase64;
let retrials = 0;
while (retrials < 10) {
try {
const decrypted = CryptoJS.AES.decrypt(encoded, key);
if (decrypted) {
const str = decrypted.toString(CryptoJS.enc.Utf8);
if (str.length > 0) {
return str;
}
}
}
catch (e) {
}
finally {
retrials++;
}
}
return '';
const decrypted = CryptoJS.AES.decrypt(encryptedBase64, key);
return decrypted && decrypted.toString(CryptoJS.enc.Utf8);
};
//# sourceMappingURL=decryptAES.js.map

4

package.json
{
"name": "@burstjs/crypto",
"version": "0.5.0-alpha.2",
"version": "0.5.0-alpha.3",
"description": "Cryptographic functions for building Burstcoin apps.",

@@ -60,3 +60,3 @@ "contributors": [

},
"gitHead": "50ee74a37a7964ce327930d7a4264ee5d9adc2e2",
"gitHead": "92c2c5bf2ce352638613fe27ab1f247552d1b376",
"publishConfig": {

@@ -63,0 +63,0 @@ "access": "public"

@@ -17,2 +17,13 @@ import {encryptAES} from '../encryptAES';

it('should encrypt/decrypt correctly unicode', () => {
const secret = 'secret';
const Message = '\u01F6 with Unicode';
const encrypted = encryptAES(Message, secret);
const decrypted = decryptAES(encrypted, secret);
expect(decrypted).toBe(Message);
});
it('should NOT encrypt/decrypt correctly', () => {

@@ -19,0 +30,0 @@

@@ -12,22 +12,4 @@ /** @module crypto */

export const decryptAES = (encryptedBase64: string, key: string): string => {
const encoded = encryptedBase64;
// decrypt may throw an error occasionally...retrial may fix this
let retrials = 0;
while (retrials < 10) {
try {
const decrypted = CryptoJS.AES.decrypt(encoded, key);
if (decrypted) {
const str = decrypted.toString(CryptoJS.enc.Utf8);
if (str.length > 0) {
return str;
}
}
} catch (e) {
// no op
} finally {
retrials++;
}
}
return '';
const decrypted = CryptoJS.AES.decrypt(encryptedBase64, key);
return decrypted && decrypted.toString(CryptoJS.enc.Utf8);
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc