fix #1 return null when keypath cannot be derived
This commit is contained in:
parent
9d4ad0b734
commit
c86cbd5edf
3
index.js
3
index.js
|
@ -144,6 +144,9 @@ module.exports.create = function (configs) {
|
||||||
|
|
||||||
, keypairs: {
|
, keypairs: {
|
||||||
checkAsync: function (keypath, format) {
|
checkAsync: function (keypath, format) {
|
||||||
|
if (!keypath) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return fs.readFileAsync(keypath, 'ascii').then(function (key) {
|
return fs.readFileAsync(keypath, 'ascii').then(function (key) {
|
||||||
if ('jwk' === format) {
|
if ('jwk' === format) {
|
||||||
return { privateKeyJwk: JSON.parse(key) };
|
return { privateKeyJwk: JSON.parse(key) };
|
||||||
|
|
Loading…
Reference in New Issue