import { LegacyApiService } from './../Services/Api/ApiService'; import { UserRegistrationResponseBody } from '@standardnotes/api'; import { ApplicationIdentifier, ProtocolVersion, KeyParamsOrigination } from '@standardnotes/common'; import { DeinitCallback, StorageValueModes, ChallengeObserver, ImportDataResult, HomeServerServiceInterface, DeviceInterface, SubscriptionManagerInterface, FeaturesClientInterface, ItemManagerInterface, SyncServiceInterface, UserServiceInterface, MutatorClientInterface, StatusServiceInterface, AlertService, StorageServiceInterface, ChallengeServiceInterface, AsymmetricMessageServiceInterface, VaultServiceInterface, ContactServiceInterface, SharedVaultServiceInterface, PreferenceServiceInterface, InternalEventBusInterface, ApplicationEvent, ApplicationEventCallback, ComponentManagerInterface, ChallengeValue, ChallengeReason, DeinitMode, DeinitSource, AppGroupManagedApplication, ApplicationInterface, Challenge, SessionsClientInterface, ProtectionsClientInterface, CredentialsChangeFunctionResponse, PayloadManagerInterface, HistoryServiceInterface, EncryptionProviderInterface, VaultUserServiceInterface, VaultInviteServiceInterface, VaultLockServiceInterface, ApplicationConstructorOptions, FullyResolvedApplicationOptions, ChangeAndSaveItem, GetHost, SetHost, MfaServiceInterface, GenerateUuid, CreateDecryptedBackupFile, CreateEncryptedBackupFile } from '@standardnotes/services'; import { SNNote, PrefKey, PrefValue, BackupFile, EncryptedItemInterface, Environment, Platform } from '@standardnotes/models'; import { HttpResponse, SessionListResponse, SignInResponse, ClientDisplayableError, SessionListEntry, MetaEndpointResponse } from '@standardnotes/responses'; import { SettingsService, ActionsService, ListedClientInterface } from '../Services'; import { UuidString } from '../Types'; import { BackupServiceInterface, FilesClientInterface } from '@standardnotes/files'; import { SignInWithRecoveryCodes } from '../Domain/UseCase/SignInWithRecoveryCodes/SignInWithRecoveryCodes'; import { UseCaseContainerInterface } from '../Domain/UseCase/UseCaseContainerInterface'; import { GetRecoveryCodes } from '../Domain/UseCase/GetRecoveryCodes/GetRecoveryCodes'; import { AddAuthenticator } from '../Domain/UseCase/AddAuthenticator/AddAuthenticator'; import { ListAuthenticators } from '../Domain/UseCase/ListAuthenticators/ListAuthenticators'; import { DeleteAuthenticator } from '../Domain/UseCase/DeleteAuthenticator/DeleteAuthenticator'; import { ListRevisions } from '../Domain/UseCase/ListRevisions/ListRevisions'; import { GetRevision } from '../Domain/UseCase/GetRevision/GetRevision'; import { DeleteRevision } from '../Domain/UseCase/DeleteRevision/DeleteRevision'; import { GetAuthenticatorAuthenticationResponse } from '../Domain/UseCase/GetAuthenticatorAuthenticationResponse/GetAuthenticatorAuthenticationResponse'; import { GetAuthenticatorAuthenticationOptions } from '../Domain/UseCase/GetAuthenticatorAuthenticationOptions/GetAuthenticatorAuthenticationOptions'; import { Result } from '@standardnotes/domain-core'; type LaunchCallback = { receiveChallenge: (challenge: Challenge) => void; }; export declare class SNApplication implements ApplicationInterface, AppGroupManagedApplication, UseCaseContainerInterface { onDeinit: DeinitCallback; /** * A runtime based identifier for each dynamic instantiation of the application instance. * This differs from the persistent application.identifier which persists in storage * across instantiations. */ readonly ephemeralIdentifier: string; private eventHandlers; private serviceObservers; private managedSubscribers; /** True if the result of deviceInterface.openDatabase yields a new database being created */ private createdNewDatabase; /** True if the application has started (but not necessarily launched) */ private started; /** True if the application has launched */ private launched; /** Whether the application has been destroyed via .deinit() */ dealloced: boolean; private revokingSession; private handledFullSyncStage; readonly environment: Environment; readonly platform: Platform; readonly identifier: ApplicationIdentifier; readonly options: FullyResolvedApplicationOptions; private dependencies; constructor(options: ApplicationConstructorOptions); private registerServiceObservers; computePrivateUsername(username: string): Promise; /** * The first thing consumers should call when starting their app. * This function will load all services in their correct order. */ prepareForLaunch(callback: LaunchCallback): Promise; private setLaunchCallback; /** * Handles device authentication, unlocks application, and * issues a callback if a device activation requires user input * (i.e local passcode or fingerprint). * @param awaitDatabaseLoad * Option to await database load before marking the app as ready. */ launch(awaitDatabaseLoad?: boolean): Promise; onStart(): void; onLaunch(): void; getLaunchChallenge(): Challenge | undefined; private handleLaunchChallengeResponse; private handleStage; /** * @param singleEvent Whether to only listen for a particular event. */ addEventObserver(callback: ApplicationEventCallback, singleEvent?: ApplicationEvent): () => void; addSingleEventObserver(event: ApplicationEvent, callback: ApplicationEventCallback): () => void; private notifyEvent; getSessions(): Promise>; revokeSession(sessionId: UuidString): Promise | undefined>; /** * Revokes all sessions except the current one. */ revokeAllOtherSessions(): Promise; userCanManageSessions(): boolean; setCustomHost(host: string, websocketUrl?: string): Promise; getUserPasswordCreationDate(): Date | undefined; getProtocolEncryptionDisplayName(): Promise; getUserVersion(): ProtocolVersion | undefined; /** * Returns true if there is an upgrade available for the account or passcode */ protocolUpgradeAvailable(): Promise; /** * Returns true if there is an encryption source available */ isEncryptionAvailable(): boolean; upgradeProtocolVersion(): Promise<{ success?: true; canceled?: true; error?: { message: string; }; }>; hasAccount(): boolean; /** * @returns true if the user has a source of protection available, such as a * passcode, password, or biometrics. */ hasProtectionSources(): boolean; /** * When a user specifies a non-zero remember duration on a protection * challenge, a session will be started during which protections are disabled. */ getProtectionSessionExpiryDate(): Date; clearProtectionSession(): Promise; authorizeProtectedActionForNotes(notes: SNNote[], challengeReason: ChallengeReason): Promise; /** * @returns whether note access has been granted or not */ authorizeNoteAccess(note: SNNote): Promise; authorizeAutolockIntervalChange(): Promise; isEphemeralSession(): boolean; setValue(key: string, value: unknown, mode?: StorageValueModes): void; getValue(key: string, mode?: StorageValueModes): T; removeValue(key: string, mode?: StorageValueModes): Promise; getPreference(key: K): PrefValue[K] | undefined; getPreference(key: K, defaultValue: PrefValue[K]): PrefValue[K]; setPreference(key: K, value: PrefValue[K]): Promise; /** * Gives services a chance to complete any sensitive operations before yielding * @param maxWait The maximum number of milliseconds to wait for services * to finish tasks. 0 means no limit. */ private prepareForDeinit; addChallengeObserver(challenge: Challenge, observer: ChallengeObserver): () => void; submitValuesForChallenge(challenge: Challenge, values: ChallengeValue[]): Promise; cancelChallenge(challenge: Challenge): void; setOnDeinit(onDeinit: DeinitCallback): void; /** * Destroys the application instance. */ deinit(mode: DeinitMode, source: DeinitSource): void; /** * @param mergeLocal Whether to merge existing offline data into account. If false, * any pre-existing data will be fully deleted upon success. */ register(email: string, password: string, hvmToken: string, ephemeral?: boolean, mergeLocal?: boolean): Promise; /** * @param mergeLocal Whether to merge existing offline data into account. * If false, any pre-existing data will be fully deleted upon success. */ signIn(email: string, password: string, strict?: boolean, ephemeral?: boolean, mergeLocal?: boolean, awaitSync?: boolean, hvmToken?: string): Promise>; getCaptchaUrl(): Promise>; changeEmail(newEmail: string, currentPassword: string, passcode?: string, origination?: KeyParamsOrigination): Promise; changePassword(currentPassword: string, newPassword: string, passcode?: string, origination?: KeyParamsOrigination, validateNewPasswordStrength?: boolean): Promise; importData(data: BackupFile, awaitSync?: boolean): Promise>; private handleRevokedSession; validateAccountPassword(password: string): Promise; isStarted(): boolean; isLaunched(): boolean; hasPasscode(): boolean; lock(): Promise; isNativeMobileWeb(): boolean; getDeinitMode(): DeinitMode; addPasscode(passcode: string): Promise; /** * @returns whether the passcode was successfuly removed */ removePasscode(): Promise; changePasscode(newPasscode: string, origination?: KeyParamsOrigination): Promise; enableEphemeralPersistencePolicy(): Promise; hasPendingMigrations(): Promise; presentKeyRecoveryWizard(): void; canAttemptDecryptionOfItem(item: EncryptedItemInterface): ClientDisplayableError | true; isUsingHomeServer(): Promise; get device(): DeviceInterface; get subscriptions(): SubscriptionManagerInterface; get signInWithRecoveryCodes(): SignInWithRecoveryCodes; get getRecoveryCodes(): GetRecoveryCodes; get addAuthenticator(): AddAuthenticator; fetchAuthenticatorRegistrationOptions(): Promise | null>; get listAuthenticators(): ListAuthenticators; get deleteAuthenticator(): DeleteAuthenticator; get getAuthenticatorAuthenticationOptions(): GetAuthenticatorAuthenticationOptions; get getAuthenticatorAuthenticationResponse(): GetAuthenticatorAuthenticationResponse; get listRevisions(): ListRevisions; get getRevision(): GetRevision; get deleteRevision(): DeleteRevision; get files(): FilesClientInterface; get features(): FeaturesClientInterface; get items(): ItemManagerInterface; get payloads(): PayloadManagerInterface; get protections(): ProtectionsClientInterface; get sync(): SyncServiceInterface; get user(): UserServiceInterface; get settings(): SettingsService; get mutator(): MutatorClientInterface; get sessions(): SessionsClientInterface; get status(): StatusServiceInterface; get fileBackups(): BackupServiceInterface | undefined; get componentManager(): ComponentManagerInterface; get listed(): ListedClientInterface; get alerts(): AlertService; get storage(): StorageServiceInterface; get actions(): ActionsService; get challenges(): ChallengeServiceInterface; get asymmetric(): AsymmetricMessageServiceInterface; get homeServer(): HomeServerServiceInterface | undefined; get preferences(): PreferenceServiceInterface; get history(): HistoryServiceInterface; get encryption(): EncryptionProviderInterface; get events(): InternalEventBusInterface; get vaults(): VaultServiceInterface; get vaultLocks(): VaultLockServiceInterface; get vaultUsers(): VaultUserServiceInterface; get vaultInvites(): VaultInviteServiceInterface; get contacts(): ContactServiceInterface; get sharedVaults(): SharedVaultServiceInterface; get changeAndSaveItem(): ChangeAndSaveItem; get getHost(): GetHost; get setHost(): SetHost; get legacyApi(): LegacyApiService; get mfa(): MfaServiceInterface; get generateUuid(): GenerateUuid; get createDecryptedBackupFile(): CreateDecryptedBackupFile; get createEncryptedBackupFile(): CreateEncryptedBackupFile; private get migrations(); private get http(); private get sockets(); } export {};