UNPKG

2.39 kBTypeScriptView Raw
1import { AuthStandardAttributeKey, AuthVerifiableAttributeKey } from '@aws-amplify/core/internals/utils';
2import { AWSAuthUser, AuthCodeDeliveryDetails, AuthDevice, AuthUserAttribute } from '../../../types';
3import { AuthProvider } from '../../../types/inputs';
4import { SignUpOutput } from './outputs';
5/**
6 * Cognito supported AuthFlowTypes that may be passed as part of the Sign In request.
7 */
8export type AuthFlowType = 'USER_SRP_AUTH' | 'CUSTOM_WITH_SRP' | 'CUSTOM_WITHOUT_SRP' | 'USER_PASSWORD_AUTH';
9export declare const cognitoHostedUIIdentityProviderMap: Record<AuthProvider, string>;
10/**
11 * Arbitrary key/value pairs that may be passed as part of certain Cognito requests
12 */
13export type ClientMetadata = Record<string, string>;
14/**
15 * The user attribute types available for Cognito.
16 */
17export type UserAttributeKey = AuthStandardAttributeKey | CustomAttribute;
18/**
19 * Verifiable user attribute types available for Cognito.
20 */
21export type VerifiableUserAttributeKey = AuthVerifiableAttributeKey;
22/**
23 * Cognito custom attribute type
24 */
25export type CustomAttribute = string & NonNullable<unknown>;
26/**
27 * One or more name-value pairs containing the validation data in the request to register a user.
28 */
29export type ValidationData = Record<string, string>;
30/**
31 * Cognito supported MFAPreference values that may be passed as part of the UpdateMFAPreferenceRequest.
32 */
33export type MFAPreference = 'ENABLED' | 'DISABLED' | 'PREFERRED' | 'NOT_PREFERRED';
34export type AutoSignInEventData = {
35 event: 'confirmSignUp';
36 data: SignUpOutput;
37} | {
38 event: 'autoSignIn';
39};
40/**
41 * Holds the device specific information along with it's id and name.
42 */
43export type AWSAuthDevice = AuthDevice & {
44 attributes: AuthUserAttribute<UserAttributeKey>;
45 createDate?: Date;
46 lastAuthenticatedDate?: Date;
47 lastModifiedDate?: Date;
48};
49/**
50 * Holds the sign in details of the user.
51 */
52export interface CognitoAuthSignInDetails {
53 loginId?: string;
54 authFlowType?: AuthFlowType;
55}
56/**
57 * Holds the user information along with the sign in details.
58 */
59export interface AuthUser extends AWSAuthUser {
60 signInDetails?: CognitoAuthSignInDetails;
61}
62/**
63 * Holds data describing the dispatch of a confirmation code.
64 */
65export type CodeDeliveryDetails<CognitoUserAttributeKey extends UserAttributeKey = UserAttributeKey> = AuthCodeDeliveryDetails<CognitoUserAttributeKey>;