import { AbstractService, LegacyApiServiceInterface, InternalEventBusInterface, IntegrityApiInterface, ItemsServerInterface, ApiServiceEvent, KeyValueStoreInterface, ApiServiceEventData } from '@standardnotes/services'; import { DownloadFileParams, FileOwnershipType, FilesApiInterface } from '@standardnotes/files'; import { ServerSyncPushContextualPayload, SNFeatureRepo } from '@standardnotes/models'; import { User, HttpStatusCode, KeyParamsResponse, SignInResponse, SignOutResponse, ChangeCredentialsResponse, RawSyncResponse, SessionRenewalResponse, SessionListResponse, ListSettingsResponse, UpdateSettingResponse, GetSettingResponse, DeleteSettingResponse, ListedRegistrationResponse, StartUploadSessionResponse, IntegrityPayload, CheckIntegrityResponse, GetSingleItemResponse, HttpResponse, HttpResponseMeta, ErrorTag, HttpRequest, ClientDisplayableError, HttpErrorResponse, ValetTokenOperation, MetaEndpointResponse } from '@standardnotes/responses'; import { LegacySession, MapperInterface, Session } from '@standardnotes/domain-core'; import { HttpServiceInterface } from '@standardnotes/api'; import { SNRootKeyParams } from '@standardnotes/encryption'; import { PureCryptoInterface } from '@standardnotes/sncrypto-common'; import { DiskStorageService } from '../Storage/DiskStorageService'; import { UuidString } from '../../Types/UuidString'; import { SettingsServerInterface, MfaSecretResponse } from '../Settings/SettingsServerInterface'; import { AnyFeatureDescription } from '@standardnotes/features'; type InvalidSessionObserver = (revoked: boolean) => void; export declare class LegacyApiService extends AbstractService implements LegacyApiServiceInterface, FilesApiInterface, IntegrityApiInterface, ItemsServerInterface, SettingsServerInterface { private httpService; private storageService; private host; private inMemoryStore; private crypto; private sessionStorageMapper; private legacySessionStorageMapper; protected internalEventBus: InternalEventBusInterface; private session; user?: User; private authenticating; private changing; private refreshingSession; private invalidSessionObserver?; private filesHost?; constructor(httpService: HttpServiceInterface, storageService: DiskStorageService, host: string, inMemoryStore: KeyValueStoreInterface, crypto: PureCryptoInterface, sessionStorageMapper: MapperInterface>, legacySessionStorageMapper: MapperInterface>, internalEventBus: InternalEventBusInterface); deinit(): void; setUser(user?: User): void; /** * When a we receive a 401 error from the server, we'll notify the observer. * Note that this applies only to sessions that are totally invalid. Sessions that * are expired but can be renewed are still considered to be valid. In those cases, * the server response is 498. * If the session has been revoked, then the observer will have its first * argument set to true. */ setInvalidSessionObserver(observer: InvalidSessionObserver): void; loadHost(): string; setHost(host: string): Promise; getHost(): string; getFilesHost(): string; setSession(session: Session | LegacySession, persist?: boolean): void; getSession(): Session | LegacySession | null; get apiVersion(): string; private params; createErrorResponse(message: string, status?: HttpStatusCode, tag?: ErrorTag): HttpErrorResponse; private errorResponseWithFallbackMessage; processMetaObject(meta: HttpResponseMeta): void; private processSuccessResponseForMetaBody; private request; /** * @param mfaCode The mfa challenge response value. */ getAccountKeyParams(dto: { email: string; mfaCode?: string; authenticatorResponse?: Record; }): Promise>; signIn(dto: { email: string; serverPassword: string; ephemeral: boolean; hvmToken?: string; }): Promise>; signOut(): Promise>; changeCredentials(parameters: { userUuid: UuidString; currentServerPassword: string; newServerPassword: string; newKeyParams: SNRootKeyParams; newEmail?: string; }): Promise>; sync(payloads: ServerSyncPushContextualPayload[], lastSyncToken: string | undefined, paginationToken: string | undefined, limit: number, sharedVaultUuids?: string[]): Promise>; getSyncHttpRequest(payloads: ServerSyncPushContextualPayload[], lastSyncToken: string | undefined, paginationToken: string | undefined, limit: number, sharedVaultUuids?: string[] | undefined): HttpRequest; /** * @deprecated * * This function should be replaced with @standardnotes/api's `HttpService::refreshSession` function. */ deprecatedRefreshSessionOnlyUsedInE2eTests(): Promise>; getSessionsList(): Promise>; deleteSession(sessionId: UuidString): Promise>; private tokenRefreshableRequest; listSettings(userUuid: UuidString): Promise>; updateSetting(userUuid: UuidString, settingName: string, settingValue: string | null, sensitive: boolean, totpToken?: string): Promise>; getSetting(userUuid: UuidString, settingName: string, serverPassword?: string): Promise>; getSubscriptionSetting(userUuid: UuidString, settingName: string): Promise>; updateSubscriptionSetting(userUuid: UuidString, settingName: string, settingValue: string | null, sensitive: boolean): Promise>; deleteSetting(userUuid: UuidString, settingName: string, serverPassword?: string): Promise>; getMfaSecret(userUuid: UuidString): Promise>; downloadFeatureUrl(url: string): Promise; getNewSubscriptionToken(): Promise; downloadOfflineFeaturesFromRepo(dto: { repo: SNFeatureRepo; }): Promise<{ features: AnyFeatureDescription[]; roles: string[]; } | ClientDisplayableError>; registerForListedAccount(): Promise>; createUserFileValetToken(remoteIdentifier: string, operation: ValetTokenOperation, unencryptedFileSize?: number): Promise; startUploadSession(valetToken: string, ownershipType: FileOwnershipType): Promise>; deleteFile(valetToken: string, ownershipType: FileOwnershipType): Promise>; uploadFileBytes(valetToken: string, ownershipType: FileOwnershipType, chunkId: number, encryptedBytes: Uint8Array): Promise; closeUploadSession(valetToken: string, ownershipType: FileOwnershipType): Promise; moveFile(valetToken: string): Promise; getFilesDownloadUrl(ownershipType: FileOwnershipType): string; downloadFile({ file, chunkIndex, valetToken, ownershipType, contentRangeStart, onBytesReceived, }: DownloadFileParams): Promise; checkIntegrity(integrityPayloads: IntegrityPayload[]): Promise>; getSingleItem(itemUuid: string): Promise>; private preprocessingError; private preprocessAuthenticatedErrorResponse; private getSessionAccessToken; getCaptchaUrl(): Promise>; } export {};