1 import type { Address } from '@proton/shared/lib/interfaces/Address';
3 import type { ADDRESS_STATUS, ADDRESS_TYPE, MEMBER_PRIVATE, MEMBER_ROLE, MEMBER_TYPE } from '../constants';
4 import type { Key } from './Key';
6 export interface PartialMemberAddress {
9 Status: ADDRESS_STATUS;
14 export enum MEMBER_STATE {
20 export enum MEMBER_ORG_KEY_STATE {
21 /** The member does not and should not have access to the org key (e.g. not an admin) */
23 /** The member has full access to the most recent copy of the org key */
25 /** The member does not have access to the most recent copy of the org key (including legacy keys) */
27 /** The member has been invited to but needs to activate the most recent copy of the org key */
31 export interface MemberInvitationData {
36 export enum MemberUnprivatizationState {
42 export enum CreateMemberMode {
47 export interface PublicMemberUnprivatizationOutput {
48 State: MemberUnprivatizationState;
49 InvitationData: string;
50 InvitationSignature: string;
51 InvitationEmail: string;
53 OrgKeyFingerprintSignature: string;
58 export type PrivateMemberUnprivatizationOutput = {
59 State: MemberUnprivatizationState;
61 InvitationSignature: null;
62 InvitationEmail: string;
64 OrgKeyFingerprintSignature: null;
68 export type MemberUnprivatizationOutput = PublicMemberUnprivatizationOutput | PrivateMemberUnprivatizationOutput;
70 export type MemberUnprivatization = {
71 State: MemberUnprivatizationState;
72 PrivateKeys: string[] | null;
73 ActivationToken: string | null;
74 PrivateIntent: boolean;
75 InvitationData: string | null;
76 InvitationSignature: string | null;
77 InvitationEmail: string | null;
80 export type MemberUnprivatizationReadyForUnprivatization = {
81 State: MemberUnprivatizationState.Ready;
82 PrivateKeys: string[];
83 ActivationToken: string;
85 InvitationData: string;
86 InvitationSignature: string;
87 InvitationEmail: string;
90 export type MemberUnprivatizationReadyForUnprivatizationApproval = {
91 State: MemberUnprivatizationState.Ready;
92 PrivateKeys: string[];
93 ActivationToken: string;
96 InvitationSignature: null;
97 InvitationEmail: null;
100 export interface Member {
103 Private: MEMBER_PRIVATE;
105 AccessToOrgKey: MEMBER_ORG_KEY_STATE;
106 ToMigrate: 0 | 1 | 2;
117 Addresses?: PartialMemberAddress[];
120 TwoFactorRequiredTime: number;
122 Unprivatization: null | MemberUnprivatization;
125 export interface MemberReadyForUnprivatization extends Member {
126 Unprivatization: MemberUnprivatizationReadyForUnprivatization;
129 export interface MemberReadyForUnprivatizationApproval extends Member {
130 Unprivatization: MemberUnprivatizationReadyForUnprivatization;
133 export type EnhancedMember = Member &
135 | { addressState: 'stale' | 'partial' | 'pending' | 'rejected' }
137 addressState: 'full';
138 Addresses: Address[];