backwards compat fix

This commit is contained in:
AJ ONeal 2018-03-21 15:16:44 -06:00
parent ec4118a988
commit 7776aaa785
2 changed files with 6 additions and 4 deletions

View File

@ -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 = "";

View File

@ -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": {