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

node-my-info-sg

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-my-info-sg - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

.tool-versions

4

lib/client.js

@@ -96,5 +96,3 @@ const _ = require('lodash');

// _authLevel === 'L2'
const [header, encryptedKey, iv, ciphertext, tag] = responseText.split('.');
const personDataJWS = await securityHelper.decryptJWE(header, encryptedKey, iv, ciphertext, tag, _privateKeyPath);
const personDataJWS = await securityHelper.decryptJWE(responseText, _privateKeyPath);
if (!personDataJWS) throw new Error('INVALID DATA OR SIGNATURE FOR PERSON DATA');

@@ -101,0 +99,0 @@

const _ = require('lodash');
const crypto = require('crypto');
const fs = require('fs');
const jose = require('node-jose');
const jose = require('jose');
const jwt = require('jsonwebtoken');

@@ -126,19 +126,7 @@ const qs = require('querystring');

// Decrypt JWE using private key
security.decryptJWE = async function decryptJWE(header, encryptedKey, iv, cipherText, tag, privateKey) {
security.decryptJWE = async function decryptJWE(jwe, privateKeyPath) {
try {
const keystore = jose.JWK.createKeyStore();
const data = {
type: 'compact',
ciphertext: cipherText,
protected: header,
encrypted_key: encryptedKey,
tag,
iv,
header: JSON.parse(jose.util.base64url.decode(header).toString()),
};
const jweKey = await keystore.add(fs.readFileSync(privateKey, 'utf8'), 'pem');
const result = await jose.JWE.createDecrypt(jweKey).decrypt(data);
return JSON.parse(result.payload.toString());
const privateKey = await jose.importPKCS8(fs.readFileSync(privateKeyPath, 'utf8'));
const { plaintext } = await jose.compactDecrypt(jwe, privateKey);
return JSON.parse(plaintext.toString());
} catch (error) {

@@ -145,0 +133,0 @@ throw new Error('ERROR WITH DECRYPTING JWE');

{
"name": "node-my-info-sg",
"version": "1.1.2",
"version": "2.0.0",
"description": "",

@@ -22,7 +22,10 @@ "main": "lib/client.js",

"dependencies": {
"jose": "^4.6.0",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.11",
"node-jose": "^2.0.0",
"superagent": "^5.0.2"
},
"engines": {
"node": ">=12"
},
"devDependencies": {

@@ -37,3 +40,3 @@ "@babel/core": "^7.0.0-0",

"eslint-plugin-react": "^7.11.0",
"jest": "^24.8.0",
"jest": "^27.5.1",
"jest-watch-typeahead": "^0.3.1",

@@ -40,0 +43,0 @@ "puppeteer": "^1.15.0",

@@ -21,4 +21,4 @@ import _ from 'lodash';

await page.waitFor('[name="userId"]');
await page.evaluate(() => { document.querySelector('[name="userId"]').selectedIndex = 2; });
await page.waitFor('[name="code"]');
await page.evaluate(() => { document.querySelector('[name="code"]').selectedIndex = 2; });

@@ -25,0 +25,0 @@ await page.click('button.btn-danger');

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