From ce365e92481a4e723c0b87b6d0e8b5f7044f81f1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 1 Aug 2016 09:50:46 -0400 Subject: [PATCH] cleanup / bugfix 'keypair._forge && ...' --- lib/rsa-extra.js | 6 +++--- lib/rsa-forge.js | 6 +++--- node.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/rsa-extra.js b/lib/rsa-extra.js index efdd888..6f18595 100644 --- a/lib/rsa-extra.js +++ b/lib/rsa-extra.js @@ -110,7 +110,7 @@ var extrac = module.exports = { , exportPrivateJwk: function (keypair) { var hasUrsaPrivate = keypair._ursa && true; var hasPrivatePem = keypair.privateKeyPem && true; - var hasForgePrivate = keypair._forge && keypair._forge && true; + var hasForgePrivate = keypair._forge && true; if (keypair.privateKeyJwk) { return keypair.privateKeyJwk; @@ -126,7 +126,7 @@ var extrac = module.exports = { } } - if (keypair._forge && keypair._forge) { + if (keypair._forge) { return extrac._forgeToPrivateJwk(keypair); } @@ -159,7 +159,7 @@ var extrac = module.exports = { } } - if (keypair._forge && keypair._forge) { + if (keypair._forge) { return extrac._forgeToPublicJwk(keypair); } diff --git a/lib/rsa-forge.js b/lib/rsa-forge.js index 329a925..8ddd5f7 100644 --- a/lib/rsa-forge.js +++ b/lib/rsa-forge.js @@ -132,11 +132,11 @@ var forgec = module.exports = { return keypair.privateKeyPem; } - if (keypair.privateKeyJwk && !(keypair._forge && keypair._forge)) { + if (keypair.privateKeyJwk && !keypair._forge) { forgec._forgeImportJwk(keypair); } - if (keypair._forge && keypair._forge) { + if (keypair._forge) { return forge.pki.privateKeyToPem(keypair._forge); } @@ -148,7 +148,7 @@ var forgec = module.exports = { } if ((keypair.privateKeyJwk || keypair.publicKeyJwk) - && !(keypair._forge && (keypair._forge || keypair._forgePublic)) + && !(keypair._forge || keypair._forgePublic) ) { forgec._forgeImportPublicJwk(keypair); } diff --git a/node.js b/node.js index 075df57..fe6de54 100644 --- a/node.js +++ b/node.js @@ -87,13 +87,13 @@ function create(deps) { RSA.import = function (keypair/*, options*/) { //options = options || NOBJ; // ignore - if (keypair.privateKeyJwk || keypair.privateKeyPem || keypair._ursa || (keypair._forge && keypair._forge)) { + if (keypair.privateKeyJwk || keypair.privateKeyPem || keypair._ursa || keypair._forge) { keypair.privateKeyJwk = RSA._internal.exportPrivateJwk(keypair, { internal: true }); //keypair.privateKeyPem = RSA._internal.exportPrivatePem(keypair, { internal: true }); return keypair; } - if (keypair.publicKeyJwk || keypair.publicKeyPem || keypair._ursaPublic || (keypair._forge && keypair._forgePublic)) { + if (keypair.publicKeyJwk || keypair.publicKeyPem || keypair._ursaPublic || keypair._forgePublic) { keypair.publicKeyJwk = RSA._internal.exportPublicJwk(keypair, { internal: true }); //keypair.publicKeyPem = RSA._internal.exportPublicPem(keypair, { internal: true }); return keypair;