@8base/utils
Advanced tools
Comparing version 0.8.1 to 0.8.2
{ | ||
"name": "@8base/utils", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"main": "lib/utils.js", | ||
@@ -22,3 +22,3 @@ "scripts": { | ||
"devDependencies": { | ||
"@8base/webpack-configuration": "^0.8.1", | ||
"@8base/webpack-configuration": "^0.8.2", | ||
"babel-cli": "^6.26.0", | ||
@@ -25,0 +25,0 @@ "babel-core": "^6.26.3", |
@@ -63,1 +63,44 @@ // @flow | ||
export type PossibleAuthItems = 'email' | 'userId' | 'workspaceId' | 'refreshToken' | 'token'; | ||
export type AuthState = { | ||
[PossibleAuthItems]: string, | ||
}; | ||
export type AuthData = { | ||
state: Object, | ||
isEmailVerified: boolean, | ||
idToken: string, | ||
email: string, | ||
idTokenPayload: Object, | ||
}; | ||
export interface AuthClient { | ||
getAuthState(): AuthState, | ||
setAuthState(state: AuthState): void, | ||
purgeAuthState(): void, | ||
checkIsAuthorized(): boolean, | ||
} | ||
export interface Authorizable { | ||
authorize(options?: Object): void, | ||
logout(options?: Object): void, | ||
checkSession(options?: Object): Promise<AuthData>, | ||
getAuthorizedData(): Promise<AuthData>, | ||
changePassword(): Promise<{ email: string }>, | ||
} | ||
export interface AsyncAuthClient { | ||
getAuthState(): Promise<AuthState>, | ||
setAuthState(state: AuthState): Promise<void>, | ||
purgeAuthState(): Promise<void>, | ||
checkIsAuthorized(): Promise<boolean>, | ||
} | ||
export interface AsyncAuthorizable { | ||
authorize(options?: Object): Promise<AuthData>, | ||
logout(options?: Object): Promise<void>, | ||
renewToken(options?: Object): Promise<AuthData>, | ||
changePassword(): Promise<{ email: string }>, | ||
} | ||
305213
870