@aws-amplify/auth 5.6.1-github-actions.c2933e1.0 → 5.6.1-v5-auth-internals.a149b6c.4
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/internals/package.json +8 -0
- package/lib/Auth.d.ts +4 -81
- package/lib/Auth.js +45 -2252
- package/lib/Auth.js.map +1 -1
- package/lib/internals/InternalAuth.d.ts +305 -0
- package/lib/internals/InternalAuth.js +2529 -0
- package/lib/internals/InternalAuth.js.map +1 -0
- package/lib/internals/index.d.ts +1 -0
- package/lib/internals/index.js +7 -0
- package/lib/internals/index.js.map +1 -0
- package/lib-esm/Auth.d.ts +4 -81
- package/lib-esm/Auth.js +47 -2254
- package/lib-esm/Auth.js.map +1 -1
- package/lib-esm/internals/InternalAuth.d.ts +305 -0
- package/lib-esm/internals/InternalAuth.js +2527 -0
- package/lib-esm/internals/InternalAuth.js.map +1 -0
- package/lib-esm/internals/index.d.ts +1 -0
- package/lib-esm/internals/index.js +4 -0
- package/lib-esm/internals/index.js.map +1 -0
- package/package.json +7 -6
- package/src/Auth.ts +76 -2410
- package/src/internals/InternalAuth.ts +2872 -0
- package/src/internals/index.ts +3 -0
package/lib/Auth.d.ts
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FederatedResponse, SignUpParams, FederatedUser, ConfirmSignUpOptions, SignOutOpts, CurrentUserOpts, GetPreferredMFAOpts, SignInOpts, FederatedSignInOptionsCustom, LegacyProvider, FederatedSignInOptions, ClientMetaData } from './types';
|
|
2
2
|
import { ICredentials } from '@aws-amplify/core';
|
|
3
|
-
import { ISignUpResult, CognitoUser, MFAOption, CognitoUserSession, CognitoUserAttribute
|
|
3
|
+
import { ISignUpResult, CognitoUser, MFAOption, CognitoUserSession, CognitoUserAttribute } from 'amazon-cognito-identity-js';
|
|
4
4
|
import { AuthError } from './Errors';
|
|
5
5
|
import { IAuthDevice } from './types/Auth';
|
|
6
|
+
import { InternalAuthClass } from './internals/InternalAuth';
|
|
6
7
|
/**
|
|
7
8
|
* Provide authentication steps
|
|
8
9
|
*/
|
|
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
|
-
private inflightSessionPromise;
|
|
20
|
-
private inflightSessionPromiseCounter;
|
|
21
|
-
Credentials: import("@aws-amplify/core").CredentialsClass;
|
|
22
|
-
/**
|
|
23
|
-
* Initialize Auth with AWS configurations
|
|
24
|
-
* @param {Object} config - Configuration of the Auth
|
|
25
|
-
*/
|
|
26
|
-
constructor(config: AuthOptions);
|
|
10
|
+
export declare class AuthClass extends InternalAuthClass {
|
|
27
11
|
getModuleName(): string;
|
|
28
|
-
configure(config?: any): AuthOptions;
|
|
29
|
-
wrapRefreshSessionCallback: (callback: NodeCallback<Error, any>) => NodeCallback<Error, any>;
|
|
30
12
|
/**
|
|
31
13
|
* Sign up with username, password and other attributes like phone, email
|
|
32
14
|
* @param {String | object} params - The user attributes used for signin
|
|
@@ -34,10 +16,6 @@ export declare class AuthClass {
|
|
|
34
16
|
* @return - A promise resolves callback data if success
|
|
35
17
|
*/
|
|
36
18
|
signUp(params: string | SignUpParams, ...restOfAttrs: string[]): Promise<ISignUpResult>;
|
|
37
|
-
private handleAutoSignIn;
|
|
38
|
-
private handleCodeAutoSignIn;
|
|
39
|
-
private handleLinkAutoSignIn;
|
|
40
|
-
private signInAfterUserConfirmed;
|
|
41
19
|
/**
|
|
42
20
|
* Send the verification code to confirm sign up
|
|
43
21
|
* @param {String} username - The username to be confirmed
|
|
@@ -46,7 +24,6 @@ export declare class AuthClass {
|
|
|
46
24
|
* @return - A promise resolves callback data if success
|
|
47
25
|
*/
|
|
48
26
|
confirmSignUp(username: string, code: string, options?: ConfirmSignUpOptions): Promise<any>;
|
|
49
|
-
private isTrueStorageValue;
|
|
50
27
|
/**
|
|
51
28
|
* Resend the verification code
|
|
52
29
|
* @param {String} username - The username to be confirmed
|
|
@@ -62,28 +39,6 @@ export declare class AuthClass {
|
|
|
62
39
|
* @return - A promise resolves the CognitoUser
|
|
63
40
|
*/
|
|
64
41
|
signIn(usernameOrSignInOpts: string | SignInOpts, pw?: string, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>;
|
|
65
|
-
/**
|
|
66
|
-
* Return an object with the authentication callbacks
|
|
67
|
-
* @param {CognitoUser} user - the cognito user object
|
|
68
|
-
* @param {} resolve - function called when resolving the current step
|
|
69
|
-
* @param {} reject - function called when rejecting the current step
|
|
70
|
-
* @return - an object with the callback methods for user authentication
|
|
71
|
-
*/
|
|
72
|
-
private authCallbacks;
|
|
73
|
-
/**
|
|
74
|
-
* Sign in with a password
|
|
75
|
-
* @private
|
|
76
|
-
* @param {AuthenticationDetails} authDetails - the user sign in data
|
|
77
|
-
* @return - A promise resolves the CognitoUser object if success or mfa required
|
|
78
|
-
*/
|
|
79
|
-
private signInWithPassword;
|
|
80
|
-
/**
|
|
81
|
-
* Sign in without a password
|
|
82
|
-
* @private
|
|
83
|
-
* @param {AuthenticationDetails} authDetails - the user sign in data
|
|
84
|
-
* @return - A promise resolves the CognitoUser object if success or mfa required
|
|
85
|
-
*/
|
|
86
|
-
private signInWithoutPassword;
|
|
87
42
|
/**
|
|
88
43
|
* This was previously used by an authenticated user to get MFAOptions,
|
|
89
44
|
* but no longer returns a meaningful response. Refer to the documentation for
|
|
@@ -99,8 +54,6 @@ export declare class AuthClass {
|
|
|
99
54
|
* @param {GetPreferredMFAOpts} params - options for getting the current user preferred MFA
|
|
100
55
|
*/
|
|
101
56
|
getPreferredMFA(user: CognitoUser | any, params?: GetPreferredMFAOpts): Promise<string>;
|
|
102
|
-
private _getMfaTypeFromUserData;
|
|
103
|
-
private _getUserData;
|
|
104
57
|
/**
|
|
105
58
|
* set preferred MFA method
|
|
106
59
|
* @param {CognitoUser} user - the current Cognito user
|
|
@@ -165,7 +118,6 @@ export declare class AuthClass {
|
|
|
165
118
|
* @return {Promise}
|
|
166
119
|
**/
|
|
167
120
|
updateUserAttributes(user: CognitoUser | any, attributes: object, clientMetadata?: ClientMetaData): Promise<string>;
|
|
168
|
-
private createUpdateAttributesResultList;
|
|
169
121
|
/**
|
|
170
122
|
* Return user attributes
|
|
171
123
|
* @param {Object} user - The CognitoUser object
|
|
@@ -176,22 +128,11 @@ export declare class AuthClass {
|
|
|
176
128
|
verified: {};
|
|
177
129
|
unverified: {};
|
|
178
130
|
}>;
|
|
179
|
-
private isErrorWithMessage;
|
|
180
|
-
private isTokenRevokedError;
|
|
181
|
-
private isRefreshTokenRevokedError;
|
|
182
|
-
private isUserDisabledError;
|
|
183
|
-
private isUserDoesNotExistError;
|
|
184
|
-
private isRefreshTokenExpiredError;
|
|
185
|
-
private isPasswordResetRequiredError;
|
|
186
|
-
private isSignedInHostedUI;
|
|
187
|
-
private isSessionInvalid;
|
|
188
|
-
private cleanUpInvalidSession;
|
|
189
131
|
/**
|
|
190
132
|
* Get current authenticated user
|
|
191
133
|
* @return - A promise resolves to current authenticated CognitoUser if success
|
|
192
134
|
*/
|
|
193
135
|
currentUserPoolUser(params?: CurrentUserOpts): Promise<CognitoUser | any>;
|
|
194
|
-
private isOAuthInProgress;
|
|
195
136
|
/**
|
|
196
137
|
* Get current authenticated user
|
|
197
138
|
* @param {CurrentUserOpts} - options for getting the current user
|
|
@@ -203,7 +144,6 @@ export declare class AuthClass {
|
|
|
203
144
|
* @return - A promise resolves to session object if success
|
|
204
145
|
*/
|
|
205
146
|
currentSession(): Promise<CognitoUserSession>;
|
|
206
|
-
private _userSession;
|
|
207
147
|
/**
|
|
208
148
|
* Get the corresponding user session
|
|
209
149
|
* @param {Object} user - The CognitoUser object
|
|
@@ -239,17 +179,12 @@ export declare class AuthClass {
|
|
|
239
179
|
* @return - A promise resolves to callback data if success
|
|
240
180
|
*/
|
|
241
181
|
verifyCurrentUserAttributeSubmit(attr: string, code: string): Promise<string>;
|
|
242
|
-
private cognitoIdentitySignOut;
|
|
243
|
-
private oAuthSignOutRedirect;
|
|
244
|
-
private oAuthSignOutAndResolve;
|
|
245
|
-
private oAuthSignOutRedirectOrReject;
|
|
246
182
|
/**
|
|
247
183
|
* Sign out method
|
|
248
184
|
* @
|
|
249
185
|
* @return - A promise resolved if success
|
|
250
186
|
*/
|
|
251
187
|
signOut(opts?: SignOutOpts): Promise<any>;
|
|
252
|
-
private cleanCachedItems;
|
|
253
188
|
/**
|
|
254
189
|
* Change a password for an authenticated user
|
|
255
190
|
* @param {Object} user - The CognitoUser object
|
|
@@ -281,24 +216,12 @@ export declare class AuthClass {
|
|
|
281
216
|
federatedSignIn(options?: FederatedSignInOptions): Promise<ICredentials>;
|
|
282
217
|
federatedSignIn(provider: LegacyProvider, response: FederatedResponse, user: FederatedUser): Promise<ICredentials>;
|
|
283
218
|
federatedSignIn(options?: FederatedSignInOptionsCustom): Promise<ICredentials>;
|
|
284
|
-
/**
|
|
285
|
-
* Used to complete the OAuth flow with or without the Cognito Hosted UI
|
|
286
|
-
* @param {String} URL - optional parameter for customers to pass in the response URL
|
|
287
|
-
*/
|
|
288
|
-
private _handleAuthResponse;
|
|
289
219
|
/**
|
|
290
220
|
* Compact version of credentials
|
|
291
221
|
* @param {Object} credentials
|
|
292
222
|
* @return {Object} - Credentials
|
|
293
223
|
*/
|
|
294
224
|
essentialCredentials(credentials: any): ICredentials;
|
|
295
|
-
private attributesToObject;
|
|
296
|
-
private isTruthyString;
|
|
297
|
-
private createCognitoUser;
|
|
298
|
-
private _isValidAuthStorage;
|
|
299
|
-
private noUserPoolErrorHandler;
|
|
300
|
-
private rejectAuthError;
|
|
301
|
-
private rejectNoUserPool;
|
|
302
225
|
rememberDevice(): Promise<string | AuthError>;
|
|
303
226
|
forgetDevice(): Promise<void>;
|
|
304
227
|
fetchDevices(): Promise<IAuthDevice[]>;
|