diff --git a/libs/common/src/webauthn/models/api/fido2-key.api.ts b/libs/common/src/webauthn/models/api/fido2-key.api.ts index 24e902f9ace..1eb8a56ada9 100644 --- a/libs/common/src/webauthn/models/api/fido2-key.api.ts +++ b/libs/common/src/webauthn/models/api/fido2-key.api.ts @@ -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"); } } diff --git a/libs/common/src/webauthn/models/data/fido2-key.data.ts b/libs/common/src/webauthn/models/data/fido2-key.data.ts index 7f84c9f91e5..180c46d1d93 100644 --- a/libs/common/src/webauthn/models/data/fido2-key.data.ts +++ b/libs/common/src/webauthn/models/data/fido2-key.data.ts @@ -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; diff --git a/libs/common/src/webauthn/models/domain/fido2-key.ts b/libs/common/src/webauthn/models/domain/fido2-key.ts index e2334443a2c..b9cb7f298e4 100644 --- a/libs/common/src/webauthn/models/domain/fido2-key.ts +++ b/libs/common/src/webauthn/models/domain/fido2-key.ts @@ -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, diff --git a/libs/common/src/webauthn/models/view/fido2-key.view.ts b/libs/common/src/webauthn/models/view/fido2-key.view.ts index 7115fb29152..094c5804692 100644 --- a/libs/common/src/webauthn/models/view/fido2-key.view.ts +++ b/libs/common/src/webauthn/models/view/fido2-key.view.ts @@ -9,6 +9,7 @@ export class Fido2KeyView extends ItemView { keyValue: string; rpId: string; userHandle: string; + counter: number; // Extras rpName: string; diff --git a/libs/common/src/webauthn/services/fido2-authenticator.service.spec.ts b/libs/common/src/webauthn/services/fido2-authenticator.service.spec.ts index 3ec3c433890..0edd8a3aee6 100644 --- a/libs/common/src/webauthn/services/fido2-authenticator.service.spec.ts +++ b/libs/common/src/webauthn/services/fido2-authenticator.service.spec.ts @@ -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, }), }) diff --git a/libs/common/src/webauthn/services/fido2-authenticator.service.ts b/libs/common/src/webauthn/services/fido2-authenticator.service.ts index 54622a42cfb..445d3c9b5f8 100644 --- a/libs/common/src/webauthn/services/fido2-authenticator.service.ts +++ b/libs/common/src/webauthn/services/fido2-authenticator.service.ts @@ -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;