@cryptr/cryptr-spa-js
Version:
Cryptr SDK for Single Page Applications using passwordless authentication and/or SSO
37 lines (36 loc) • 1.75 kB
TypeScript
import * as Interface from './interfaces';
import { SsoSignOptsAttrs, TokenError } from './interfaces';
import { ResponsePromise } from 'ky';
declare class Client {
config: Interface.Config;
private memory;
private worker?;
constructor(config: Interface.Config);
getCurrentAccessToken(): string | undefined;
getCurrentIdToken(): string | undefined;
private currentAccessTokenPresent;
isAuthenticated(): Promise<boolean>;
finalScope(scope?: string): string;
buildUniversalAttrs(options?: SsoSignOptsAttrs): Promise<{
config: Interface.Config;
transaction: any;
}>;
signIn(options?: SsoSignOptsAttrs): Promise<void>;
signInWithDomain(organizationDomain: string, options?: SsoSignOptsAttrs): Promise<void>;
signInWithEmail(email: string, options?: SsoSignOptsAttrs): Promise<void>;
handleTokensErrors(errors: TokenError[]): boolean;
handleNewTokens(refreshStore: Interface.RefreshStore, tokens?: any): void;
handleRedirectCallback(redirectParams?: Interface.RedirectionParams): Promise<any>;
canRefresh(refreshStore: Interface.RefreshStore): boolean;
getRefreshStore(): Interface.RefreshStore;
handleRefreshTokens(): Promise<boolean>;
recurringRefreshToken(refreshTokenWrapper: Interface.RefreshStore): void;
getUser(): object | undefined;
getClaimsFromAccess(accessToken: string): object | null;
private hasAuthenticationParams;
canHandleAuthentication(searchParams?: string): boolean;
logOut(callback: any, location?: Location, targetUrl?: string, sloAfterRevoke?: boolean | undefined): Promise<boolean>;
private handleSloCode;
decoratedRequest(url: string, kyOptions?: Object): ResponsePromise;
}
export default Client;