mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +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 {
|
||||
return null;
|
||||
return Fido2Utils.stringToBuffer(result.publicKey);
|
||||
},
|
||||
|
||||
getPublicKeyAlgorithm(): number {
|
||||
|
@ -109,6 +109,7 @@ export interface Fido2AuthenticatorMakeCredentialResult {
|
||||
credentialId: BufferSource;
|
||||
attestationObject: BufferSource;
|
||||
authData: BufferSource;
|
||||
publicKey: BufferSource;
|
||||
publicKeyAlgorithm: number;
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ export interface CreateCredentialResult {
|
||||
clientDataJSON: string;
|
||||
attestationObject: string;
|
||||
authData: string;
|
||||
publicKey: string;
|
||||
publicKeyAlgorithm: number;
|
||||
transports: string[];
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
||||
let keyPair: CryptoKeyPair;
|
||||
let userVerified = false;
|
||||
let credentialId: string;
|
||||
let pubKeyDer: ArrayBuffer;
|
||||
const response = await userInterfaceSession.confirmNewCredential({
|
||||
credentialName: params.rpEntity.name,
|
||||
userName: params.userEntity.displayName,
|
||||
@ -126,7 +127,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
||||
|
||||
try {
|
||||
keyPair = await createKeyPair();
|
||||
|
||||
pubKeyDer = await crypto.subtle.exportKey("spki", keyPair.publicKey);
|
||||
const encrypted = await this.cipherService.get(cipherId);
|
||||
cipher = await encrypted.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(encrypted)
|
||||
@ -174,6 +175,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
||||
credentialId: guidToRawFormat(credentialId),
|
||||
attestationObject,
|
||||
authData,
|
||||
publicKey: pubKeyDer,
|
||||
publicKeyAlgorithm: -7,
|
||||
};
|
||||
} finally {
|
||||
|
@ -285,6 +285,7 @@ describe("FidoAuthenticatorService", () => {
|
||||
credentialId: guidToRawFormat(Utils.newGuid()),
|
||||
attestationObject: randomBytes(128),
|
||||
authData: randomBytes(64),
|
||||
publicKey: randomBytes(64),
|
||||
publicKeyAlgorithm: -7,
|
||||
};
|
||||
}
|
||||
|
@ -199,6 +199,7 @@ export class Fido2ClientService implements Fido2ClientServiceAbstraction {
|
||||
attestationObject: Fido2Utils.bufferToString(makeCredentialResult.attestationObject),
|
||||
authData: Fido2Utils.bufferToString(makeCredentialResult.authData),
|
||||
clientDataJSON: Fido2Utils.bufferToString(clientDataJSONBytes),
|
||||
publicKey: Fido2Utils.bufferToString(makeCredentialResult.publicKey),
|
||||
publicKeyAlgorithm: makeCredentialResult.publicKeyAlgorithm,
|
||||
transports: params.rp.id === "google.com" ? ["internal", "usb"] : ["internal"],
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user