bugfix: options.certificate is optional

This commit is contained in:
AJ ONeal 2019-05-09 00:28:08 -06:00
parent da6e37b00a
commit feb59ce8e2
1 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ module.exports.create = function (config={}) {
return db.Keypair.findOne({ return db.Keypair.findOne({
where: { where: {
// using xid because id is reserved by sequelize // using xid because id is reserved by sequelize
xid: opts.certificate.kid || opts.certificate.id || opts.subject xid: (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject
} }
}); });
}).then(function (record) { }).then(function (record) {
@ -131,7 +131,7 @@ module.exports.create = function (config={}) {
return db.Keypair.findOrCreate({ return db.Keypair.findOrCreate({
where: { where: {
// using xid because id is reserved by sequelize // using xid because id is reserved by sequelize
xid: opts.certificate.kid || opts.certificate.id || opts.subject xid: (opts.certificate && (opts.certificate.kid || opts.certificate.id)) || opts.subject
} }
}); });
}).then(function ([record,created]) { }).then(function ([record,created]) {