import { AssetOptions, AssetResponse } from '@wireapp/api-client/lib/asset'; import { ProgressCallback, RequestCancelable } from '@wireapp/api-client/lib/http'; import { APIClient } from '@wireapp/api-client'; import { EncryptedAsset, EncryptedAssetUploaded } from '../../cryptography'; export { ProgressCallback }; export type AssetUrlData = { assetKey: string; assetDomain: string; forceCaching?: boolean; assetToken?: string; }; export declare class AssetService { private readonly apiClient; constructor(apiClient: APIClient); /** * Will download an asset on the server. * Will route the request to the right endpoint depending on the asset version * * @param assetData The versioned asset data * @param progressCallback? * @return Resolves when the asset has been uploaded */ downloadRawAsset(assetData: AssetUrlData, progressCallback?: ProgressCallback): RequestCancelable; /** * Uploads a raw asset to the backend without encrypting it * * @param plainText The raw content of the asset to upload * @param options? * @param progressCallback? * @return cancellable request that resolves with the uploaded image */ uploadRawAsset(asset: Buffer | Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): RequestCancelable<{ key: string; domain: string; token?: string | undefined; expires?: string | undefined; }>; /** * Will encrypt and upload an asset to the backend * * @param plainText The raw content of the asset to upload * @param options? * @param progressCallback? * @return cancellable request that resolves with the uploaded image and decryption keys */ uploadAsset(plainText: Buffer | Uint8Array, options?: AssetOptions, progressCallback?: ProgressCallback): Promise>; decryptAsset(asset: EncryptedAsset): Promise; /** * Will download and decrypt an asset stored on the server * @param assetData - the data of the asset to download * @param otrKey the encryption key used to encrypt the asset * @param sha256 the sha256 hash of the asset * @param progressCallback a progress callback to inform about the download progress */ downloadAsset(assetData: AssetUrlData, otrKey: Uint8Array, sha256: Uint8Array, progressCallback?: ProgressCallback): { response: Promise; cancel: () => void; }; } //# sourceMappingURL=AssetService.d.ts.map