1 import type { PGP_SCHEMES } from '../../constants';
2 import type { MimeTypeVcard } from '../EncryptionPreferences';
26 export type ParamKey =
39 export interface VCardProperty<T = any> {
41 params?: Partial<Record<ParamKey, string>>;
44 * Proton specific: outside of RFC's scope
50 export interface VcardNValue {
51 familyNames: string[];
53 additionalNames: string[];
54 honorificPrefixes: string[];
55 honorificSuffixes: string[];
58 export enum VCardGender {
67 export interface VCardOrg {
68 organizationalName?: string;
69 organizationalUnitNames?: string[];
72 export interface VCardGenderValue {
77 export interface VCardAddress {
78 postOfficeBox: string;
79 extendedAddress: string;
80 streetAddress: string;
87 export type VCardDateOrText =
98 interface BaseVCardContact {
99 fn: VCardProperty<string>[];
100 n?: VCardProperty<VcardNValue>;
101 nickname?: VCardProperty<string>[];
102 photo?: VCardProperty<string>[];
103 bday?: VCardProperty<VCardDateOrText>;
104 anniversary?: VCardProperty<VCardDateOrText>;
105 gender?: VCardProperty<VCardGenderValue>;
106 adr?: VCardProperty<VCardAddress>[];
107 tel?: VCardProperty<string>[];
108 email?: VCardProperty<string>[];
109 impp?: VCardProperty<string>[];
110 lang?: VCardProperty<string>[];
111 tz?: VCardProperty<string>[];
112 geo?: VCardProperty<string>[];
113 title?: VCardProperty<string>[];
114 role?: VCardProperty<string>[];
115 logo?: VCardProperty<string>[];
116 org?: VCardProperty<VCardOrg>[];
117 member?: VCardProperty<string>[];
118 related?: VCardProperty<string>[];
119 note?: VCardProperty<string>[];
120 url?: VCardProperty<string>[];
122 * Array-valued categories pose problems to ICAL (even though a vcard with CATEGORIES:ONE,TWO
123 * will be parsed into a value ['ONE', 'TWO'], ICAL.js fails to transform it back).
124 * So we prefer storing array-valued category as several properties
126 categories?: VCardProperty<string>[];
127 key?: VCardProperty<string>[];
128 version?: VCardProperty<string>;
129 'x-pm-sign'?: VCardProperty<boolean>[];
130 'x-pm-scheme'?: VCardProperty<PGP_SCHEMES>[];
131 'x-pm-mimetype'?: VCardProperty<MimeTypeVcard>[];
134 export type VCardContact = BaseVCardContact &
138 * Encryption flag that applies if 'key' field (i.e. pinned keys) is populated
140 'x-pm-encrypt'?: VCardProperty<boolean>[];
144 * Encryption flag that applies to (unpinned) keys from e.g. WKD or other untrusted servers
146 'x-pm-encrypt-untrusted'?: VCardProperty<boolean>[];