mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-27 03:11:35 +01:00
[PM-4925] Implemented getPublicKey to follow WSC standards (#6934)
* Implemented getPublicKey to follow WSC standards * Renamed variable
This commit is contained in:
parent
75e1486c18
commit
301142fbf2
@ -67,7 +67,7 @@ export class WebauthnUtils {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getPublicKey(): ArrayBuffer {
|
getPublicKey(): ArrayBuffer {
|
||||||
return null;
|
return Fido2Utils.stringToBuffer(result.publicKey);
|
||||||
},
|
},
|
||||||
|
|
||||||
getPublicKeyAlgorithm(): number {
|
getPublicKeyAlgorithm(): number {
|
||||||
|
@ -109,6 +109,7 @@ export interface Fido2AuthenticatorMakeCredentialResult {
|
|||||||
credentialId: BufferSource;
|
credentialId: BufferSource;
|
||||||
attestationObject: BufferSource;
|
attestationObject: BufferSource;
|
||||||
authData: BufferSource;
|
authData: BufferSource;
|
||||||
|
publicKey: BufferSource;
|
||||||
publicKeyAlgorithm: number;
|
publicKeyAlgorithm: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ export interface CreateCredentialResult {
|
|||||||
clientDataJSON: string;
|
clientDataJSON: string;
|
||||||
attestationObject: string;
|
attestationObject: string;
|
||||||
authData: string;
|
authData: string;
|
||||||
|
publicKey: string;
|
||||||
publicKeyAlgorithm: number;
|
publicKeyAlgorithm: number;
|
||||||
transports: string[];
|
transports: string[];
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
let keyPair: CryptoKeyPair;
|
let keyPair: CryptoKeyPair;
|
||||||
let userVerified = false;
|
let userVerified = false;
|
||||||
let credentialId: string;
|
let credentialId: string;
|
||||||
|
let pubKeyDer: ArrayBuffer;
|
||||||
const response = await userInterfaceSession.confirmNewCredential({
|
const response = await userInterfaceSession.confirmNewCredential({
|
||||||
credentialName: params.rpEntity.name,
|
credentialName: params.rpEntity.name,
|
||||||
userName: params.userEntity.displayName,
|
userName: params.userEntity.displayName,
|
||||||
@ -126,7 +127,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
keyPair = await createKeyPair();
|
keyPair = await createKeyPair();
|
||||||
|
pubKeyDer = await crypto.subtle.exportKey("spki", keyPair.publicKey);
|
||||||
const encrypted = await this.cipherService.get(cipherId);
|
const encrypted = await this.cipherService.get(cipherId);
|
||||||
cipher = await encrypted.decrypt(
|
cipher = await encrypted.decrypt(
|
||||||
await this.cipherService.getKeyForCipherKeyDecryption(encrypted)
|
await this.cipherService.getKeyForCipherKeyDecryption(encrypted)
|
||||||
@ -174,6 +175,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
credentialId: guidToRawFormat(credentialId),
|
credentialId: guidToRawFormat(credentialId),
|
||||||
attestationObject,
|
attestationObject,
|
||||||
authData,
|
authData,
|
||||||
|
publicKey: pubKeyDer,
|
||||||
publicKeyAlgorithm: -7,
|
publicKeyAlgorithm: -7,
|
||||||
};
|
};
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -285,6 +285,7 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
credentialId: guidToRawFormat(Utils.newGuid()),
|
credentialId: guidToRawFormat(Utils.newGuid()),
|
||||||
attestationObject: randomBytes(128),
|
attestationObject: randomBytes(128),
|
||||||
authData: randomBytes(64),
|
authData: randomBytes(64),
|
||||||
|
publicKey: randomBytes(64),
|
||||||
publicKeyAlgorithm: -7,
|
publicKeyAlgorithm: -7,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -199,6 +199,7 @@ export class Fido2ClientService implements Fido2ClientServiceAbstraction {
|
|||||||
attestationObject: Fido2Utils.bufferToString(makeCredentialResult.attestationObject),
|
attestationObject: Fido2Utils.bufferToString(makeCredentialResult.attestationObject),
|
||||||
authData: Fido2Utils.bufferToString(makeCredentialResult.authData),
|
authData: Fido2Utils.bufferToString(makeCredentialResult.authData),
|
||||||
clientDataJSON: Fido2Utils.bufferToString(clientDataJSONBytes),
|
clientDataJSON: Fido2Utils.bufferToString(clientDataJSONBytes),
|
||||||
|
publicKey: Fido2Utils.bufferToString(makeCredentialResult.publicKey),
|
||||||
publicKeyAlgorithm: makeCredentialResult.publicKeyAlgorithm,
|
publicKeyAlgorithm: makeCredentialResult.publicKeyAlgorithm,
|
||||||
transports: params.rp.id === "google.com" ? ["internal", "usb"] : ["internal"],
|
transports: params.rp.id === "google.com" ? ["internal", "usb"] : ["internal"],
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user