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.4.3 to 0.5.0-0.5.0-beta.1.0

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.4.3",
"version": "0.5.0-0.5.0-beta.1.0",
"description": "Cryptographic functions for building Burstcoin apps.",

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

},
"gitHead": "287dde637cda6bfde1252978c4730d3f96cafef8",
"gitHead": "19a030e2278c21ff762c927ef1fb7daad330a6a1",
"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