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

@stratumn/js-crypto

Package Overview
Dependencies
Maintainers
10
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stratumn/js-crypto - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

12

lib/aes/index.js

@@ -25,2 +25,4 @@ 'use strict';

this.encrypt = function (message) {
var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf8';
var iv = _nodeForge.random.getBytesSync(SALT_LENGTH);

@@ -32,3 +34,3 @@ var ci = _nodeForge.cipher.createCipher('AES-GCM', _this._key);

ci.start({ iv: iv, tagLength: TAG_LENGTH * 8 });
ci.update(_nodeForge.util.createBuffer(message));
ci.update(_nodeForge.util.createBuffer(message, encoding));
ci.finish();

@@ -41,2 +43,4 @@

this.decrypt = function (ciphertext) {
var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf8';
if (ciphertext.length <= SALT_LENGTH + TAG_LENGTH) {

@@ -56,3 +60,3 @@ throw new Error('wrong ciphertext format');

}
return de.output.data;
return encoding === 'binary' ? Buffer.from(de.output.data, 'binary') : de.output.toString(encoding);
};

@@ -71,2 +75,3 @@

Encrypts a message with the symmetric key.
The encoding may be specified with the following values: 'utf8' (default), 'ascii', 'binary'
It formats the encrypted message as follows:

@@ -79,2 +84,5 @@ - base64(<iv><ciphertext><tag>)

Decrypts a message with the symmetric key.
The encoding may be specified with the following values: 'utf8' (default), 'ascii', 'binary'.
Returns the decoded message as a string except if the encoding is set to
'binary' (in which case the result will be a Buffer or an Uint8Array).
It accepts a message formatted as follows:

@@ -81,0 +89,0 @@ - base64(<iv><ciphertext><tag>)

2

package.json
{
"name": "@stratumn/js-crypto",
"version": "1.0.0",
"version": "1.1.0",
"description": "Browser compatible crypto",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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