From 7776aaa785656ead0153c58cac049af74d6fc292 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 21 Mar 2018 15:16:44 -0600 Subject: [PATCH] backwards compat fix --- node.js | 8 +++++--- package.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/node.js b/node.js index d5415f1..442b753 100644 --- a/node.js +++ b/node.js @@ -161,6 +161,11 @@ function create(deps) { function (keypair, header, protect, payload) { // old (keypair, payload, nonce) var nonce; + + keypair = RSA._internal.import(keypair); + keypair = RSA._internal.importForge(keypair); + keypair.publicKeyJwk = RSA.exportPublicJwk(keypair); + if ('string' === typeof protect || ('undefined' === typeof protect && 'undefined' === typeof payload)) { console.warn("deprecation notice: new signature for signJws(keypair, header, protect, payload)"); // old API @@ -173,9 +178,6 @@ function create(deps) { }; protect = { nonce: nonce }; } - keypair = RSA._internal.import(keypair); - keypair = RSA._internal.importForge(keypair); - keypair.publicKeyJwk = RSA.exportPublicJwk(keypair); // Compute JWS signature var protectedHeader = ""; diff --git a/package.json b/package.json index e20e0b5..d9fd971 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rsa-compat", - "version": "2.0.0", + "version": "1.3.2", "description": "RSA utils that work on Windows, Mac, and Linux with or without C compiler", "main": "node.js", "bin": {