Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / pass / types / crypto / pass-types.ts
blobd4e3be7b5119433a96fe98e5fc45b471c3070ded
1 import type { ItemState, Maybe, MaybeNull, ShareRole, ShareType } from '@proton/pass/types';
3 export enum PassEncryptionTag {
4     Cache = 'cache' /* Local cache */,
5     Offline = 'offline' /* Offline components */,
6     ItemContent = 'itemcontent',
7     ItemKey = 'itemkey',
8     VaultContent = 'vaultcontent',
9     LinkKey = 'linkkey',
10     BiometricOfflineKD = 'biometricofflinekd',
13 export enum PassSignatureContext {
14     VaultInviteExistingUser = 'pass.invite.vault.existing-user',
15     VaultInviteNewUser = 'pass.invite.vault.new-user',
18 export enum ContentFormatVersion {
19     Share = 1,
20     Item = 6,
23 /* type aliases */
24 export type Rotation = number;
25 export type ShareId = string;
27 export type RotationKey = {
28     key: CryptoKey;
29     raw: Uint8Array;
30     rotation: Rotation;
33 export type VaultKey = RotationKey & { userKeyId: Maybe<string> };
34 export type ItemKey = RotationKey;
36 type OpenedShareBase = {
37     addressId: string;
38     createTime: number;
39     expireTime?: MaybeNull<number>;
40     newUserInvitesReady: number;
41     owner: boolean;
42     permission: number;
43     shared: boolean;
44     shareId: string;
45     shareRoleId: ShareRole;
46     targetId: string;
47     targetMaxMembers: number;
48     targetMembers: number;
49     vaultId: string;
52 export type OpenedShare = OpenedShareBase &
53     (
54         | {
55               content: Uint8Array;
56               contentFormatVersion: number;
57               contentKeyRotation: Rotation;
58               targetType: ShareType.Vault;
59           }
60         | {
61               content: null;
62               contentFormatVersion: null;
63               contentKeyRotation: null;
64               targetType: ShareType.Item;
65           }
66     );
68 export type TypedOpenedShare<T extends ShareType> = Extract<OpenedShare, { targetType: T }>;
70 export type OpenedItem = {
71     aliasEmail: MaybeNull<string>;
72     content: Uint8Array;
73     contentFormatVersion: number;
74     createTime: number;
75     itemId: string;
76     lastUseTime: MaybeNull<number>;
77     modifyTime: number;
78     pinned: boolean;
79     flags: number;
80     revision: number;
81     revisionTime: number;
82     state: ItemState;