1 | import { ICookieStorageData, ICognitoStorage } from 'amazon-cognito-identity-js';
|
2 |
|
3 |
|
4 |
|
5 | export interface SignUpParams {
|
6 | username: string;
|
7 | password: string;
|
8 | attributes?: object;
|
9 | validationData?: {
|
10 | [key: string]: any;
|
11 | };
|
12 | clientMetadata?: {
|
13 | [key: string]: string;
|
14 | };
|
15 | autoSignIn?: AutoSignInOptions;
|
16 | }
|
17 | export interface AuthCache {
|
18 | setItem(): any;
|
19 | getItem(): any;
|
20 | removeItem(): any;
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 | export interface AuthOptions {
|
26 | userPoolId?: string;
|
27 | userPoolWebClientId?: string;
|
28 | identityPoolId?: string;
|
29 | region?: string;
|
30 | mandatorySignIn?: boolean;
|
31 | cookieStorage?: ICookieStorageData;
|
32 | oauth?: OAuthOpts;
|
33 | refreshHandlers?: object;
|
34 | storage?: ICognitoStorage;
|
35 | authenticationFlowType?: string;
|
36 | identityPoolRegion?: string;
|
37 | clientMetadata?: any;
|
38 | endpoint?: string;
|
39 | signUpVerificationMethod?: 'code' | 'link';
|
40 | }
|
41 | export declare enum CognitoHostedUIIdentityProvider {
|
42 | Cognito = "COGNITO",
|
43 | Google = "Google",
|
44 | Facebook = "Facebook",
|
45 | Amazon = "LoginWithAmazon",
|
46 | Apple = "SignInWithApple"
|
47 | }
|
48 | export declare type LegacyProvider = 'google' | 'facebook' | 'amazon' | 'developer' | string;
|
49 | export declare type FederatedSignInOptions = {
|
50 | provider: CognitoHostedUIIdentityProvider;
|
51 | customState?: string;
|
52 | };
|
53 | export declare type FederatedSignInOptionsCustom = {
|
54 | customProvider: string;
|
55 | customState?: string;
|
56 | };
|
57 | export declare function isFederatedSignInOptions(obj: any): obj is FederatedSignInOptions;
|
58 | export declare function isFederatedSignInOptionsCustom(obj: any): obj is FederatedSignInOptionsCustom;
|
59 | export declare function hasCustomState(obj: any): boolean;
|
60 |
|
61 |
|
62 |
|
63 | export interface MfaRequiredDetails {
|
64 | challengeName: any;
|
65 | challengeParameters: any;
|
66 | }
|
67 |
|
68 |
|
69 |
|
70 | export interface FederatedResponse {
|
71 | token: string;
|
72 | identity_id?: string;
|
73 | expires_at: number;
|
74 | }
|
75 |
|
76 |
|
77 |
|
78 | export interface FederatedUser {
|
79 | name: string;
|
80 | email?: string;
|
81 | picture?: string;
|
82 | }
|
83 | export interface AwsCognitoOAuthOpts {
|
84 | domain: string;
|
85 | scope: Array<string>;
|
86 | redirectSignIn: string;
|
87 | redirectSignOut: string;
|
88 | responseType: string;
|
89 | options?: object;
|
90 | urlOpener?: (url: string, redirectUrl: string) => Promise<any>;
|
91 | }
|
92 | export declare function isCognitoHostedOpts(oauth: OAuthOpts): oauth is AwsCognitoOAuthOpts;
|
93 | export interface Auth0OAuthOpts {
|
94 | domain: string;
|
95 | clientID: string;
|
96 | scope: string;
|
97 | redirectUri: string;
|
98 | audience: string;
|
99 | responseType: string;
|
100 | returnTo: string;
|
101 | urlOpener?: (url: string, redirectUrl: string) => Promise<any>;
|
102 | }
|
103 | export declare type OAuthOpts = AwsCognitoOAuthOpts | Auth0OAuthOpts;
|
104 | export interface ConfirmSignUpOptions {
|
105 | forceAliasCreation?: boolean;
|
106 | clientMetadata?: ClientMetaData;
|
107 | }
|
108 | export interface SignOutOpts {
|
109 | global?: boolean;
|
110 | }
|
111 | export interface CurrentUserOpts {
|
112 | bypassCache: boolean;
|
113 | }
|
114 | export interface GetPreferredMFAOpts {
|
115 | bypassCache: boolean;
|
116 | }
|
117 | export declare type UsernamePasswordOpts = {
|
118 | username: string;
|
119 | password: string;
|
120 | validationData?: {
|
121 | [key: string]: any;
|
122 | };
|
123 | };
|
124 | export declare enum AuthErrorTypes {
|
125 | NoConfig = "noConfig",
|
126 | MissingAuthConfig = "missingAuthConfig",
|
127 | EmptyUsername = "emptyUsername",
|
128 | InvalidUsername = "invalidUsername",
|
129 | EmptyPassword = "emptyPassword",
|
130 | EmptyCode = "emptyCode",
|
131 | SignUpError = "signUpError",
|
132 | NoMFA = "noMFA",
|
133 | InvalidMFA = "invalidMFA",
|
134 | EmptyChallengeResponse = "emptyChallengeResponse",
|
135 | NoUserSession = "noUserSession",
|
136 | Default = "default",
|
137 | DeviceConfig = "deviceConfig",
|
138 | NetworkError = "networkError",
|
139 | AutoSignInError = "autoSignInError"
|
140 | }
|
141 | export declare type AuthErrorMessages = {
|
142 | [key in AuthErrorTypes]: AuthErrorMessage;
|
143 | };
|
144 | export interface AuthErrorMessage {
|
145 | message: string;
|
146 | log?: string;
|
147 | }
|
148 | export declare type SignInOpts = UsernamePasswordOpts;
|
149 | export declare type ClientMetaData = {
|
150 | [key: string]: string;
|
151 | } | undefined;
|
152 | export declare function isUsernamePasswordOpts(obj: any): obj is UsernamePasswordOpts;
|
153 | export interface IAuthDevice {
|
154 | id: string;
|
155 | name: string;
|
156 | }
|
157 | export interface AutoSignInOptions {
|
158 | enabled: boolean;
|
159 | clientMetaData?: ClientMetaData;
|
160 | validationData?: {
|
161 | [key: string]: any;
|
162 | };
|
163 | }
|
164 | export declare enum GRAPHQL_AUTH_MODE {
|
165 | API_KEY = "API_KEY",
|
166 | AWS_IAM = "AWS_IAM",
|
167 | OPENID_CONNECT = "OPENID_CONNECT",
|
168 | AMAZON_COGNITO_USER_POOLS = "AMAZON_COGNITO_USER_POOLS",
|
169 | AWS_LAMBDA = "AWS_LAMBDA"
|
170 | }
|