UNPKG

@aws-northstar/ui

Version:
41 lines (40 loc) 1.33 kB
/// <reference types="react" /> import { CognitoUserPool, CognitoUser, CognitoUserSession, CognitoUserAttribute, GetSessionOptions } from 'amazon-cognito-identity-js'; export interface CognitoAuthContextAPI { /** * AWS region. */ region?: string; /** * Cognito Identity Pool Id */ identityPoolId?: string; /** * Cognito User Pool Id */ userPoolId: string; /** * CognitoUserPool object */ userPool: CognitoUserPool | null; /** * SignOut event handler */ onSignOut: () => void; /** * Returns current authenticated CognitoUser. * The returned cognitoUser object does not include session. * Use getAuthenticatedUserSession to retrieve session tokens. */ getAuthenticatedUser: () => CognitoUser | null; /** * Returns current authenticated CognitoUser user session. */ getAuthenticatedUserSession: (options?: GetSessionOptions) => Promise<CognitoUserSession | undefined>; /** * Returns urrent authenticated CongitoUser user attributes. */ getAuthenticatedUserAttributes: () => Promise<CognitoUserAttribute[] | undefined>; } export declare const CognitoAuthContext: import("react").Context<CognitoAuthContextAPI>; export declare const useCognitoAuthContext: () => CognitoAuthContextAPI;