challenge-response calculation function

This commit is contained in:
antelle 2020-05-24 21:06:53 +02:00
parent d8e49d993a
commit 8c386dbe57
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
1 changed files with 15 additions and 6 deletions

View File

@ -192,17 +192,26 @@ const YubiKey = {
},
getOtp(serial, entry, callback) {
if (this.process) {
return callback('Already in progress');
}
this.aborted = false;
return Launcher.spawn({
cmd: 'ykman',
args: ['-d', serial, 'oath', 'code', '--single', entry],
noStdOutLogging: true,
complete: (err, stdout) => {
this.process = null;
if (err) {
return callback(err);
}
const otp = stdout.trim();
callback(null, otp);
}
});
},
calculateChalResp(serial, slot, challenge, callback) {
return Launcher.spawn({
cmd: 'ykman',
args: ['-d', serial, 'otp', 'calculate', slot, challenge],
noStdOutLogging: true,
complete: (err, stdout) => {
if (err) {
return callback(err);
}