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