Compare commits
No commits in common. "d3b459aaf581a6f03c41456c066aa7247e56f765" and "03f47005542c3f93c10417331d4f38a9ac8a21d2" have entirely different histories.
d3b459aaf5
...
03f4700554
@ -17,10 +17,6 @@ This project is fully functional and tested (and the code is pretty clean).
|
|||||||
|
|
||||||
It is considered to be complete, but if you find a bug please open an issue.
|
It is considered to be complete, but if you find a bug please open an issue.
|
||||||
|
|
||||||
## Looking for ECDSA as well?
|
|
||||||
|
|
||||||
Check out [Eckles.js](https://git.coolaj86.com/coolaj86/eckles.js)
|
|
||||||
|
|
||||||
## PEM-to-JWK
|
## PEM-to-JWK
|
||||||
|
|
||||||
* [x] PKCS#1 (traditional)
|
* [x] PKCS#1 (traditional)
|
||||||
|
20
lib/rasha.js
20
lib/rasha.js
@ -7,7 +7,8 @@ var x509 = require('./x509.js');
|
|||||||
var ASN1 = require('./asn1.js');
|
var ASN1 = require('./asn1.js');
|
||||||
|
|
||||||
/*global Promise*/
|
/*global Promise*/
|
||||||
RSA.importSync = function (opts) {
|
RSA.parse = function parseRsa(opts) {
|
||||||
|
return Promise.resolve().then(function () {
|
||||||
if (!opts || !opts.pem || 'string' !== typeof opts.pem) {
|
if (!opts || !opts.pem || 'string' !== typeof opts.pem) {
|
||||||
throw new Error("must pass { pem: pem } as a string");
|
throw new Error("must pass { pem: pem } as a string");
|
||||||
}
|
}
|
||||||
@ -33,13 +34,6 @@ RSA.importSync = function (opts) {
|
|||||||
jwk = RSA.nueter(jwk);
|
jwk = RSA.nueter(jwk);
|
||||||
}
|
}
|
||||||
return jwk;
|
return jwk;
|
||||||
};
|
|
||||||
RSA.parse = function parseRsa(opts) {
|
|
||||||
// wrapped in a promise for API compatibility
|
|
||||||
// with the forthcoming browser version
|
|
||||||
// (and potential future native node capability)
|
|
||||||
return Promise.resolve().then(function () {
|
|
||||||
return RSA.importSync(opts);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
RSA.toJwk = RSA.import = RSA.parse;
|
RSA.toJwk = RSA.import = RSA.parse;
|
||||||
@ -59,7 +53,8 @@ RSAPrivateKey ::= SEQUENCE {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RSA.exportSync = function (opts) {
|
RSA.pack = function (opts) {
|
||||||
|
return Promise.resolve().then(function () {
|
||||||
if (!opts || !opts.jwk || 'object' !== typeof opts.jwk) {
|
if (!opts || !opts.jwk || 'object' !== typeof opts.jwk) {
|
||||||
throw new Error("must pass { jwk: jwk }");
|
throw new Error("must pass { jwk: jwk }");
|
||||||
}
|
}
|
||||||
@ -109,13 +104,6 @@ RSA.exportSync = function (opts) {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error("Sanity Error: reached unreachable code block with format: " + format);
|
throw new Error("Sanity Error: reached unreachable code block with format: " + format);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
RSA.pack = function (opts) {
|
|
||||||
// wrapped in a promise for API compatibility
|
|
||||||
// with the forthcoming browser version
|
|
||||||
// (and potential future native node capability)
|
|
||||||
return Promise.resolve().then(function () {
|
|
||||||
return RSA.exportSync(opts);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
RSA.toPem = RSA.export = RSA.pack;
|
RSA.toPem = RSA.export = RSA.pack;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rasha",
|
"name": "rasha",
|
||||||
"version": "1.0.3",
|
"version": "1.0.1",
|
||||||
"description": "💯 PEM-to-JWK and JWK-to-PEM for RSA keys in a lightweight, zero-dependency library focused on perfect universal compatibility.",
|
"description": "💯 PEM-to-JWK and JWK-to-PEM for RSA keys in a lightweight, zero-dependency library focused on perfect universal compatibility.",
|
||||||
"homepage": "https://git.coolaj86.com/coolaj86/rasha.js",
|
"homepage": "https://git.coolaj86.com/coolaj86/rasha.js",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user