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

@tsmx/string-crypto

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsmx/string-crypto - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

4

package.json
{
"name": "@tsmx/string-crypto",
"version": "1.0.4",
"version": "1.0.5",
"description": "Encrypt and decrypt strings.",

@@ -30,4 +30,4 @@ "main": "string-crypto.js",

"devDependencies": {
"jest": "^26.5.2"
"jest": "^29.2.2"
}
}

@@ -6,3 +6,3 @@ # [**@tsmx/string-crypto**](https://github.com/tsmx/string-crypto)

![node-current (scoped)](https://img.shields.io/node/v/@tsmx/string-crypto)
[![Build Status](https://img.shields.io/github/workflow/status/tsmx/string-crypto/git-ci-build)](https://img.shields.io/github/workflow/status/tsmx/string-crypto/git-ci-build)
[![Build Status](https://img.shields.io/github/actions/workflow/status/tsmx/string-crypto/git-build.yml?branch=master)](https://img.shields.io/github/actions/workflow/status/tsmx/string-crypto/git-build.yml?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/tsmx/string-crypto/badge.svg?branch=master)](https://coveralls.io/github/tsmx/string-crypto?branch=master)

@@ -9,0 +9,0 @@

@@ -17,3 +17,3 @@ const { expect } = require('@jest/globals');

it('tests a successful encryption and decryption with char key from environment var', async (done) => {
it('tests a successful encryption and decryption with char key from environment var', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;

@@ -28,6 +28,5 @@ const sc = require('../string-crypto');

expect(decrypted).toStrictEqual(testString);
done();
});
it('tests a successful encryption and decryption with hex key from environment var', async (done) => {
it('tests a successful encryption and decryption with hex key from environment var', async () => {
process.env['ENCRYPTION_KEY'] = testKeyHex;

@@ -42,6 +41,5 @@ const sc = require('../string-crypto');

expect(decrypted).toStrictEqual(testString);
done();
});
it('tests a successful encryption and decryption with char key from options', async (done) => {
it('tests a successful encryption and decryption with char key from options', async () => {
const options = {

@@ -58,6 +56,5 @@ key: testKeyChar

expect(decrypted).toStrictEqual(testString);
done();
});
it('tests a successful encryption and decryption with hex key from options', async (done) => {
it('tests a successful encryption and decryption with hex key from options', async () => {
const options = {

@@ -74,25 +71,21 @@ key: testKeyHex

expect(decrypted).toStrictEqual(testString);
done();
});
it('tests a failed encryption because of missing key', async (done) => {
it('tests a failed encryption because of missing key', async () => {
const sc = require('../string-crypto');
expect(() => { sc.encrypt(testString); }).toThrow('Key not found.');
done();
});
it('tests a failed encryption because of wrong key length from environment var', async (done) => {
it('tests a failed encryption because of wrong key length from environment var', async () => {
const sc = require('../string-crypto');
process.env['ENCRYPTION_KEY'] = testKeyCharWrongLength;
expect(() => { sc.encrypt(testString); }).toThrow('Key length');
done();
});
it('tests a failed encryption because of wrong key length from options', async (done) => {
it('tests a failed encryption because of wrong key length from options', async () => {
const sc = require('../string-crypto');
expect(() => { sc.encrypt(testString, { key: testKeyCharWrongLength }); }).toThrow('Key length');
done();
});
it('tests a failed decryption because of a wrong key', async (done) => {
it('tests a failed decryption because of a wrong key', async () => {
const sc = require('../string-crypto');

@@ -105,48 +98,41 @@ const encrypted = sc.encrypt(testString, { key: testKeyChar });

expect(() => { sc.decrypt(encrypted, { key: testKeyCharBad }); }).toThrow('Decryption failed.');
done();
});
it('tests a failed encryption of null', async (done) => {
it('tests a failed encryption of null', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;
const sc = require('../string-crypto');
expect(() => { sc.encrypt(null); }).toThrow('must not be null');
done();
});
it('tests a failed encryption of null with options.passNull set to false', async (done) => {
it('tests a failed encryption of null with options.passNull set to false', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;
const sc = require('../string-crypto');
expect(() => { sc.encrypt(null, { passNull: false }); }).toThrow('must not be null');
done();
});
it('tests a successful encryption passthrough of null with options.passNull set to true', async (done) => {
it('tests a successful encryption passthrough of null with options.passNull set to true', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;
const sc = require('../string-crypto');
expect(sc.encrypt(null, { passNull: true })).toStrictEqual(null);
done();
});
it('tests a failed decryption of null', async (done) => {
it('tests a failed decryption of null', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;
const sc = require('../string-crypto');
expect(() => { sc.decrypt(null); }).toThrow('must not be null');
done();
});
it('tests a failed decryption of null with options.passNull set to false', async (done) => {
it('tests a failed decryption of null with options.passNull set to false', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;
const sc = require('../string-crypto');
expect(() => { sc.decrypt(null, { passNull: false }); }).toThrow('must not be null');
done();
});
it('tests a successful decryption passthrough of null with options.passNull set to true', async (done) => {
it('tests a successful decryption passthrough of null with options.passNull set to true', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;
const sc = require('../string-crypto');
expect(sc.decrypt(null, { passNull: true })).toStrictEqual(null);
done();
});
it('tests a successful encryption and decryption passthrough of null', async (done) => {
it('tests a successful encryption and decryption passthrough of null', async () => {
process.env['ENCRYPTION_KEY'] = testKeyChar;

@@ -159,5 +145,4 @@ const sc = require('../string-crypto');

expect(decrypted).toStrictEqual(null);
done();
});
});

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