mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-08 00:01:28 +01:00
[EC-598] fix: data not getting saved properly
This commit is contained in:
parent
e2df24c5ae
commit
7039ad1870
@ -1252,6 +1252,7 @@ export class CipherService implements CipherServiceAbstraction {
|
|||||||
cipher.fido2Key,
|
cipher.fido2Key,
|
||||||
{
|
{
|
||||||
keyType: null,
|
keyType: null,
|
||||||
|
keyAlgorithm: null,
|
||||||
keyCurve: null,
|
keyCurve: null,
|
||||||
keyValue: null,
|
keyValue: null,
|
||||||
rpId: null,
|
rpId: null,
|
||||||
|
@ -22,7 +22,7 @@ export class Fido2KeyApi extends BaseResponse {
|
|||||||
|
|
||||||
this.nonDiscoverableId = this.getResponseProperty("NonDiscoverableId");
|
this.nonDiscoverableId = this.getResponseProperty("NonDiscoverableId");
|
||||||
this.keyType = this.getResponseProperty("KeyType");
|
this.keyType = this.getResponseProperty("KeyType");
|
||||||
this.keyAlgorithm = this.getResponseProperty("KeyType");
|
this.keyAlgorithm = this.getResponseProperty("KeyAlgorithm");
|
||||||
this.keyCurve = this.getResponseProperty("KeyCurve");
|
this.keyCurve = this.getResponseProperty("KeyCurve");
|
||||||
this.keyValue = this.getResponseProperty("keyValue");
|
this.keyValue = this.getResponseProperty("keyValue");
|
||||||
this.rpId = this.getResponseProperty("RpId");
|
this.rpId = this.getResponseProperty("RpId");
|
||||||
|
@ -254,7 +254,7 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
|
|
||||||
expect(userInterface.confirmNewCredential).toHaveBeenCalledWith({
|
expect(userInterface.confirmNewCredential).toHaveBeenCalledWith({
|
||||||
credentialName: params.rpEntity.name,
|
credentialName: params.rpEntity.name,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
} as NewCredentialParams);
|
} as NewCredentialParams);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
rpName: params.rpEntity.name,
|
rpName: params.rpEntity.name,
|
||||||
userHandle: Fido2Utils.bufferToString(params.userEntity.id),
|
userHandle: Fido2Utils.bufferToString(params.userEntity.id),
|
||||||
counter: 0,
|
counter: 0,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -337,7 +337,7 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
|
|
||||||
expect(userInterface.confirmNewNonDiscoverableCredential).toHaveBeenCalledWith({
|
expect(userInterface.confirmNewNonDiscoverableCredential).toHaveBeenCalledWith({
|
||||||
credentialName: params.rpEntity.name,
|
credentialName: params.rpEntity.name,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
} as NewCredentialParams);
|
} as NewCredentialParams);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
rpName: params.rpEntity.name,
|
rpName: params.rpEntity.name,
|
||||||
userHandle: Fido2Utils.bufferToString(params.userEntity.id),
|
userHandle: Fido2Utils.bufferToString(params.userEntity.id),
|
||||||
counter: 0,
|
counter: 0,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -65,7 +65,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
[Utils.guidToStandardFormat(params.excludeCredentialDescriptorList[0].id)],
|
[Utils.guidToStandardFormat(params.excludeCredentialDescriptorList[0].id)],
|
||||||
{
|
{
|
||||||
credentialName: params.rpEntity.name,
|
credentialName: params.rpEntity.name,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
if (params.requireResidentKey) {
|
if (params.requireResidentKey) {
|
||||||
const userVerification = await this.userInterface.confirmNewCredential({
|
const userVerification = await this.userInterface.confirmNewCredential({
|
||||||
credentialName: params.rpEntity.name,
|
credentialName: params.rpEntity.name,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!userVerification) {
|
if (!userVerification) {
|
||||||
@ -100,7 +100,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
} else {
|
} else {
|
||||||
const cipherId = await this.userInterface.confirmNewNonDiscoverableCredential({
|
const cipherId = await this.userInterface.confirmNewNonDiscoverableCredential({
|
||||||
credentialName: params.rpEntity.name,
|
credentialName: params.rpEntity.name,
|
||||||
userName: params.userEntity.name,
|
userName: params.userEntity.displayName,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (cipherId === undefined) {
|
if (cipherId === undefined) {
|
||||||
@ -191,7 +191,11 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
: selectedCipher.id;
|
: selectedCipher.id;
|
||||||
|
|
||||||
++selectedCipher.fido2Key.counter;
|
++selectedCipher.fido2Key.counter;
|
||||||
selectedCipher.localData.lastUsedDate = new Date().getTime();
|
|
||||||
|
selectedCipher.localData = {
|
||||||
|
...selectedCipher.localData,
|
||||||
|
lastUsedDate: new Date().getTime(),
|
||||||
|
};
|
||||||
const encrypted = await this.cipherService.encrypt(selectedCipher);
|
const encrypted = await this.cipherService.encrypt(selectedCipher);
|
||||||
await this.cipherService.updateWithServer(encrypted);
|
await this.cipherService.updateWithServer(encrypted);
|
||||||
|
|
||||||
@ -268,6 +272,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
const ciphers = await this.cipherService.getAllDecrypted();
|
const ciphers = await this.cipherService.getAllDecrypted();
|
||||||
return ciphers.filter(
|
return ciphers.filter(
|
||||||
(cipher) =>
|
(cipher) =>
|
||||||
|
!cipher.isDeleted &&
|
||||||
cipher.type === CipherType.Login &&
|
cipher.type === CipherType.Login &&
|
||||||
cipher.fido2Key != undefined &&
|
cipher.fido2Key != undefined &&
|
||||||
cipher.fido2Key.rpId === rpId &&
|
cipher.fido2Key.rpId === rpId &&
|
||||||
@ -278,7 +283,8 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
private async findDiscoverableCredentials(rpId: string): Promise<CipherView[]> {
|
private async findDiscoverableCredentials(rpId: string): Promise<CipherView[]> {
|
||||||
const ciphers = await this.cipherService.getAllDecrypted();
|
const ciphers = await this.cipherService.getAllDecrypted();
|
||||||
return ciphers.filter(
|
return ciphers.filter(
|
||||||
(cipher) => cipher.type === CipherType.Fido2Key && cipher.fido2Key.rpId === rpId
|
(cipher) =>
|
||||||
|
!cipher.isDeleted && cipher.type === CipherType.Fido2Key && cipher.fido2Key.rpId === rpId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,7 +319,7 @@ async function createKeyView(
|
|||||||
fido2Key.userHandle = Fido2Utils.bufferToString(params.userEntity.id);
|
fido2Key.userHandle = Fido2Utils.bufferToString(params.userEntity.id);
|
||||||
fido2Key.counter = 0;
|
fido2Key.counter = 0;
|
||||||
fido2Key.rpName = params.rpEntity.name;
|
fido2Key.rpName = params.rpEntity.name;
|
||||||
fido2Key.userName = params.userEntity.name;
|
fido2Key.userName = params.userEntity.displayName;
|
||||||
|
|
||||||
return fido2Key;
|
return fido2Key;
|
||||||
}
|
}
|
||||||
@ -324,7 +330,7 @@ async function getPrivateKeyFromCipher(cipher: CipherView): Promise<CryptoKey> {
|
|||||||
"pkcs8",
|
"pkcs8",
|
||||||
keyBuffer,
|
keyBuffer,
|
||||||
{
|
{
|
||||||
name: cipher.fido2Key.keyType,
|
name: cipher.fido2Key.keyAlgorithm,
|
||||||
namedCurve: cipher.fido2Key.keyCurve,
|
namedCurve: cipher.fido2Key.keyCurve,
|
||||||
} as EcKeyImportParams,
|
} as EcKeyImportParams,
|
||||||
true,
|
true,
|
||||||
|
Loading…
Reference in New Issue
Block a user