Skip to content

Commit

Permalink
Remove Fido2VaultCredentials feature flag (#7463)
Browse files Browse the repository at this point in the history
* Removed Fido2 client credentials feature flag

* Removed test for feature flag.
  • Loading branch information
trmartin4 committed Jan 9, 2024
1 parent b144f5b commit c9a2f07
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
2 changes: 0 additions & 2 deletions libs/common/src/enums/feature-flag.enum.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export enum FeatureFlag {
DisplayLowKdfIterationWarningFlag = "display-kdf-iteration-warning",
Fido2VaultCredentials = "fido2-vault-credentials",
TrustedDeviceEncryption = "trusted-device-encryption",
PasswordlessLogin = "passwordless-login",
AutofillV2 = "autofill-v2",
Expand Down
21 changes: 0 additions & 21 deletions libs/common/src/vault/services/fido2/fido2-client.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe("FidoAuthenticatorService", () => {
stateService = mock<StateService>();

client = new Fido2ClientService(authenticator, configService, authService, stateService);
configService.getFeatureFlag.mockResolvedValue(true);
configService.serverConfig$ = of({ environment: { vault: VaultUrl } } as any);
stateService.getEnablePasskeys.mockResolvedValue(true);
authService.getAuthStatus.mockResolvedValue(AuthenticationStatus.Unlocked);
Expand Down Expand Up @@ -225,16 +224,6 @@ describe("FidoAuthenticatorService", () => {
await rejects.toBeInstanceOf(DOMException);
});

it("should throw FallbackRequestedError if feature flag is not enabled", async () => {
const params = createParams();
configService.getFeatureFlag.mockResolvedValue(false);

const result = async () => await client.createCredential(params, tab);

const rejects = expect(result).rejects;
await rejects.toThrow(FallbackRequestedError);
});

it("should throw FallbackRequestedError if passkeys state is not enabled", async () => {
const params = createParams();
stateService.getEnablePasskeys.mockResolvedValue(false);
Expand Down Expand Up @@ -405,16 +394,6 @@ describe("FidoAuthenticatorService", () => {
await rejects.toBeInstanceOf(DOMException);
});

it("should throw FallbackRequestedError if feature flag is not enabled", async () => {
const params = createParams();
configService.getFeatureFlag.mockResolvedValue(false);

const result = async () => await client.assertCredential(params, tab);

const rejects = expect(result).rejects;
await rejects.toThrow(FallbackRequestedError);
});

it("should throw FallbackRequestedError if passkeys state is not enabled", async () => {
const params = createParams();
stateService.getEnablePasskeys.mockResolvedValue(false);
Expand Down
16 changes: 2 additions & 14 deletions libs/common/src/vault/services/fido2/fido2-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { parse } from "tldts";

import { AuthService } from "../../../auth/abstractions/auth.service";
import { AuthenticationStatus } from "../../../auth/enums/authentication-status";
import { FeatureFlag } from "../../../enums/feature-flag.enum";
import { ConfigServiceAbstraction } from "../../../platform/abstractions/config/config.service.abstraction";
import { LogService } from "../../../platform/abstractions/log.service";
import { StateService } from "../../../platform/abstractions/state.service";
Expand Down Expand Up @@ -57,20 +56,9 @@ export class Fido2ClientService implements Fido2ClientServiceAbstraction {
const serverConfig = await firstValueFrom(this.configService.serverConfig$);
const isOriginEqualBitwardenVault = origin === serverConfig.environment?.vault;

if (
!userEnabledPasskeys ||
!isUserLoggedIn ||
isExcludedDomain ||
isOriginEqualBitwardenVault
) {
return false;
}

const featureFlagEnabled = await this.configService.getFeatureFlag<boolean>(
FeatureFlag.Fido2VaultCredentials,
return (
userEnabledPasskeys && isUserLoggedIn && !isExcludedDomain && !isOriginEqualBitwardenVault
);

return featureFlagEnabled;
}

async createCredential(
Expand Down

0 comments on commit c9a2f07

Please sign in to comment.