mirror of
https://github.com/bitwarden/browser
synced 2026-02-09 13:10:17 +00:00
Remove some unnecessary logs
This commit is contained in:
@@ -9,9 +9,7 @@ export function parseCredentialId(encodedCredentialId: string): ArrayBuffer {
|
||||
return Fido2Utils.stringToBuffer(encodedCredentialId.slice(4));
|
||||
}
|
||||
|
||||
let arr = guidToRawFormat(encodedCredentialId);
|
||||
console.log("guidToRawFormat output:", arr)
|
||||
return arr.buffer;
|
||||
return guidToRawFormat(encodedCredentialId).buffer;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
@@ -21,14 +19,12 @@ export function parseCredentialId(encodedCredentialId: string): ArrayBuffer {
|
||||
* Compares two credential IDs for equality.
|
||||
*/
|
||||
export function compareCredentialIds(a: ArrayBuffer, b: ArrayBuffer): boolean {
|
||||
console.log("compareCredentialIds:", a, b)
|
||||
if (a.byteLength !== b.byteLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const viewA = new Uint8Array(a);
|
||||
const viewB = new Uint8Array(b);
|
||||
console.log("Comparing credential IDs:", viewA, viewB)
|
||||
|
||||
for (let i = 0; i < viewA.length; i++) {
|
||||
if (viewA[i] !== viewB[i]) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import { compareCredentialIds, parseCredentialId } from "./credential-id-utils";
|
||||
import { p1363ToDer } from "./ecdsa-utils";
|
||||
import { Fido2Utils } from "./fido2-utils";
|
||||
import { guidToStandardFormat } from "./guid-utils";
|
||||
import { PrimarySecondaryStorageService } from "../../storage/primary-secondary-storage.service";
|
||||
|
||||
// AAGUID: d548826e-79b4-db40-a3d8-11116f7e8349
|
||||
export const AAGUID = new Uint8Array([
|
||||
@@ -63,15 +62,12 @@ export class Fido2AuthenticatorService<ParentWindowReference>
|
||||
window: ParentWindowReference,
|
||||
abortController?: AbortController,
|
||||
): Promise<Fido2AuthenticatorMakeCredentialResult> {
|
||||
this.logService.debug("[Fido2AuthenticatorService] makeCredential")
|
||||
this.logService.debug("[Fido2AuthenticatorService] create new session")
|
||||
const userInterfaceSession = await this.userInterface.newSession(
|
||||
params.fallbackSupported,
|
||||
window,
|
||||
abortController,
|
||||
);
|
||||
|
||||
this.logService.debug("[Fido2AuthenticatorService] try create new credential")
|
||||
try {
|
||||
if (params.credTypesAndPubKeyAlgs.every((p) => p.alg !== Fido2AlgorithmIdentifier.ES256)) {
|
||||
const requestedAlgorithms = params.credTypesAndPubKeyAlgs.map((p) => p.alg).join(", ");
|
||||
@@ -105,7 +101,6 @@ export class Fido2AuthenticatorService<ParentWindowReference>
|
||||
throw new Fido2AuthenticatorError(Fido2AuthenticatorErrorCode.Unknown);
|
||||
}
|
||||
|
||||
this.logService.debug("Ensuring unlocked vault before creating credential")
|
||||
await userInterfaceSession.ensureUnlockedVault();
|
||||
|
||||
// Avoid syncing if we did it reasonably soon as the only reason for syncing is to validate excludeCredentials
|
||||
@@ -134,7 +129,6 @@ export class Fido2AuthenticatorService<ParentWindowReference>
|
||||
let credentialId: string;
|
||||
let pubKeyDer: ArrayBuffer;
|
||||
|
||||
this.logService.debug("[Fido2AuthenticatorService] Prompting user to confirm creating credential")
|
||||
const response = await userInterfaceSession.confirmNewCredential({
|
||||
credentialName: params.rpEntity.name,
|
||||
userName: params.userEntity.name,
|
||||
@@ -442,29 +436,15 @@ export class Fido2AuthenticatorService<ParentWindowReference>
|
||||
credentials: PublicKeyCredentialDescriptor[],
|
||||
rpId: string,
|
||||
): Promise<CipherView[]> {
|
||||
this.logService.debug("[findCredentialsById]:", credentials, rpId)
|
||||
if (credentials.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
const ciphers = await this.cipherService.getAllDecrypted(activeUserId);
|
||||
this.logService.debug("[findCredentialsById] ciphers:", ciphers)
|
||||
return ciphers.filter(
|
||||
(cipher) => {
|
||||
this.logService.debug(cipher.id,
|
||||
!cipher.isDeleted,
|
||||
cipher.type === CipherType.Login,
|
||||
cipher.login.hasFido2Credentials,
|
||||
cipher.login.fido2Credentials[0].rpId === rpId,
|
||||
credentials.some((credential) => {
|
||||
let credId = cipher.login.fido2Credentials[0].credentialId
|
||||
let parsedCredId = parseCredentialId(credId)
|
||||
this.logService.debug(credential.id, credential.id.byteLength, typeof(credential.id), credId, parsedCredId, parsedCredId.byteLength, typeof(parsedCredId))
|
||||
return compareCredentialIds(credential.id, parsedCredId)
|
||||
}),
|
||||
)
|
||||
return !cipher.isDeleted &&
|
||||
(cipher) =>
|
||||
!cipher.isDeleted &&
|
||||
cipher.type === CipherType.Login &&
|
||||
cipher.login.hasFido2Credentials &&
|
||||
cipher.login.fido2Credentials[0].rpId === rpId &&
|
||||
@@ -474,7 +454,6 @@ export class Fido2AuthenticatorService<ParentWindowReference>
|
||||
parseCredentialId(cipher.login.fido2Credentials[0].credentialId),
|
||||
),
|
||||
)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user