v1.2.13: add support for rsa-compat
This commit is contained in:
parent
3c84a7e1bd
commit
5dc3795a17
18
keypairs.js
18
keypairs.js
|
@ -342,3 +342,21 @@ Enc.bufToUrlBase64 = function (buf) {
|
||||||
return Buffer.from(buf).toString('base64')
|
return Buffer.from(buf).toString('base64')
|
||||||
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For 'rsa-compat' module only
|
||||||
|
// PLEASE do not use these sync methods, they are deprecated
|
||||||
|
Keypairs._importSync = function (opts) {
|
||||||
|
if ('RSA' === opts.jwk.kty) {
|
||||||
|
return Rasha.importSync(opts);
|
||||||
|
} else {
|
||||||
|
return Eckles.importSync(opts);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// PLEASE do not use these, they are deprecated
|
||||||
|
Keypairs._exportSync = function (opts) {
|
||||||
|
if ('RSA' === opts.jwk.kty) {
|
||||||
|
return Rasha.exportSync(opts);
|
||||||
|
} else {
|
||||||
|
return Eckles.exportSync(opts);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
10
package.json
10
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "keypairs",
|
"name": "keypairs",
|
||||||
"version": "1.2.12",
|
"version": "1.2.13",
|
||||||
"description": "Lightweight RSA/ECDSA keypair generation and JWK <-> PEM",
|
"description": "Lightweight RSA/ECDSA keypair generation and JWK <-> PEM using node's native RSA and ECDSA support",
|
||||||
"main": "keypairs.js",
|
"main": "keypairs.js",
|
||||||
"files": [
|
"files": [
|
||||||
"bin/keypairs.js"
|
"bin/keypairs.js"
|
||||||
|
@ -21,7 +21,11 @@
|
||||||
"RSA",
|
"RSA",
|
||||||
"ECDSA",
|
"ECDSA",
|
||||||
"PEM",
|
"PEM",
|
||||||
"JWK"
|
"JWK",
|
||||||
|
"keypair",
|
||||||
|
"crypto",
|
||||||
|
"sign",
|
||||||
|
"verify"
|
||||||
],
|
],
|
||||||
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
|
Loading…
Reference in New Issue