Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@24hr/seqcryptor

Package Overview
Dependencies
Maintainers
7
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@24hr/seqcryptor - npm Package Compare versions

Comparing version
0.8.8
to
0.8.9
+6
-0
build/index.js

@@ -27,2 +27,5 @@ "use strict";

}
if (rawData === undefined) {
return rawData;
}
const decryptedData = (0, exports.decrypt)(secret, rawData, options.returnRawOnUnecrypted, options.defaultValue);

@@ -39,2 +42,5 @@ if (options.type === sequelize_1.DataTypes.JSONB || options.type === sequelize_1.DataTypes.JSON) {

}
if (value === undefined) {
return;
}
let parsedValue = value;

@@ -41,0 +47,0 @@ if (options.type === sequelize_1.DataTypes.JSONB || options.type === sequelize_1.DataTypes.JSON) {

+1
-1
{
"name": "@24hr/seqcryptor",
"version": "0.8.8",
"version": "0.8.9",
"description": "",

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

@@ -34,2 +34,5 @@ import crypto from 'crypto';

}
if (rawData === undefined) {
return rawData;
}
const decryptedData = decrypt(secret, rawData, options.returnRawOnUnecrypted, options.defaultValue);

@@ -46,2 +49,5 @@ if (options.type === DataTypes.JSONB || options.type === DataTypes.JSON) {

}
if (value === undefined) {
return;
}
let parsedValue = value;

@@ -48,0 +54,0 @@ if (options.type === DataTypes.JSONB || options.type === DataTypes.JSON) {

@@ -100,3 +100,3 @@ import { DataTypes, Model, Sequelize } from 'sequelize';

it('Can encrypt a field that has null as a value', async () => {
it('Can encrypt a field that has null or undefined as a value', async () => {

@@ -132,20 +132,27 @@ const encryptor = seqCryptor('_SUPER_SECRET_KEY_WITH_32_BYTES_');

const user = await User.create({
name: null,
guid,
});
expect(user!.name).toEqual(null);
const user = await User.create({
name: null,
guid,
});
expect(user!.name).toEqual(null);
const userRaw = await User.findOne({ where: { guid: guid }, raw: true });
expect(userRaw!.name).toEqual(null);
const userRaw = await User.findOne({ where: { guid: guid }, raw: true });
expect(userRaw!.name).toEqual(null);
const userFromDb = await User.findOne({ where: { guid: guid } });
await userFromDb!.update({ name: 'hej' });
expect(userFromDb!.name).toEqual('hej');
await userFromDb!.update({ name: null });
expect(userFromDb!.name).toEqual(null);
const userFromDb = await User.findOne({ where: { guid: guid } });
await userFromDb!.update({ name: 'hej' });
expect(userFromDb!.name).toEqual('hej');
await userFromDb!.update({ name: null });
expect(userFromDb!.name).toEqual(null);
await userFromDb!.update({ name: undefined });
expect(userFromDb!.name).toEqual(null);
});
const user2 = await User.create({
name: undefined,
guid: 'a7abcc8b-3096-4431-ae9b-93e6cf3f8d43',
});
expect(user2!.name).toEqual(undefined);
});

@@ -152,0 +159,0 @@ });