UNPKG

@aws-amplify/auth

Version:

Auth category of aws-amplify

31 lines (30 loc) • 1.79 kB
import { AuthConfig, KeyValueStorageInterface } from '@aws-amplify/core'; import { AuthKeys, AuthTokenStore, CognitoAuthTokens, DeviceMetadata, OAuthMetadata } from './types'; export declare class DefaultTokenStore implements AuthTokenStore { private authConfig?; keyValueStorage?: KeyValueStorageInterface; private stopNotify?; getKeyValueStorage(): KeyValueStorageInterface; setKeyValueStorage(keyValueStorage: KeyValueStorageInterface): void; setAuthConfig(authConfig: AuthConfig): void; setupNotify(): void; /** * Detaches the cross-tab storage listener registered by {@link setupNotify} * and clears the retained unsubscribe handle, allowing a subsequent * `setupNotify()` to re-register (e.g. after a storage swap, in tests, or * during HMR). No-op when notify was never set up. */ teardownNotify(): void; loadTokens(): Promise<CognitoAuthTokens | null>; storeTokens(tokens: CognitoAuthTokens): Promise<void>; clearTokens(): Promise<void>; getDeviceMetadata(username?: string): Promise<DeviceMetadata | null>; clearDeviceMetadata(username?: string): Promise<void>; private getAuthKeys; private getLastAuthUserKey; getLastAuthUser(): Promise<string>; setOAuthMetadata(metadata: OAuthMetadata): Promise<void>; getOAuthMetadata(): Promise<OAuthMetadata | null>; } export declare const createKeysForAuthStorage: (provider: string, identifier: string) => AuthKeys<"accessToken" | "idToken" | "oidcProvider" | "clockDrift" | "refreshToken" | "deviceKey" | "randomPasswordKey" | "deviceGroupKey" | "signInDetails" | "oauthMetadata">; export declare function getAuthStorageKeys<T extends Record<string, string>>(authKeys: T): (prefix: string, identifier: string) => AuthKeys<keyof T & string>;