Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-8280] email forwarders #11563

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f26ab56
rough example
audreyality Oct 9, 2024
7b5403a
tweak injection
audreyality Oct 9, 2024
0791191
component rough draft
audreyality Oct 10, 2024
3aebbe9
forwarder lookup and generation support
audreyality Oct 10, 2024
b79d4c1
localize algorithm names and descriptions in the credential generatorโ€ฆ
audreyality Oct 10, 2024
71fee42
fix generator services tests
audreyality Oct 10, 2024
273c116
add encryption support to UserStateSubject
audreyality Oct 14, 2024
c48ddd8
move generic rx utilities to common
audreyality Oct 14, 2024
32aa042
finish forwarder drilldown
audreyality Oct 15, 2024
1ad1b90
Merge branch 'main' into tools/PM-8280/email-forwarders
audreyality Oct 15, 2024
51d2983
integrate forwarder storage into credential service; breaks tests
audreyality Oct 15, 2024
d5a19ba
fix credential generator tests and angular imports
audreyality Oct 16, 2024
1a5dae5
add forwarder settings to credential generator
audreyality Oct 16, 2024
919984c
unit test `withLatestReady`
audreyality Oct 16, 2024
98386c3
fixing duplicate input when encryptor changes
audreyality Oct 16, 2024
7461ce0
Merge branch 'main' into tools/PM-8280/email-forwarders
audreyality Oct 16, 2024
84245c2
unit test UserStateSubject with ObjectKey
audreyality Oct 16, 2024
b9d17cb
Merge branch 'main' into tools/PM-8280/email-forwarders
audreyality Oct 17, 2024
98270c9
fix username preference flapping
audreyality Oct 17, 2024
0cb3e80
forwarder component cleanup
audreyality Oct 17, 2024
e496798
fix username options and service box display crosstalk
audreyality Oct 17, 2024
9da8aa8
fix disabled forwarder settings
audreyality Oct 17, 2024
2ecef51
fix forwarder display after navigation bug
audreyality Oct 17, 2024
4036480
only update forwarder preference when a forwarder is selected
audreyality Oct 18, 2024
994877c
fix service dropdown not displayed after navigation
audreyality Oct 18, 2024
11dc419
fix service dropdown not selecting a forwarder
audreyality Oct 18, 2024
b2f2da7
fix a bunch of forwarder cascade edge cases
audreyality Oct 18, 2024
883aff4
fix repeating algorithm updates
audreyality Oct 18, 2024
8f3ecab
fix settings not switching when service changes
audreyality Oct 20, 2024
71fc8e9
Merge branch 'main' into tools/PM-8280/email-forwarders
audreyality Oct 20, 2024
e39a022
i18n nits
audreyality Oct 20, 2024
aed3a83
additional i18n nits
audreyality Oct 20, 2024
cb3eb13
display forwarder errors in a toast
audreyality Oct 21, 2024
1b0318e
usability tweaks
audreyality Oct 21, 2024
cb964d8
fix null dereference error
audreyality Oct 21, 2024
ffe13bb
port fixes from credential to username generator component
audreyality Oct 21, 2024
31bebe0
use legacy settings storage
audreyality Oct 21, 2024
45328a7
adjust ui hints
audreyality Oct 21, 2024
59ac3f5
margin tweak
audreyality Oct 21, 2024
adde4fd
Merge branch 'main' into tools/PM-8280/email-forwarders
audreyality Oct 21, 2024
a50ab68
fix load from fresh settings bug
audreyality Oct 21, 2024
5820e44
Merge branch 'main' into tools/PM-8280/email-forwarders
audreyality Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,10 @@
"baseUrl": {
"message": "Server URL"
},
"selfHostBaseUrl": {
"message": "Self-host server URL",
"description": "Label for field requesting a self-hosted integration service URL"
},
"apiUrl": {
"message": "API server URL"
},
Expand Down Expand Up @@ -2867,6 +2871,14 @@
"forwardedEmailDesc": {
"message": "Generate an email alias with an external forwarding service."
},
"forwarderDomainName": {
"message": "Email domain",
"description": "Labels the domain name email forwarder service option"
},
"forwarderDomainNameHint": {
"message": "Choose a domain that is supported by the selected service",
"description": "Guidance provided for email forwarding services that support multiple email domains."
},
"forwarderError": {
"message": "$SERVICENAME$ error: $ERRORMESSAGE$",
"description": "Reports an error returned by a forwarding service to the user.",
Expand Down
12 changes: 12 additions & 0 deletions apps/desktop/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,10 @@
"baseUrl": {
"message": "Server URL"
},
"selfHostBaseUrl": {
"message": "Self-host server URL",
"description": "Label for field requesting a self-hosted integration service URL"
},
"apiUrl": {
"message": "API server URL"
},
Expand Down Expand Up @@ -2395,6 +2399,14 @@
"forwardedEmailDesc": {
"message": "Generate an email alias with an external forwarding service."
},
"forwarderDomainName": {
"message": "Email domain",
"description": "Labels the domain name email forwarder service option"
},
"forwarderDomainNameHint": {
"message": "Choose a domain that is supported by the selected service",
"description": "Guidance provided for email forwarding services that support multiple email domains."
},
"forwarderError": {
"message": "$SERVICENAME$ error: $ERRORMESSAGE$",
"description": "Reports an error returned by a forwarding service to the user.",
Expand Down
12 changes: 12 additions & 0 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6459,6 +6459,14 @@
"forwardedEmailDesc": {
"message": "Generate an email alias with an external forwarding service."
},
"forwarderDomainName": {
"message": "Email domain",
"description": "Labels the domain name email forwarder service option"
},
"forwarderDomainNameHint": {
"message": "Choose a domain that is supported by the selected service",
"description": "Guidance provided for email forwarding services that support multiple email domains."
},
"forwarderError": {
"message": "$SERVICENAME$ error: $ERRORMESSAGE$",
"description": "Reports an error returned by a forwarding service to the user.",
Expand Down Expand Up @@ -8258,6 +8266,10 @@
"baseUrl": {
"message": "Server URL"
},
"selfHostBaseUrl": {
"message": "Self-host server URL",
"description": "Label for field requesting a self-hosted integration service URL"
},
"aliasDomain": {
"message": "Alias domain"
},
Expand Down
8 changes: 8 additions & 0 deletions libs/common/src/tools/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Observable } from "rxjs";
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
import { UserId } from "@bitwarden/common/types/guid";

import { UserEncryptor } from "./state/user-encryptor.abstraction";

/** error emitted when the `SingleUserDependency` changes Ids */
export type UserChangedError = {
/** the userId pinned by the single user dependency */
Expand Down Expand Up @@ -45,6 +47,12 @@ export type UserDependency = {
userId$: Observable<UserId>;
};

export type UserBound<K extends keyof any, T> = { [P in K]: T } & { userId: UserId };

export type SingleUserEncryptorDependency = {
singleUserEncryptor$: Observable<UserBound<"encryptor", UserEncryptor>>;
};

/** A pattern for types that depend upon a fixed userid and return
* an observable.
*
Expand Down
14 changes: 10 additions & 4 deletions libs/common/src/tools/integration/integration-id.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Opaque } from "type-fest";

export const IntegrationIds = [

Check warning on line 3 in libs/common/src/tools/integration/integration-id.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/integration/integration-id.ts#L3

Added line #L3 was not covered by tests
"anonaddy",
"duckduckgo",
"fastmail",
"firefoxrelay",
"forwardemail",
"simplelogin",
] as const;

/** Identifies a vendor integrated into bitwarden */
export type IntegrationId = Opaque<
"anonaddy" | "duckduckgo" | "fastmail" | "firefoxrelay" | "forwardemail" | "simplelogin",
"IntegrationId"
>;
export type IntegrationId = Opaque<(typeof IntegrationIds)[number], "IntegrationId">;
31 changes: 31 additions & 0 deletions libs/common/src/tools/private-classifier.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Jsonify } from "type-fest";

import { Classifier } from "@bitwarden/common/tools/state/classifier";

export class PrivateClassifier<Data> implements Classifier<Data, Record<string, never>, Data> {
constructor(private keys: (keyof Jsonify<Data>)[] = undefined) {}

classify(value: Data): { disclosed: Jsonify<Record<string, never>>; secret: Jsonify<Data> } {
const pickMe = JSON.parse(JSON.stringify(value));
const keys: (keyof Jsonify<Data>)[] = this.keys ?? (Object.keys(pickMe) as any);

const picked: Partial<Jsonify<Data>> = {};
for (const key of keys) {
picked[key] = pickMe[key];
}
const secret = picked as Jsonify<Data>;

return { disclosed: null, secret };
}

declassify(_disclosed: Jsonify<Record<keyof Data, never>>, secret: Jsonify<Data>) {
const result: Partial<Jsonify<Data>> = {};
const keys: (keyof Jsonify<Data>)[] = this.keys ?? (Object.keys(secret) as any);

for (const key of keys) {
result[key] = secret[key];
}

return result as Jsonify<Data>;
}
}
29 changes: 29 additions & 0 deletions libs/common/src/tools/public-classifier.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Jsonify } from "type-fest";

import { Classifier } from "@bitwarden/common/tools/state/classifier";

export class PublicClassifier<Data> implements Classifier<Data, Data, Record<string, never>> {
constructor(private keys: (keyof Jsonify<Data>)[]) {}

Check warning on line 6 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L5-L6

Added lines #L5 - L6 were not covered by tests

classify(value: Data): { disclosed: Jsonify<Data>; secret: Jsonify<Record<string, never>> } {
const pickMe = JSON.parse(JSON.stringify(value));

Check warning on line 9 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L9

Added line #L9 was not covered by tests

const picked: Partial<Jsonify<Data>> = {};
for (const key of this.keys) {
picked[key] = pickMe[key];

Check warning on line 13 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L11-L13

Added lines #L11 - L13 were not covered by tests
}
const disclosed = picked as Jsonify<Data>;

Check warning on line 15 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L15

Added line #L15 was not covered by tests

return { disclosed, secret: null };

Check warning on line 17 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L17

Added line #L17 was not covered by tests
}

declassify(disclosed: Jsonify<Data>, _secret: Jsonify<Record<keyof Data, never>>) {
const result: Partial<Jsonify<Data>> = {};

Check warning on line 21 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L21

Added line #L21 was not covered by tests

for (const key of this.keys) {
result[key] = disclosed[key];

Check warning on line 24 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L23-L24

Added lines #L23 - L24 were not covered by tests
}

return result as Jsonify<Data>;

Check warning on line 27 in libs/common/src/tools/public-classifier.ts

View check run for this annotation

Codecov / codecov/patch

libs/common/src/tools/public-classifier.ts#L27

Added line #L27 was not covered by tests
}
}
Loading
Loading