@aws-amplify/auth 4.6.11-unstable.2 → 4.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/aws-amplify-auth.js +2 -1
- package/dist/aws-amplify-auth.js.map +1 -1
- package/dist/aws-amplify-auth.min.js.map +1 -1
- package/package.json +5 -5
- package/lib/Auth.d.ts +0 -301
- package/lib/Errors.d.ts +0 -9
- package/lib/OAuth/OAuth.d.ts +0 -29
- package/lib/OAuth/oauthStorage.d.ts +0 -5
- package/lib/OAuth/oauthStorage.native.d.ts +0 -5
- package/lib/OAuth/urlOpener.d.ts +0 -1
- package/lib/OAuth/urlOpener.native.d.ts +0 -1
- package/lib/common/AuthErrorStrings.d.ts +0 -17
- package/lib/index.d.ts +0 -9
- package/lib/types/Auth.d.ts +0 -170
- package/lib/types/index.d.ts +0 -1
- package/lib/urlListener.d.ts +0 -2
- package/lib/urlListener.native.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/auth",
|
|
3
|
-
"version": "4.6.11
|
|
3
|
+
"version": "4.6.11",
|
|
4
4
|
"description": "Auth category of aws-amplify",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://aws-amplify.github.io/",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@aws-amplify/cache": "4.0.60
|
|
45
|
-
"@aws-amplify/core": "4.7.9
|
|
46
|
-
"amazon-cognito-identity-js": "5.2.12
|
|
44
|
+
"@aws-amplify/cache": "4.0.60",
|
|
45
|
+
"@aws-amplify/core": "4.7.9",
|
|
46
|
+
"amazon-cognito-identity-js": "5.2.12",
|
|
47
47
|
"crypto-js": "^4.1.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
],
|
|
96
96
|
"testSequencer": "./testSequencer.js"
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "be5bf2dc68c9c011c3876f003c14bc98b392c82d"
|
|
99
99
|
}
|
package/lib/Auth.d.ts
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import { AuthOptions, FederatedResponse, SignUpParams, FederatedUser, ConfirmSignUpOptions, SignOutOpts, CurrentUserOpts, GetPreferredMFAOpts, SignInOpts, FederatedSignInOptionsCustom, LegacyProvider, FederatedSignInOptions, ClientMetaData } from './types';
|
|
2
|
-
import { ICredentials } from '@aws-amplify/core';
|
|
3
|
-
import { ISignUpResult, CognitoUser, MFAOption, CognitoUserSession, CognitoUserAttribute, NodeCallback } from 'amazon-cognito-identity-js';
|
|
4
|
-
import { AuthError } from './Errors';
|
|
5
|
-
import { IAuthDevice } from './types/Auth';
|
|
6
|
-
/**
|
|
7
|
-
* Provide authentication steps
|
|
8
|
-
*/
|
|
9
|
-
export declare class AuthClass {
|
|
10
|
-
private _config;
|
|
11
|
-
private userPool;
|
|
12
|
-
private user;
|
|
13
|
-
private _oAuthHandler;
|
|
14
|
-
private _storage;
|
|
15
|
-
private _storageSync;
|
|
16
|
-
private oAuthFlowInProgress;
|
|
17
|
-
private pendingSignIn;
|
|
18
|
-
private autoSignInInitiated;
|
|
19
|
-
Credentials: import("@aws-amplify/core").CredentialsClass;
|
|
20
|
-
/**
|
|
21
|
-
* Initialize Auth with AWS configurations
|
|
22
|
-
* @param {Object} config - Configuration of the Auth
|
|
23
|
-
*/
|
|
24
|
-
constructor(config: AuthOptions);
|
|
25
|
-
getModuleName(): string;
|
|
26
|
-
configure(config?: any): AuthOptions;
|
|
27
|
-
wrapRefreshSessionCallback: (callback: NodeCallback<Error, any>) => NodeCallback<Error, any>;
|
|
28
|
-
/**
|
|
29
|
-
* Sign up with username, password and other attributes like phone, email
|
|
30
|
-
* @param {String | object} params - The user attributes used for signin
|
|
31
|
-
* @param {String[]} restOfAttrs - for the backward compatability
|
|
32
|
-
* @return - A promise resolves callback data if success
|
|
33
|
-
*/
|
|
34
|
-
signUp(params: string | SignUpParams, ...restOfAttrs: string[]): Promise<ISignUpResult>;
|
|
35
|
-
private handleAutoSignIn;
|
|
36
|
-
private handleCodeAutoSignIn;
|
|
37
|
-
private handleLinkAutoSignIn;
|
|
38
|
-
private signInAfterUserConfirmed;
|
|
39
|
-
/**
|
|
40
|
-
* Send the verification code to confirm sign up
|
|
41
|
-
* @param {String} username - The username to be confirmed
|
|
42
|
-
* @param {String} code - The verification code
|
|
43
|
-
* @param {ConfirmSignUpOptions} options - other options for confirm signup
|
|
44
|
-
* @return - A promise resolves callback data if success
|
|
45
|
-
*/
|
|
46
|
-
confirmSignUp(username: string, code: string, options?: ConfirmSignUpOptions): Promise<any>;
|
|
47
|
-
private isTrueStorageValue;
|
|
48
|
-
/**
|
|
49
|
-
* Resend the verification code
|
|
50
|
-
* @param {String} username - The username to be confirmed
|
|
51
|
-
* @param {ClientMetadata} clientMetadata - Metadata to be passed to Cognito Lambda triggers
|
|
52
|
-
* @return - A promise resolves code delivery details if successful
|
|
53
|
-
*/
|
|
54
|
-
resendSignUp(username: string, clientMetadata?: ClientMetaData): Promise<any>;
|
|
55
|
-
/**
|
|
56
|
-
* Sign in
|
|
57
|
-
* @param {String | SignInOpts} usernameOrSignInOpts - The username to be signed in or the sign in options
|
|
58
|
-
* @param {String} pw - The password of the username
|
|
59
|
-
* @param {ClientMetaData} clientMetadata - Client metadata for custom workflows
|
|
60
|
-
* @return - A promise resolves the CognitoUser
|
|
61
|
-
*/
|
|
62
|
-
signIn(usernameOrSignInOpts: string | SignInOpts, pw?: string, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>;
|
|
63
|
-
/**
|
|
64
|
-
* Return an object with the authentication callbacks
|
|
65
|
-
* @param {CognitoUser} user - the cognito user object
|
|
66
|
-
* @param {} resolve - function called when resolving the current step
|
|
67
|
-
* @param {} reject - function called when rejecting the current step
|
|
68
|
-
* @return - an object with the callback methods for user authentication
|
|
69
|
-
*/
|
|
70
|
-
private authCallbacks;
|
|
71
|
-
/**
|
|
72
|
-
* Sign in with a password
|
|
73
|
-
* @private
|
|
74
|
-
* @param {AuthenticationDetails} authDetails - the user sign in data
|
|
75
|
-
* @return - A promise resolves the CognitoUser object if success or mfa required
|
|
76
|
-
*/
|
|
77
|
-
private signInWithPassword;
|
|
78
|
-
/**
|
|
79
|
-
* Sign in without a password
|
|
80
|
-
* @private
|
|
81
|
-
* @param {AuthenticationDetails} authDetails - the user sign in data
|
|
82
|
-
* @return - A promise resolves the CognitoUser object if success or mfa required
|
|
83
|
-
*/
|
|
84
|
-
private signInWithoutPassword;
|
|
85
|
-
/**
|
|
86
|
-
* This was previously used by an authenticated user to get MFAOptions,
|
|
87
|
-
* but no longer returns a meaningful response. Refer to the documentation for
|
|
88
|
-
* how to setup and use MFA: https://docs.amplify.aws/lib/auth/mfa/q/platform/js
|
|
89
|
-
* @deprecated
|
|
90
|
-
* @param {CognitoUser} user - the current user
|
|
91
|
-
* @return - A promise resolves the current preferred mfa option if success
|
|
92
|
-
*/
|
|
93
|
-
getMFAOptions(user: CognitoUser | any): Promise<MFAOption[]>;
|
|
94
|
-
/**
|
|
95
|
-
* get preferred mfa method
|
|
96
|
-
* @param {CognitoUser} user - the current cognito user
|
|
97
|
-
* @param {GetPreferredMFAOpts} params - options for getting the current user preferred MFA
|
|
98
|
-
*/
|
|
99
|
-
getPreferredMFA(user: CognitoUser | any, params?: GetPreferredMFAOpts): Promise<string>;
|
|
100
|
-
private _getMfaTypeFromUserData;
|
|
101
|
-
private _getUserData;
|
|
102
|
-
/**
|
|
103
|
-
* set preferred MFA method
|
|
104
|
-
* @param {CognitoUser} user - the current Cognito user
|
|
105
|
-
* @param {string} mfaMethod - preferred mfa method
|
|
106
|
-
* @return - A promise resolve if success
|
|
107
|
-
*/
|
|
108
|
-
setPreferredMFA(user: CognitoUser | any, mfaMethod: 'TOTP' | 'SMS' | 'NOMFA' | 'SMS_MFA' | 'SOFTWARE_TOKEN_MFA'): Promise<string>;
|
|
109
|
-
/**
|
|
110
|
-
* disable SMS
|
|
111
|
-
* @deprecated
|
|
112
|
-
* @param {CognitoUser} user - the current user
|
|
113
|
-
* @return - A promise resolves is success
|
|
114
|
-
*/
|
|
115
|
-
disableSMS(user: CognitoUser): Promise<string>;
|
|
116
|
-
/**
|
|
117
|
-
* enable SMS
|
|
118
|
-
* @deprecated
|
|
119
|
-
* @param {CognitoUser} user - the current user
|
|
120
|
-
* @return - A promise resolves is success
|
|
121
|
-
*/
|
|
122
|
-
enableSMS(user: CognitoUser): Promise<string>;
|
|
123
|
-
/**
|
|
124
|
-
* Setup TOTP
|
|
125
|
-
* @param {CognitoUser} user - the current user
|
|
126
|
-
* @return - A promise resolves with the secret code if success
|
|
127
|
-
*/
|
|
128
|
-
setupTOTP(user: CognitoUser | any): Promise<string>;
|
|
129
|
-
/**
|
|
130
|
-
* verify TOTP setup
|
|
131
|
-
* @param {CognitoUser} user - the current user
|
|
132
|
-
* @param {string} challengeAnswer - challenge answer
|
|
133
|
-
* @return - A promise resolves is success
|
|
134
|
-
*/
|
|
135
|
-
verifyTotpToken(user: CognitoUser | any, challengeAnswer: string): Promise<CognitoUserSession>;
|
|
136
|
-
/**
|
|
137
|
-
* Send MFA code to confirm sign in
|
|
138
|
-
* @param {Object} user - The CognitoUser object
|
|
139
|
-
* @param {String} code - The confirmation code
|
|
140
|
-
*/
|
|
141
|
-
confirmSignIn(user: CognitoUser | any, code: string, mfaType?: 'SMS_MFA' | 'SOFTWARE_TOKEN_MFA' | null, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>;
|
|
142
|
-
completeNewPassword(user: CognitoUser | any, password: string, requiredAttributes?: any, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>;
|
|
143
|
-
/**
|
|
144
|
-
* Send the answer to a custom challenge
|
|
145
|
-
* @param {CognitoUser} user - The CognitoUser object
|
|
146
|
-
* @param {String} challengeResponses - The confirmation code
|
|
147
|
-
*/
|
|
148
|
-
sendCustomChallengeAnswer(user: CognitoUser | any, challengeResponses: string, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>;
|
|
149
|
-
/**
|
|
150
|
-
* Delete an authenticated users' attributes
|
|
151
|
-
* @param {CognitoUser} - The currently logged in user object
|
|
152
|
-
* @return {Promise}
|
|
153
|
-
**/
|
|
154
|
-
deleteUserAttributes(user: CognitoUser | any, attributeNames: string[]): Promise<unknown>;
|
|
155
|
-
/**
|
|
156
|
-
* Delete the current authenticated user
|
|
157
|
-
* @return {Promise}
|
|
158
|
-
**/
|
|
159
|
-
deleteUser(): Promise<string | void>;
|
|
160
|
-
/**
|
|
161
|
-
* Update an authenticated users' attributes
|
|
162
|
-
* @param {CognitoUser} - The currently logged in user object
|
|
163
|
-
* @return {Promise}
|
|
164
|
-
**/
|
|
165
|
-
updateUserAttributes(user: CognitoUser | any, attributes: object, clientMetadata?: ClientMetaData): Promise<string>;
|
|
166
|
-
/**
|
|
167
|
-
* Return user attributes
|
|
168
|
-
* @param {Object} user - The CognitoUser object
|
|
169
|
-
* @return - A promise resolves to user attributes if success
|
|
170
|
-
*/
|
|
171
|
-
userAttributes(user: CognitoUser | any): Promise<CognitoUserAttribute[]>;
|
|
172
|
-
verifiedContact(user: CognitoUser | any): Promise<{
|
|
173
|
-
verified: {};
|
|
174
|
-
unverified: {};
|
|
175
|
-
}>;
|
|
176
|
-
private isErrorWithMessage;
|
|
177
|
-
private isTokenRevokedError;
|
|
178
|
-
private isRefreshTokenRevokedError;
|
|
179
|
-
private isUserDisabledError;
|
|
180
|
-
private isUserDoesNotExistError;
|
|
181
|
-
private isRefreshTokenExpiredError;
|
|
182
|
-
private isSignedInHostedUI;
|
|
183
|
-
private isSessionInvalid;
|
|
184
|
-
private cleanUpInvalidSession;
|
|
185
|
-
/**
|
|
186
|
-
* Get current authenticated user
|
|
187
|
-
* @return - A promise resolves to current authenticated CognitoUser if success
|
|
188
|
-
*/
|
|
189
|
-
currentUserPoolUser(params?: CurrentUserOpts): Promise<CognitoUser | any>;
|
|
190
|
-
private isOAuthInProgress;
|
|
191
|
-
/**
|
|
192
|
-
* Get current authenticated user
|
|
193
|
-
* @param {CurrentUserOpts} - options for getting the current user
|
|
194
|
-
* @return - A promise resolves to current authenticated CognitoUser if success
|
|
195
|
-
*/
|
|
196
|
-
currentAuthenticatedUser(params?: CurrentUserOpts): Promise<CognitoUser | any>;
|
|
197
|
-
/**
|
|
198
|
-
* Get current user's session
|
|
199
|
-
* @return - A promise resolves to session object if success
|
|
200
|
-
*/
|
|
201
|
-
currentSession(): Promise<CognitoUserSession>;
|
|
202
|
-
/**
|
|
203
|
-
* Get the corresponding user session
|
|
204
|
-
* @param {Object} user - The CognitoUser object
|
|
205
|
-
* @return - A promise resolves to the session
|
|
206
|
-
*/
|
|
207
|
-
userSession(user: any): Promise<CognitoUserSession>;
|
|
208
|
-
/**
|
|
209
|
-
* Get authenticated credentials of current user.
|
|
210
|
-
* @return - A promise resolves to be current user's credentials
|
|
211
|
-
*/
|
|
212
|
-
currentUserCredentials(): Promise<ICredentials>;
|
|
213
|
-
currentCredentials(): Promise<ICredentials>;
|
|
214
|
-
/**
|
|
215
|
-
* Initiate an attribute confirmation request
|
|
216
|
-
* @param {Object} user - The CognitoUser
|
|
217
|
-
* @param {Object} attr - The attributes to be verified
|
|
218
|
-
* @return - A promise resolves to callback data if success
|
|
219
|
-
*/
|
|
220
|
-
verifyUserAttribute(user: CognitoUser | any, attr: string, clientMetadata?: ClientMetaData): Promise<void>;
|
|
221
|
-
/**
|
|
222
|
-
* Confirm an attribute using a confirmation code
|
|
223
|
-
* @param {Object} user - The CognitoUser
|
|
224
|
-
* @param {Object} attr - The attribute to be verified
|
|
225
|
-
* @param {String} code - The confirmation code
|
|
226
|
-
* @return - A promise resolves to callback data if success
|
|
227
|
-
*/
|
|
228
|
-
verifyUserAttributeSubmit(user: CognitoUser | any, attr: string, code: string): Promise<string>;
|
|
229
|
-
verifyCurrentUserAttribute(attr: string): Promise<void>;
|
|
230
|
-
/**
|
|
231
|
-
* Confirm current user's attribute using a confirmation code
|
|
232
|
-
* @param {Object} attr - The attribute to be verified
|
|
233
|
-
* @param {String} code - The confirmation code
|
|
234
|
-
* @return - A promise resolves to callback data if success
|
|
235
|
-
*/
|
|
236
|
-
verifyCurrentUserAttributeSubmit(attr: string, code: string): Promise<string>;
|
|
237
|
-
private cognitoIdentitySignOut;
|
|
238
|
-
private oAuthSignOutRedirect;
|
|
239
|
-
private oAuthSignOutAndResolve;
|
|
240
|
-
private oAuthSignOutRedirectOrReject;
|
|
241
|
-
/**
|
|
242
|
-
* Sign out method
|
|
243
|
-
* @
|
|
244
|
-
* @return - A promise resolved if success
|
|
245
|
-
*/
|
|
246
|
-
signOut(opts?: SignOutOpts): Promise<any>;
|
|
247
|
-
private cleanCachedItems;
|
|
248
|
-
/**
|
|
249
|
-
* Change a password for an authenticated user
|
|
250
|
-
* @param {Object} user - The CognitoUser object
|
|
251
|
-
* @param {String} oldPassword - the current password
|
|
252
|
-
* @param {String} newPassword - the requested new password
|
|
253
|
-
* @return - A promise resolves if success
|
|
254
|
-
*/
|
|
255
|
-
changePassword(user: CognitoUser | any, oldPassword: string, newPassword: string, clientMetadata?: ClientMetaData): Promise<'SUCCESS'>;
|
|
256
|
-
/**
|
|
257
|
-
* Initiate a forgot password request
|
|
258
|
-
* @param {String} username - the username to change password
|
|
259
|
-
* @return - A promise resolves if success
|
|
260
|
-
*/
|
|
261
|
-
forgotPassword(username: string, clientMetadata?: ClientMetaData): Promise<any>;
|
|
262
|
-
/**
|
|
263
|
-
* Confirm a new password using a confirmation Code
|
|
264
|
-
* @param {String} username - The username
|
|
265
|
-
* @param {String} code - The confirmation code
|
|
266
|
-
* @param {String} password - The new password
|
|
267
|
-
* @return - A promise that resolves if success
|
|
268
|
-
*/
|
|
269
|
-
forgotPasswordSubmit(username: string, code: string, password: string, clientMetadata?: ClientMetaData): Promise<string>;
|
|
270
|
-
/**
|
|
271
|
-
* Get user information
|
|
272
|
-
* @async
|
|
273
|
-
* @return {Object }- current User's information
|
|
274
|
-
*/
|
|
275
|
-
currentUserInfo(): Promise<any>;
|
|
276
|
-
federatedSignIn(options?: FederatedSignInOptions): Promise<ICredentials>;
|
|
277
|
-
federatedSignIn(provider: LegacyProvider, response: FederatedResponse, user: FederatedUser): Promise<ICredentials>;
|
|
278
|
-
federatedSignIn(options?: FederatedSignInOptionsCustom): Promise<ICredentials>;
|
|
279
|
-
/**
|
|
280
|
-
* Used to complete the OAuth flow with or without the Cognito Hosted UI
|
|
281
|
-
* @param {String} URL - optional parameter for customers to pass in the response URL
|
|
282
|
-
*/
|
|
283
|
-
private _handleAuthResponse;
|
|
284
|
-
/**
|
|
285
|
-
* Compact version of credentials
|
|
286
|
-
* @param {Object} credentials
|
|
287
|
-
* @return {Object} - Credentials
|
|
288
|
-
*/
|
|
289
|
-
essentialCredentials(credentials: any): ICredentials;
|
|
290
|
-
private attributesToObject;
|
|
291
|
-
private isTruthyString;
|
|
292
|
-
private createCognitoUser;
|
|
293
|
-
private _isValidAuthStorage;
|
|
294
|
-
private noUserPoolErrorHandler;
|
|
295
|
-
private rejectAuthError;
|
|
296
|
-
private rejectNoUserPool;
|
|
297
|
-
rememberDevice(): Promise<string | AuthError>;
|
|
298
|
-
forgetDevice(): Promise<void>;
|
|
299
|
-
fetchDevices(): Promise<IAuthDevice[]>;
|
|
300
|
-
}
|
|
301
|
-
export declare const Auth: AuthClass;
|
package/lib/Errors.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AuthErrorMessages, AuthErrorTypes } from './types';
|
|
2
|
-
export declare class AuthError extends Error {
|
|
3
|
-
log: string;
|
|
4
|
-
constructor(type: AuthErrorTypes);
|
|
5
|
-
}
|
|
6
|
-
export declare class NoUserPoolError extends AuthError {
|
|
7
|
-
constructor(type: AuthErrorTypes);
|
|
8
|
-
}
|
|
9
|
-
export declare const authErrorMessages: AuthErrorMessages;
|
package/lib/OAuth/OAuth.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { OAuthOpts, CognitoHostedUIIdentityProvider } from '../types/Auth';
|
|
2
|
-
export default class OAuth {
|
|
3
|
-
private _urlOpener;
|
|
4
|
-
private _config;
|
|
5
|
-
private _cognitoClientId;
|
|
6
|
-
private _scopes;
|
|
7
|
-
constructor({ config, cognitoClientId, scopes, }: {
|
|
8
|
-
scopes: string[];
|
|
9
|
-
config: OAuthOpts;
|
|
10
|
-
cognitoClientId: string;
|
|
11
|
-
});
|
|
12
|
-
private isValidScopes;
|
|
13
|
-
oauthSignIn(responseType: string, domain: string, redirectSignIn: string, clientId: string, provider?: CognitoHostedUIIdentityProvider | string, customState?: string): void;
|
|
14
|
-
private _handleCodeFlow;
|
|
15
|
-
private _handleImplicitFlow;
|
|
16
|
-
handleAuthResponse(currentUrl?: string): Promise<{
|
|
17
|
-
state: string;
|
|
18
|
-
accessToken: any;
|
|
19
|
-
refreshToken: any;
|
|
20
|
-
idToken: any;
|
|
21
|
-
}>;
|
|
22
|
-
private _validateState;
|
|
23
|
-
signOut(): Promise<any>;
|
|
24
|
-
private _generateState;
|
|
25
|
-
private _generateChallenge;
|
|
26
|
-
private _base64URL;
|
|
27
|
-
private _generateRandom;
|
|
28
|
-
private _bufferToString;
|
|
29
|
-
}
|
package/lib/OAuth/urlOpener.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const launchUri: (url: string) => Promise<Window>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const launchUri: (url: any) => any;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum AuthErrorStrings {
|
|
2
|
-
DEFAULT_MSG = "Authentication Error",
|
|
3
|
-
EMPTY_EMAIL = "Email cannot be empty",
|
|
4
|
-
EMPTY_PHONE = "Phone number cannot be empty",
|
|
5
|
-
EMPTY_USERNAME = "Username cannot be empty",
|
|
6
|
-
INVALID_USERNAME = "The username should either be a string or one of the sign in types",
|
|
7
|
-
EMPTY_PASSWORD = "Password cannot be empty",
|
|
8
|
-
EMPTY_CODE = "Confirmation code cannot be empty",
|
|
9
|
-
SIGN_UP_ERROR = "Error creating account",
|
|
10
|
-
NO_MFA = "No valid MFA method provided",
|
|
11
|
-
INVALID_MFA = "Invalid MFA type",
|
|
12
|
-
EMPTY_CHALLENGE = "Challenge response cannot be empty",
|
|
13
|
-
NO_USER_SESSION = "Failed to get the session because the user is empty",
|
|
14
|
-
NETWORK_ERROR = "Network Error",
|
|
15
|
-
DEVICE_CONFIG = "Device tracking has not been configured in this User Pool",
|
|
16
|
-
AUTOSIGNIN_ERROR = "Please use your credentials to sign in"
|
|
17
|
-
}
|
package/lib/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Auth } from './Auth';
|
|
2
|
-
import { CognitoHostedUIIdentityProvider, SignUpParams, GRAPHQL_AUTH_MODE } from './types/Auth';
|
|
3
|
-
import { CognitoUser, CookieStorage, appendToCognitoUserAgent } from 'amazon-cognito-identity-js';
|
|
4
|
-
import { AuthErrorStrings } from './common/AuthErrorStrings';
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated use named import
|
|
7
|
-
*/
|
|
8
|
-
export default Auth;
|
|
9
|
-
export { Auth, CognitoUser, CookieStorage, CognitoHostedUIIdentityProvider, SignUpParams, appendToCognitoUserAgent, AuthErrorStrings, GRAPHQL_AUTH_MODE, };
|
package/lib/types/Auth.d.ts
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { ICookieStorageData, ICognitoStorage } from 'amazon-cognito-identity-js';
|
|
2
|
-
/**
|
|
3
|
-
* Parameters for user sign up
|
|
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
|
-
* Auth instance options
|
|
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
|
-
* Details for multi-factor authentication
|
|
62
|
-
*/
|
|
63
|
-
export interface MfaRequiredDetails {
|
|
64
|
-
challengeName: any;
|
|
65
|
-
challengeParameters: any;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* interface for federatedResponse
|
|
69
|
-
*/
|
|
70
|
-
export interface FederatedResponse {
|
|
71
|
-
token: string;
|
|
72
|
-
identity_id?: string;
|
|
73
|
-
expires_at: number;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* interface for federatedUser
|
|
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
|
-
}
|
package/lib/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Auth';
|
package/lib/urlListener.d.ts
DELETED