feat: add sending user requests to process (#1908)

* feat: add sending user requests to process

* fix(snjs): yarn lock

* fix(snjs): imports

* fix: specs
This commit is contained in:
Karol Sójko
2022-11-02 11:33:02 +01:00
committed by GitHub
parent f687334d7d
commit b2faa815e9
81 changed files with 766 additions and 325 deletions

View File

@@ -0,0 +1,9 @@
import { AnyKeyParamsContent } from '@standardnotes/common'
import { RootKeyInterface } from '@standardnotes/models'
import { HttpResponse } from '@standardnotes/responses'
export type SessionManagerResponse = {
response: HttpResponse
rootKey?: RootKeyInterface
keyParams?: AnyKeyParamsContent
}

View File

@@ -0,0 +1,34 @@
import { UserRegistrationResponseBody } from '@standardnotes/api'
import { ProtocolVersion } from '@standardnotes/common'
import { RootKeyInterface } from '@standardnotes/models'
import { ClientDisplayableError, HttpResponse, SignInResponse, User } from '@standardnotes/responses'
import { Base64String } from '@standardnotes/sncrypto-common'
import { SessionManagerResponse } from './SessionManagerResponse'
export interface SessionsClientInterface {
createDemoShareToken(): Promise<Base64String | ClientDisplayableError>
populateSessionFromDemoShareToken(token: Base64String): Promise<void>
getUser(): User | undefined
register(email: string, password: string, ephemeral: boolean): Promise<UserRegistrationResponseBody>
signIn(
email: string,
password: string,
strict: boolean,
ephemeral: boolean,
minAllowedVersion?: ProtocolVersion,
): Promise<SessionManagerResponse>
getSureUser(): User
bypassChecksAndSignInWithRootKey(
email: string,
rootKey: RootKeyInterface,
ephemeral: boolean,
): Promise<SignInResponse | HttpResponse>
signOut(): Promise<void>
changeCredentials(parameters: {
currentServerPassword: string
newRootKey: RootKeyInterface
wrappingKey?: RootKeyInterface
newEmail?: string
}): Promise<SessionManagerResponse>
}