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) { list(callback) {
this.ykChalResp.getYubiKeys((err, yubiKeys) => { this.ykChalResp.getYubiKeys({}, (err, yubiKeys) => {
if (err) { if (err) {
return callback(err); return callback(err);
} }
yubiKeys = yubiKeys.map(({ serial, vid, pid, version, slot1, slot2 }) => { yubiKeys = yubiKeys.map(({ serial, vid, pid, version, slots }) => {
return { return {
vid, vid,
pid, pid,
serial, serial,
slot1, slots,
slot2,
fullName: this.getKeyFullName(pid, version, serial) fullName: this.getKeyFullName(pid, version, serial)
}; };
}); });

View File

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

View File

@ -103,14 +103,14 @@ class SettingsFileView extends View {
const yubiKeys = []; const yubiKeys = [];
if (showYubiKeyBlock) { if (showYubiKeyBlock) {
for (const yk of this.yubiKeys) { 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({ yubiKeys.push({
value: `${yk.serial}:${slot}`, value: `${yk.serial}:${slot}`,
fullName: yk.fullName, fullName: yk.fullName,
vid: yk.vid, vid: yk.vid,
pid: yk.pid, pid: yk.pid,
serial: yk.serial, serial: yk.serial,
slot slot: slot.number
}); });
} }
} }

View File

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

View File

@ -16,7 +16,7 @@
"license": "MIT", "license": "MIT",
"readme": "../README.md", "readme": "../README.md",
"dependencies": { "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" "node-stream-zip": "^1.4.2"
}, },
"devDependencies": {} "devDependencies": {}

4
package-lock.json generated
View File

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

View File

@ -15,7 +15,7 @@
"@babel/plugin-proposal-class-properties": "^7.10.1", "@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-optional-chaining": "^7.10.1", "@babel/plugin-proposal-optional-chaining": "^7.10.1",
"@babel/preset-env": "^7.10.2", "@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", "adm-zip": "^0.4.14",
"argon2-browser": "1.13.0", "argon2-browser": "1.13.0",
"autoprefixer": "^9.8.0", "autoprefixer": "^9.8.0",