1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[EC-598] feat: add counter to fido2key

This commit is contained in:
Andreas Coroiu
2023-03-27 09:53:03 +02:00
parent ad27234576
commit 343df7efdb
6 changed files with 16 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ export class Fido2KeyApi extends BaseResponse {
keyValue: string;
rpId: string;
userHandle: string;
counter: number;
// Extras
rpName: string;
@@ -24,9 +25,10 @@ export class Fido2KeyApi extends BaseResponse {
this.keyCurve = this.getResponseProperty("KeyCurve");
this.keyValue = this.getResponseProperty("keyValue");
this.rpId = this.getResponseProperty("RpId");
this.userHandle = this.getResponseProperty("UserHandle");
this.counter = this.getResponseProperty("Counter");
this.rpName = this.getResponseProperty("RpName");
this.userName = this.getResponseProperty("UserName");
this.userHandle = this.getResponseProperty("UserHandle");
this.origin = this.getResponseProperty("Origin");
}
}

View File

@@ -7,6 +7,7 @@ export class Fido2KeyData {
keyValue: string;
rpId: string;
userHandle: string;
counter: number;
// Extras
rpName: string;
@@ -24,6 +25,7 @@ export class Fido2KeyData {
this.keyValue = data.keyValue;
this.rpId = data.rpId;
this.userHandle = data.userHandle;
this.counter = data.counter;
this.rpName = data.rpName;
this.userName = data.userName;
this.origin = data.origin;

View File

@@ -13,6 +13,7 @@ export class Fido2Key extends Domain {
keyValue: EncString;
rpId: EncString;
userHandle: EncString;
counter: EncString;
// Extras
rpName: EncString;
@@ -35,6 +36,7 @@ export class Fido2Key extends Domain {
keyValue: null,
rpId: null,
userHandle: null,
counter: null,
rpName: null,
userName: null,
origin: null,
@@ -53,6 +55,7 @@ export class Fido2Key extends Domain {
keyValue: null,
rpId: null,
userHandle: null,
counter: null,
rpName: null,
userName: null,
origin: null,
@@ -71,6 +74,7 @@ export class Fido2Key extends Domain {
keyValue: null,
rpId: null,
userHandle: null,
counter: null,
rpName: null,
userName: null,
origin: null,
@@ -89,6 +93,7 @@ export class Fido2Key extends Domain {
const keyValue = EncString.fromJSON(obj.keyValue);
const rpId = EncString.fromJSON(obj.rpId);
const userHandle = EncString.fromJSON(obj.userHandle);
const counter = EncString.fromJSON(obj.counter);
const rpName = EncString.fromJSON(obj.rpName);
const userName = EncString.fromJSON(obj.userName);
const origin = EncString.fromJSON(obj.origin);
@@ -100,6 +105,7 @@ export class Fido2Key extends Domain {
keyValue,
rpId,
userHandle,
counter,
rpName,
userName,
origin,

View File

@@ -9,6 +9,7 @@ export class Fido2KeyView extends ItemView {
keyValue: string;
rpId: string;
userHandle: string;
counter: number;
// Extras
rpName: string;

View File

@@ -188,6 +188,7 @@ describe("FidoAuthenticatorService", () => {
rpId: params.rpEntity.id,
rpName: params.rpEntity.name,
userHandle: Fido2Utils.bufferToString(params.userEntity.id),
counter: 0,
userName: params.userEntity.name,
}),
})
@@ -268,6 +269,7 @@ describe("FidoAuthenticatorService", () => {
rpId: params.rpEntity.id,
rpName: params.rpEntity.name,
userHandle: Fido2Utils.bufferToString(params.userEntity.id),
counter: 0,
userName: params.userEntity.name,
}),
})

View File

@@ -139,8 +139,9 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
fido2Key.keyCurve = "P-256";
fido2Key.keyValue = Fido2Utils.bufferToString(pcks8Key);
fido2Key.rpId = params.rpEntity.id;
fido2Key.rpName = params.rpEntity.name;
fido2Key.userHandle = Fido2Utils.bufferToString(params.userEntity.id);
fido2Key.counter = 0;
fido2Key.rpName = params.rpEntity.name;
fido2Key.userName = params.userEntity.name;
return fido2Key;