1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-24 00:23:17 +00:00

Merge remote-tracking branch 'origin/main' into playwright

This commit is contained in:
Matt Gibson
2026-01-26 12:57:05 -08:00
1790 changed files with 150488 additions and 32025 deletions

View File

@@ -7,8 +7,7 @@ import { ForwarderContext } from "../forwarder-context";
export class CreateForwardingAddressRpc<
Settings extends ApiSettings,
Req extends IntegrationRequest = IntegrationRequest,
> implements JsonRpc<Req, string>
{
> implements JsonRpc<Req, string> {
constructor(
readonly requestor: ForwarderConfiguration<Settings>,
readonly context: ForwarderContext<Settings>,

View File

@@ -9,8 +9,7 @@ import { ForwarderContext } from "../forwarder-context";
export class GetAccountIdRpc<
Settings extends ApiSettings,
Req extends IntegrationRequest = IntegrationRequest,
> implements JsonRpc<Req, string>
{
> implements JsonRpc<Req, string> {
constructor(
readonly requestor: ForwarderConfiguration<Settings>,
readonly context: ForwarderContext<Settings>,

View File

@@ -24,6 +24,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
overridePasswordType: override,
},
enabled: true,
revisionDate: new Date().toISOString(),
});
const result = availableAlgorithms([policy]);
@@ -44,6 +45,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
overridePasswordType: override,
},
enabled: true,
revisionDate: new Date().toISOString(),
});
const result = availableAlgorithms([policy, policy]);
@@ -64,6 +66,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
overridePasswordType: "password",
},
enabled: true,
revisionDate: new Date().toISOString(),
});
const passphrase = new Policy({
id: "" as PolicyId,
@@ -73,6 +76,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
overridePasswordType: "passphrase",
},
enabled: true,
revisionDate: new Date().toISOString(),
});
const result = availableAlgorithms([password, passphrase]);
@@ -93,6 +97,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
some: "policy",
},
enabled: true,
revisionDate: new Date().toISOString(),
});
const result = availableAlgorithms([policy]);
@@ -111,6 +116,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
some: "policy",
},
enabled: false,
revisionDate: new Date().toISOString(),
});
const result = availableAlgorithms([policy]);
@@ -129,6 +135,7 @@ describe("availableAlgorithms_vNextPolicy", () => {
some: "policy",
},
enabled: true,
revisionDate: new Date().toISOString(),
});
const result = availableAlgorithms([policy]);

View File

@@ -2,9 +2,10 @@ import { PolicyEvaluator } from "../abstractions";
import { NoPolicy } from "../types";
/** A policy evaluator that does not apply any policy */
export class DefaultPolicyEvaluator<PolicyTarget>
implements PolicyEvaluator<NoPolicy, PolicyTarget>
{
export class DefaultPolicyEvaluator<PolicyTarget> implements PolicyEvaluator<
NoPolicy,
PolicyTarget
> {
/** {@link PolicyEvaluator.policy} */
get policy() {
return {};

View File

@@ -13,9 +13,7 @@ import { atLeast, atLeastSum, maybe, readonlyTrueWhen, AtLeastOne, Zero } from "
import { PasswordPolicyConstraints } from "./password-policy-constraints";
/** Creates state constraints by blending policy and password settings. */
export class DynamicPasswordPolicyConstraints
implements DynamicStateConstraints<PasswordGeneratorSettings>
{
export class DynamicPasswordPolicyConstraints implements DynamicStateConstraints<PasswordGeneratorSettings> {
/** Instantiates the object.
* @param policy the password policy to enforce. This cannot be
* `null` or `undefined`.

View File

@@ -17,6 +17,7 @@ function createPolicy(
data,
enabled,
type,
revisionDate: new Date().toISOString(),
});
}

View File

@@ -17,6 +17,7 @@ function createPolicy(
data,
enabled,
type,
revisionDate: new Date().toISOString(),
});
}

View File

@@ -25,7 +25,11 @@ import { deepFreeze } from "@bitwarden/common/tools/util";
import { UserId } from "@bitwarden/common/types/guid";
import { BitwardenClient } from "@bitwarden/sdk-internal";
import { FakeAccountService, FakeStateProvider } from "../../../../../common/spec";
import {
FakeAccountService,
FakeStateProvider,
mockAccountInfoWith,
} from "../../../../../common/spec";
import { Algorithm, AlgorithmsByType, CredentialAlgorithm, Type, Types } from "../metadata";
import catchall from "../metadata/email/catchall";
import plusAddress from "../metadata/email/plus-address";
@@ -40,9 +44,10 @@ import { GeneratorMetadataProvider } from "./generator-metadata-provider";
const SomeUser = "some user" as UserId;
const SomeAccount = {
id: SomeUser,
email: "someone@example.com",
emailVerified: true,
name: "Someone",
...mockAccountInfoWith({
email: "someone@example.com",
name: "Someone",
}),
};
const SomeAccount$ = new BehaviorSubject<Account>(SomeAccount);

View File

@@ -15,7 +15,12 @@ import { UserStateSubjectDependencyProvider } from "@bitwarden/common/tools/stat
import { StateConstraints } from "@bitwarden/common/tools/types";
import { OrganizationId, PolicyId, UserId } from "@bitwarden/common/types/guid";
import { FakeStateProvider, FakeAccountService, awaitAsync } from "../../../../../common/spec";
import {
FakeStateProvider,
FakeAccountService,
awaitAsync,
mockAccountInfoWith,
} from "../../../../../common/spec";
import { CoreProfileMetadata, ProfileContext } from "../metadata/profile-metadata";
import { GeneratorConstraints } from "../types";
@@ -31,21 +36,25 @@ const UnverifiedEmailUser = "UnverifiedEmailUser" as UserId;
const accounts: Record<UserId, Account> = {
[SomeUser]: {
id: SomeUser,
name: "some user",
email: "some.user@example.com",
emailVerified: true,
...mockAccountInfoWith({
name: "some user",
email: "some.user@example.com",
}),
},
[AnotherUser]: {
id: AnotherUser,
name: "some other user",
email: "some.other.user@example.com",
emailVerified: true,
...mockAccountInfoWith({
name: "some other user",
email: "some.other.user@example.com",
}),
},
[UnverifiedEmailUser]: {
id: UnverifiedEmailUser,
name: "a user with an unverfied email",
email: "unverified@example.com",
emailVerified: false,
...mockAccountInfoWith({
name: "a user with an unverfied email",
email: "unverified@example.com",
emailVerified: false,
}),
},
};
const accountService = new FakeAccountService(accounts);
@@ -57,6 +66,7 @@ const somePolicy = new Policy({
id: "" as PolicyId,
organizationId: "" as OrganizationId,
enabled: true,
revisionDate: new Date().toISOString(),
});
const stateProvider = new FakeStateProvider(accountService);

View File

@@ -8,7 +8,7 @@ import { Vendor } from "@bitwarden/common/tools/extension/vendor/data";
import { SemanticLogger, ifEnabledSemanticLoggerProvider } from "@bitwarden/common/tools/log";
import { UserId } from "@bitwarden/common/types/guid";
import { awaitAsync } from "../../../../../common/spec";
import { awaitAsync, mockAccountInfoWith } from "../../../../../common/spec";
import {
Algorithm,
CredentialAlgorithm,
@@ -56,9 +56,10 @@ describe("DefaultCredentialGeneratorService", () => {
// Use a hard-coded value for mockAccount
account = {
id: "test-account-id" as UserId,
emailVerified: true,
email: "test@example.com",
name: "Test User",
...mockAccountInfoWith({
email: "test@example.com",
name: "Test User",
}),
};
system = {

View File

@@ -13,9 +13,10 @@ import { observe$PerUserId, sharedStateByUserId } from "../util";
import { CATCHALL_SETTINGS } from "./storage";
/** Strategy for creating usernames using a catchall email address */
export class CatchallGeneratorStrategy
implements GeneratorStrategy<CatchallGenerationOptions, NoPolicy>
{
export class CatchallGeneratorStrategy implements GeneratorStrategy<
CatchallGenerationOptions,
NoPolicy
> {
/** Instantiates the generation strategy
* @param usernameService generates a catchall address for a domain
*/

View File

@@ -16,9 +16,10 @@ const UsernameDigits = Object.freeze({
});
/** Strategy for creating usernames from the EFF wordlist */
export class EffUsernameGeneratorStrategy
implements GeneratorStrategy<EffUsernameGenerationOptions, NoPolicy>
{
export class EffUsernameGeneratorStrategy implements GeneratorStrategy<
EffUsernameGenerationOptions,
NoPolicy
> {
/** Instantiates the generation strategy
* @param usernameService generates a username from EFF word list
*/

View File

@@ -10,8 +10,7 @@ import { Classifier } from "@bitwarden/common/tools/state/classifier";
export class OptionsClassifier<
Settings,
Options extends IntegrationRequest & Settings = IntegrationRequest & Settings,
> implements Classifier<Options, Record<string, never>, Settings>
{
> implements Classifier<Options, Record<string, never>, Settings> {
/** Partitions `secret` into its disclosed properties and secret properties.
* @param value The object to partition
* @returns an object that classifies secrets.

View File

@@ -14,9 +14,10 @@ import { observe$PerUserId, optionsToEffWordListRequest, sharedStateByUserId } f
import { PASSPHRASE_SETTINGS } from "./storage";
/** Generates passphrases composed of random words */
export class PassphraseGeneratorStrategy
implements GeneratorStrategy<PassphraseGenerationOptions, PassphraseGeneratorPolicy>
{
export class PassphraseGeneratorStrategy implements GeneratorStrategy<
PassphraseGenerationOptions,
PassphraseGeneratorPolicy
> {
/** instantiates the password generator strategy.
* @param legacy generates the passphrase
* @param stateProvider provides durable state

View File

@@ -12,9 +12,10 @@ import { observe$PerUserId, optionsToRandomAsciiRequest, sharedStateByUserId } f
import { PASSWORD_SETTINGS } from "./storage";
/** Generates passwords composed of random characters */
export class PasswordGeneratorStrategy
implements GeneratorStrategy<PasswordGenerationOptions, PasswordGeneratorPolicy>
{
export class PasswordGeneratorStrategy implements GeneratorStrategy<
PasswordGenerationOptions,
PasswordGeneratorPolicy
> {
/** instantiates the password generator strategy.
* @param legacy generates the password
*/

View File

@@ -17,9 +17,10 @@ import { SUBADDRESS_SETTINGS } from "./storage";
* For example, if the email address is `jd+xyz@domain.io`,
* the subaddress is `xyz`.
*/
export class SubaddressGeneratorStrategy
implements GeneratorStrategy<SubaddressGenerationOptions, NoPolicy>
{
export class SubaddressGeneratorStrategy implements GeneratorStrategy<
SubaddressGenerationOptions,
NoPolicy
> {
/** Instantiates the generation strategy
* @param usernameService generates an email subaddress from an email address
*/