1 import type { PublicKeyReference } from '@proton/crypto';
11 } from '../constants';
12 import type { Address } from './Address';
13 import type { KeyTransparencyVerificationResult } from './KeyTransparency';
14 import type { MailSettings } from './MailSettings';
16 export interface PublicKeyWithPref {
17 publicKey: PublicKeyReference;
21 export interface SelfSend {
23 publicKey?: PublicKeyReference;
27 export type MimeTypeVcard = MIME_TYPES.PLAINTEXT;
29 export interface ProcessedApiKey {
32 publicKey: PublicKeyReference;
33 source: API_KEY_SOURCE;
36 export interface ApiKeysConfig {
37 publicKeys: ProcessedApiKey[];
39 RecipientType?: RECIPIENT_TYPES;
42 * Internal addresses with e2ee disabled are marked as having EXTERNAL recipient type.
43 * This flag allows distinguishing them from actual external users, for which E2EE should
44 * never be disabled, even for mail (since e.g. they might have WKD set up, or uploaded keys associated with them).
46 isInternalWithDisabledE2EEForMail?: boolean;
47 MIMEType?: MIME_TYPES;
50 ktVerificationResult?: KeyTransparencyVerificationResult;
53 export interface PinnedKeysConfig {
54 pinnedKeys: PublicKeyReference[];
55 encryptToPinned?: boolean;
56 encryptToUntrusted?: boolean;
59 mimeType?: MimeTypeVcard;
62 isContactSignatureVerified?: boolean;
63 contactSignatureTimestamp?: Date;
66 export interface PublicKeyConfigs {
68 apiKeysConfig: ApiKeysConfig;
69 pinnedKeysConfig: PinnedKeysConfig;
70 mailSettings: MailSettings;
73 export interface ContactPublicKeyModel {
76 apiKeys: PublicKeyReference[];
77 pinnedKeys: PublicKeyReference[];
78 verifyingPinnedKeys: PublicKeyReference[]; // Subset of pinned keys not marked as compromised
82 mimeType: CONTACT_MIME_TYPES;
83 scheme: CONTACT_PGP_SCHEMES;
84 isInternalWithDisabledE2EEForMail: boolean; // Both `encrypt` and `isInternalWithDisabledE2EEForMail` might be true at this stage
85 trustedFingerprints: Set<string>;
86 obsoleteFingerprints: Set<string>; // Keys that are not allowed to encrypt, because they are marked as obsolete.
87 encryptionCapableFingerprints: Set<string>; // Keys that are capable of encryption (regardless of whether they are allowed to encrypt).
88 compromisedFingerprints: Set<string>; // Keys that are not allowed to encrypt nor sign, because they are marked as compromised
89 isPGPExternal: boolean;
90 isPGPInternal: boolean;
91 isPGPExternalWithExternallyFetchedKeys: boolean; // Keys from e.g. WKD or keys.openpgp.org (KOO)
92 isPGPExternalWithoutExternallyFetchedKeys: boolean;
93 pgpAddressDisabled: boolean;
95 isContactSignatureVerified?: boolean;
96 contactSignatureTimestamp?: Date;
97 emailAddressWarnings?: string[];
98 emailAddressErrors?: string[];
99 ktVerificationResult?: KeyTransparencyVerificationResult;
102 export interface ContactPublicKeyModelWithApiKeySource extends ContactPublicKeyModel {
103 apiKeysSourceMap: Partial<{ [source in API_KEY_SOURCE]: Set<string> }>; // map source to fingerprints
106 export interface PublicKeyModel {
107 emailAddress: string;
109 apiKeys: PublicKeyReference[];
110 pinnedKeys: PublicKeyReference[];
111 verifyingPinnedKeys: PublicKeyReference[];
115 mimeType: CONTACT_MIME_TYPES;
117 isInternalWithDisabledE2EEForMail: boolean; // Both `encrypt` and `isInternalWithDisabledE2EEForMail` might be true at this stage
118 trustedFingerprints: Set<string>;
119 obsoleteFingerprints: Set<string>;
120 encryptionCapableFingerprints: Set<string>;
121 compromisedFingerprints: Set<string>;
122 isPGPExternal: boolean;
123 isPGPInternal: boolean;
124 isPGPExternalWithExternallyFetchedKeys: boolean; // Keys from e.g. WKD or keys.openpgp.org (KOO)
125 isPGPExternalWithoutExternallyFetchedKeys: boolean;
126 pgpAddressDisabled: boolean;
128 isContactSignatureVerified?: boolean;
129 contactSignatureTimestamp?: Date;
130 emailAddressWarnings?: string[];
131 emailAddressErrors?: string[];
132 ktVerificationResult?: KeyTransparencyVerificationResult;