fixed yubikey touch

This commit is contained in:
antelle 2021-02-09 21:37:54 +01:00
parent ee10894f5f
commit 1379db1e92
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 16 additions and 7 deletions

View File

@ -61,6 +61,7 @@ const messageHandlers = {
challenge = Buffer.from(challenge);
ykChalResp.challengeResponse(yubiKey, challenge, slot, (error, result) => {
if (error) {
error = errorToTransport(error);
if (error.code === ykChalResp.YK_ENOKEY) {
error.noKey = true;
}
@ -253,16 +254,24 @@ function handleMessage({ callId, cmd, args }) {
callback('result', { callId, result });
})
.catch((error) => {
error = {
name: error.name,
message: error.message,
stack: error.stack,
code: error.code
};
error = errorToTransport(error);
callback('result', { callId, error });
});
}
function errorToTransport(error) {
const obj = {
name: error.name,
message: error.message,
stack: error.stack,
code: error.code
};
for (const [key, val] of Object.entries(error)) {
obj[key] = val;
}
return obj;
}
function startInOwnProcess() {
callback = (cmd, ...args) => {
try {

View File

@ -5,7 +5,7 @@ const { EventEmitter } = require('events');
let callbackWebContents;
let nativeModuleHost;
const spawnAnotherProcess = false;
const spawnAnotherProcess = true;
function startHost() {
if (spawnAnotherProcess) {