import { AbstractAsymCrypto } from "./crypto/AbstractAsymCrypto"; import { FileCreateOutput, FileMetaInformation, FilePrepareCreateOutput, GroupOutDataHmacKeys, UserData, UserPublicKeyData } from "./Enities"; import { SymKey } from "."; import { GroupInviteListItem, GroupList, OtpRegister, UserDeviceList } from "@sentclose/sentc-common"; export declare function getUser(deviceIdentifier: string, user_data: UserData, encrypted_hmac_keys?: GroupOutDataHmacKeys[]): Promise; export declare class User extends AbstractAsymCrypto { user_data: UserData; private userIdentifier; group_invites: GroupInviteListItem[]; constructor(base_url: string, app_token: string, user_data: UserData, userIdentifier: string, group_invites?: GroupInviteListItem[]); private getUserKeys; private getUserKeysSync; getUserSymKey(key_id: string): Promise; getPrivateKey(key_id: string): Promise; getPrivateKeySync(key_id: string): string; getPublicKey(reply_id: string): Promise; getNewestHmacKey(): string; private getNewestKey; getNewestPublicKey(): string; getNewestSignKey(): string; getSignKey(): Promise; getSignKeySync(): string; enabledMfa(): boolean; decryptHmacKeys(fetchedKeys: GroupOutDataHmacKeys[]): Promise; fetchUserKey(key_id: string, first?: boolean): Promise; getJwt(): Promise; private getFreshJwt; updateUser(newIdentifier: string): Promise; registerRawOtp(password: string, mfa_token?: string, mfa_recovery?: boolean): Promise; registerOtp(issuer: string, audience: string, password: string, mfa_token?: string, mfa_recovery?: boolean): Promise<[string, string[]]>; getOtpRecoverKeys(password: string, mfa_token?: string, mfa_recovery?: boolean): Promise; resetRawOtp(password: string, mfa_token?: string, mfa_recovery?: boolean): Promise; resetOtp(issuer: string, audience: string, password: string, mfa_token?: string, mfa_recovery?: boolean): Promise<[string, string[]]>; disableOtp(password: string, mfa_token?: string, mfa_recovery?: boolean): Promise; resetPassword(newPassword: string): Promise; changePassword(oldPassword: string, newPassword: string, mfa_token?: string, mfa_recovery?: boolean): Promise; logOut(): Promise; deleteUser(password: string, mfa_token?: string, mfa_recovery?: boolean): Promise; deleteDevice(password: string, device_id: string, mfa_token?: string, mfa_recovery?: boolean): Promise; prepareRegisterDevice(server_output: string, page?: number): import("sentc_wasm").PreRegisterDeviceData; registerDevice(server_output: string): Promise[]>; getDevices(last_fetched_item?: UserDeviceList | null): Promise; createSafetyNumber(user_to_compare?: { user_id: string; verify_key_id: string; }): Promise; keyRotation(): Promise; finishKeyRotation(): Promise; getGroups(last_fetched_item?: GroupList | null): Promise; getGroupInvites(last_fetched_item?: GroupInviteListItem | null): Promise; acceptGroupInvite(group_id: string): Promise; rejectGroupInvite(group_id: string): Promise; groupJoinRequest(group_id: string): Promise; sentJoinReq(last_fetched_item?: GroupInviteListItem | null): Promise; deleteJoinReq(id: string): Promise; prepareGroupCreate(sign?: boolean): string; createGroup(sign?: boolean): Promise; getGroup(group_id: string, group_as_member?: string, verify?: number): Promise; /** * Prepare the register of a file. The server input could be passed to the sentc api from your backend * * encrypted_file_name, key and master_key_id are only for the frontend to encrypt more data if necessary * * @param file * @throws SentcError */ prepareRegisterFile(file: File): Promise; /** * Prepare the register of a file. The server input could be passed to the sentc api from your backend * * encrypted_file_name, key and master_key_id are only for the frontend to encrypt more data if necessary * * this file is registered for another user to open it * * @param file * @param reply_id * @throws SentcError */ prepareRegisterFile(file: File, reply_id: string): Promise; /** * Validates the sentc file register output * Returns the file id * * @param server_output */ doneFileRegister(server_output: string): string[]; /** * Upload a registered file. * Session id is returned from the sentc api. The rest from @prepareRegisterFile * * @param file * @param content_key * @param session_id */ uploadFile(file: File, content_key: SymKey, session_id: string): Promise; /** * Upload a registered file. * Session id is returned from the sentc api. The rest from @prepareRegisterFile * upload the chunks signed by the creators sign key * * @param file * @param content_key * @param session_id * @param sign */ uploadFile(file: File, content_key: SymKey, session_id: string, sign: true): Promise; /** * Upload a registered file. * Session id is returned from the sentc api. The rest from @prepareRegisterFile * optional upload the chunks signed by the creators sign key * Show the upload progress of how many chunks are already uploaded * * @param file * @param content_key * @param session_id * @param sign * @param upload_callback */ uploadFile(file: File, content_key: SymKey, session_id: string, sign: boolean, upload_callback: (progress?: number) => void): Promise; private getFileMetaInfo; /** * Get the FileMetaInformation which contains all Information about the file * Return also the file key back. * * This function can be used if the user needs the decrypted file name. * * @param file_id */ downloadFileMetaInfo(file_id: string): Promise<[FileMetaInformation, SymKey]>; /** * The same but with a verify key * * @param file_id * @param verify_key */ downloadFileMetaInfo(file_id: string, verify_key: string): Promise<[FileMetaInformation, SymKey]>; /** * Download a file but with already downloaded file information and * the file key to not fetch the info and the key again. * * This function can be used after the downloadFileMetaInfo function * * @param key * @param file_meta */ downloadFileWithMetaInfo(key: SymKey, file_meta: FileMetaInformation): Promise; /** * The same but with a verify key to verify each file part * * @param key * @param file_meta * @param verify_key */ downloadFileWithMetaInfo(key: SymKey, file_meta: FileMetaInformation, verify_key: string): Promise; /** * The same but with optional verify key and a function to show the download progress * * @param key * @param file_meta * @param verify_key * @param updateProgressCb */ downloadFileWithMetaInfo(key: SymKey, file_meta: FileMetaInformation, verify_key: string, updateProgressCb: (progress: number) => void): Promise; /** * Register and upload a file to the sentc api. * The file will be encrypted * * @param file */ createFile(file: File): Promise; /** * Create a file and sign each file part with the sign key of the creator * * @param file * @param sign */ createFile(file: File, sign: true): Promise; createFile(file: File, sign: boolean, reply_id: string): Promise; /** * The same but with optional signing and a function to show the upload progress * * @param file * @param sign * @param reply_id * @param upload_callback */ createFile(file: File, sign: boolean, reply_id: string, upload_callback: (progress?: number) => void): Promise; /** * Download a file. THis function will also download the file meta information before * * @param file_id */ downloadFile(file_id: string): Promise<[string, FileMetaInformation, SymKey]>; /** * The same but with a verify key of the file creator * * @param file_id * @param verify_key */ downloadFile(file_id: string, verify_key: string): Promise<[string, FileMetaInformation, SymKey]>; /** * The same but with an optional verify key and a function to show the download progress * * @param file_id * @param verify_key * @param updateProgressCb */ downloadFile(file_id: string, verify_key: string, updateProgressCb: (progress: number) => void): Promise<[string, FileMetaInformation, SymKey]>; updateFileName(file_id: string, content_key: SymKey, file_name?: string): Promise; deleteFile(file_id: string): Promise; }