import { AlertService, AbstractService, InternalEventBusInterface, EncryptionService, SessionsClientInterface, SessionManagerResponse, InternalEventHandlerInterface, InternalEventInterface, SessionEvent, GetKeyPairs, IsApplicationUsingThirdPartyHost, WebSocketsService } from '@standardnotes/services'; import { Base64String, PureCryptoInterface } from '@standardnotes/sncrypto-common'; import { SessionBody, HttpResponse, SessionListEntry, User, SignInResponse, SessionListResponse } from '@standardnotes/responses'; import { RootKeyWithKeyPairsInterface } from '@standardnotes/models'; import { LegacySession, MapperInterface, Session } from '@standardnotes/domain-core'; import { SNRootKey } from '@standardnotes/encryption'; import * as Common from '@standardnotes/common'; import { LegacyApiService } from '../Api/ApiService'; import { DiskStorageService } from '../Storage/DiskStorageService'; import { UuidString } from '../../Types/UuidString'; import { ChallengeService } from '../Challenge'; import { HttpServiceInterface, UserApiServiceInterface, UserRegistrationResponseBody } from '@standardnotes/api'; export declare const MINIMUM_PASSWORD_LENGTH = 8; export declare const MissingAccountParams = "missing-params"; /** * The session manager is responsible for loading initial user state, and any relevant * server credentials, such as the session token. It also exposes methods for registering * for a new account, signing into an existing one, or changing an account password. */ export declare class SessionManager extends AbstractService implements SessionsClientInterface, InternalEventHandlerInterface { private storage; private apiService; private userApiService; private alertService; private encryptionService; private crypto; private challengeService; private webSocketsService; private httpService; private sessionStorageMapper; private legacySessionStorageMapper; private workspaceIdentifier; private _getKeyPairs; private isApplicationUsingThirdPartyHostUseCase; protected internalEventBus: InternalEventBusInterface; private user?; private isSessionRenewChallengePresented; private session?; constructor(storage: DiskStorageService, apiService: LegacyApiService, userApiService: UserApiServiceInterface, alertService: AlertService, encryptionService: EncryptionService, crypto: PureCryptoInterface, challengeService: ChallengeService, webSocketsService: WebSocketsService, httpService: HttpServiceInterface, sessionStorageMapper: MapperInterface>, legacySessionStorageMapper: MapperInterface>, workspaceIdentifier: string, _getKeyPairs: GetKeyPairs, isApplicationUsingThirdPartyHostUseCase: IsApplicationUsingThirdPartyHost, internalEventBus: InternalEventBusInterface); handleEvent(event: InternalEventInterface): Promise; deinit(): void; getWorkspaceDisplayIdentifier(): string; private memoizeUser; private initializeFromDisk; private setSession; online(): boolean; offline(): boolean; getUser(): User | undefined; getSureUser(): User; isUserMissingKeyPair(): boolean; getPublicKey(): string; getSigningPublicKey(): string; get userUuid(): string; isCurrentSessionReadOnly(): boolean | undefined; getSession(): Session | LegacySession | null; signOut(): Promise; /** Unlike EncryptionService.hasAccount, isSignedIn can only be read once the application is unlocked */ isSignedIn(): boolean; isSignedOut(): boolean; isSignedIntoFirstPartyServer(): boolean; reauthenticateInvalidSession(cancelable?: boolean, onResponse?: (response: HttpResponse) => void): Promise; private promptForU2FVerification; private promptForMfaValue; register(email: string, password: string, hvmToken: string, ephemeral: boolean): Promise; private retrieveKeyParams; signIn(email: string, password: string, strict?: boolean, ephemeral?: boolean, minAllowedVersion?: Common.ProtocolVersion, hvmToken?: string): Promise; private performSignIn; bypassChecksAndSignInWithRootKey(email: string, rootKey: SNRootKey, ephemeral?: boolean, hvmToken?: string): Promise>; changeCredentials(parameters: { currentServerPassword: string; newRootKey: RootKeyWithKeyPairsInterface; wrappingKey?: SNRootKey; newEmail?: string; }): Promise; getSessionsList(): Promise>; revokeSession(sessionId: UuidString): Promise>; revokeAllOtherSessions(): Promise; private processChangeCredentialsResponse; private decodeDemoShareToken; populateSessionFromDemoShareToken(token: Base64String): Promise; private populateSession; handleAuthentication(dto: { session: SessionBody; user: { uuid: string; email: string; }; rootKey: SNRootKey; wrappingKey?: SNRootKey; }): Promise; /** * @deprecated use handleAuthentication instead */ private handleSuccessAuthResponse; private createSession; refreshSessionIfExpiringSoon(): Promise; }