working, huzzah!

This commit is contained in:
AJ ONeal 2019-10-20 03:27:05 -06:00
parent fd04a5070b
commit fd62408a9a
3 changed files with 13 additions and 2 deletions

View File

@ -214,6 +214,7 @@ C._check = function(db, args) {
certificate: args.certificate
};
return db.check(query).then(function(pems) {
console.log('[debug] has pems? (yes)', pems);
if (!pems) {
return null;
}
@ -234,6 +235,7 @@ C._check = function(db, args) {
return U._getKeypair(db, args.subject, query)
.then(function(keypair) {
console.log('[debug get keypair]', Object.keys(keypair));
pems.privkey = keypair.privateKeyPem;
return pems;
})

View File

@ -310,7 +310,14 @@ G.create = function(gconf) {
challenges,
account,
args
).then(function(pems) {
if (!pems.privkey) {
throw new Error(
'missing private key, which is kinda important'
);
}
return pems;
});
});
});
});

View File

@ -263,5 +263,7 @@ U._getOrCreateKeypair = function(db, subject, query, keyType, mustExist) {
};
U._getKeypair = function(db, subject, query) {
return U._getOrCreateKeypair(db, subject, query, '', true);
return U._getOrCreateKeypair(db, subject, query, '', true).then(function (result) {
return result.keypair;
});
};