import { RequestOptions, type UploadForm } from '../Chat.js'; import { type BackupAuthCredential, type GenericServerPublicParams } from '../../zkgroup/index.js'; import { type CdnCredentials } from './CdnCredentials.js'; import { type PrivateKey } from '../../EcKeys.js'; import { type Rng } from '../../RngForTesting.js'; export { type CdnCredentials } from './CdnCredentials.js'; declare module '../Chat' { interface UnauthenticatedChatConnection extends UnauthBackupsService { } } export type BackupAuth = { credential: BackupAuthCredential; serverKeys: GenericServerPublicParams; signingKey: PrivateKey; }; export interface UnauthBackupsService { /** * Get a messages backup upload form * * @param rng should be omitted in production * @throws {UploadTooLarge} if `uploadSize` is too large * @throws {RequestUnauthorizedError} if `auth` is invalid * @throws {StandardNetworkError} */ getUploadForm: (request: { auth: BackupAuth; uploadSize: number; rng?: Rng; }, options?: RequestOptions) => Promise; /** * Get a media backup upload form * * @param rng should be omitted in production * @throws {UploadTooLarge} if `uploadSize` is too large * @throws {RequestUnauthorizedError} if authorization fails * @throws {StandardNetworkError} */ getMediaUploadForm: (request: { auth: BackupAuth; uploadSize: number; rng?: Rng; }, options?: RequestOptions) => Promise; /** * @deprecated requires every connection to support H2 */ setBackupPublicKey: (request: { auth: BackupAuth; rng?: Rng; }, options?: RequestOptions) => Promise; /** * @deprecated requires every connection to support H2 */ getBackupCdnCredentials: (request: { auth: BackupAuth; cdn: number; rng?: Rng; }, options?: RequestOptions) => Promise; /** * @deprecated requires every connection to support H2 */ getBackupSvrBCredentials: (request: { auth: BackupAuth; rng?: Rng; }, options?: RequestOptions) => Promise<{ username: string; password: string; }>; /** * @deprecated requires every connection to support H2 */ refreshBackup: (request: { auth: BackupAuth; rng?: Rng; }, options?: RequestOptions) => Promise; /** * @deprecated requires every connection to support H2 */ backupDeleteAll: (request: { auth: BackupAuth; rng?: Rng; }, options?: RequestOptions) => Promise; }