up yk-api

This commit is contained in:
antelle 2020-06-02 12:23:22 +02:00
parent 435eb5779f
commit 56c8649040
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
7 changed files with 14 additions and 15 deletions

View File

@ -56,17 +56,16 @@ const YubiKey = {
},
list(callback) {
this.ykChalResp.getYubiKeys((err, yubiKeys) => {
this.ykChalResp.getYubiKeys({}, (err, yubiKeys) => {
if (err) {
return callback(err);
}
yubiKeys = yubiKeys.map(({ serial, vid, pid, version, slot1, slot2 }) => {
yubiKeys = yubiKeys.map(({ serial, vid, pid, version, slots }) => {
return {
vid,
pid,
serial,
slot1,
slot2,
slots,
fullName: this.getKeyFullName(pid, version, serial)
};
});

View File

@ -53,14 +53,14 @@ class OpenChalRespView extends View {
this.error = err;
this.yubiKeys = [];
if (yubiKeys) {
for (const { fullName, vid, pid, serial, slot1, slot2 } of yubiKeys) {
for (const slot of [slot1 ? 1 : 0, slot2 ? 2 : 0].filter((s) => s)) {
for (const { fullName, vid, pid, serial, slots } of yubiKeys) {
for (const slot of slots.filter((s) => s.valid)) {
this.yubiKeys.push({
fullName,
vid,
pid,
serial,
slot
slot: slot.number
});
}
}

View File

@ -103,14 +103,14 @@ class SettingsFileView extends View {
const yubiKeys = [];
if (showYubiKeyBlock) {
for (const yk of this.yubiKeys) {
for (const slot of [yk.slot1 ? 1 : 0, yk.slot2 ? 2 : 0].filter((s) => s)) {
for (const slot of yk.slots.filter((s) => s.valid)) {
yubiKeys.push({
value: `${yk.serial}:${slot}`,
fullName: yk.fullName,
vid: yk.vid,
pid: yk.pid,
serial: yk.serial,
slot
slot: slot.number
});
}
}

View File

@ -5,8 +5,8 @@
"requires": true,
"dependencies": {
"@keeweb/keeweb-native-modules": {
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.5/keeweb-native-modules.tgz",
"integrity": "sha512-rTJqip7SFDVEGdrWtpFQ0hiSqxmjVl1rVPegFTvA9WhObkSqfj2ORbmS1+EmuCD7pzDCd+T4Q71sdSaLzuDPtw=="
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.6/keeweb-native-modules.tgz",
"integrity": "sha512-1nCgKTU/esky1rFexCSs7U87A/sCEC6T/RNF5FO89dwzKMU9yVM/U7OuBspLuWnwxjCoaicTZr/WuYeoM1UATQ=="
},
"node-stream-zip": {
"version": "1.4.2",

View File

@ -16,7 +16,7 @@
"license": "MIT",
"readme": "../README.md",
"dependencies": {
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.5/keeweb-native-modules.tgz",
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.6/keeweb-native-modules.tgz",
"node-stream-zip": "^1.4.2"
},
"devDependencies": {}

4
package-lock.json generated
View File

@ -2224,8 +2224,8 @@
}
},
"@keeweb/keeweb-native-modules": {
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.5/keeweb-native-modules.tgz",
"integrity": "sha512-rTJqip7SFDVEGdrWtpFQ0hiSqxmjVl1rVPegFTvA9WhObkSqfj2ORbmS1+EmuCD7pzDCd+T4Q71sdSaLzuDPtw=="
"version": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.6/keeweb-native-modules.tgz",
"integrity": "sha512-1nCgKTU/esky1rFexCSs7U87A/sCEC6T/RNF5FO89dwzKMU9yVM/U7OuBspLuWnwxjCoaicTZr/WuYeoM1UATQ=="
},
"@sindresorhus/is": {
"version": "0.14.0",

View File

@ -15,7 +15,7 @@
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-optional-chaining": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.5/keeweb-native-modules.tgz",
"@keeweb/keeweb-native-modules": "https://github.com/keeweb/keeweb-native-modules/releases/download/0.3.6/keeweb-native-modules.tgz",
"adm-zip": "^0.4.14",
"argon2-browser": "1.13.0",
"autoprefixer": "^9.8.0",