@aws-amplify/auth 5.6.1-v5-auth-internals.9bf4dba.6 → 5.6.1

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.
@@ -312,16 +312,14 @@ export class InternalAuthClass {
312
312
  * Sign up with username, password and other attributes like phone, email
313
313
  * @param {String | object} params - The user attributes used for signin
314
314
  * @param {String[]} restOfAttrs - for the backward compatability
315
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
315
316
  * @return - A promise resolves callback data if success
316
317
  */
317
318
  public signUp(
318
319
  params: string | SignUpParams,
319
- ...restOfAttrs: string[]
320
- ): Promise<ISignUpResult> {
321
- return this.internalSignUp(params, restOfAttrs);
322
- }
323
-
324
- public internalSignUp(
320
+ ...restOfAttrs: any
321
+ ): Promise<ISignUpResult>;
322
+ public signUp(
325
323
  params: string | SignUpParams,
326
324
  restOfAttrs?: string[],
327
325
  customUserAgentDetails?: CustomUserAgentDetails
@@ -542,6 +540,7 @@ export class InternalAuthClass {
542
540
  * @param {String} username - The username to be confirmed
543
541
  * @param {String} code - The verification code
544
542
  * @param {ConfirmSignUpOptions} options - other options for confirm signup
543
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
545
544
  * @return - A promise resolves callback data if success
546
545
  */
547
546
  public confirmSignUp(
@@ -611,6 +610,7 @@ export class InternalAuthClass {
611
610
  * Resend the verification code
612
611
  * @param {String} username - The username to be confirmed
613
612
  * @param {ClientMetadata} clientMetadata - Metadata to be passed to Cognito Lambda triggers
613
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
614
614
  * @return - A promise resolves code delivery details if successful
615
615
  */
616
616
  public resendSignUp(
@@ -841,6 +841,7 @@ export class InternalAuthClass {
841
841
  * how to setup and use MFA: https://docs.amplify.aws/lib/auth/mfa/q/platform/js
842
842
  * @deprecated
843
843
  * @param {CognitoUser} user - the current user
844
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
844
845
  * @return - A promise resolves the current preferred mfa option if success
845
846
  */
846
847
  public getMFAOptions(
@@ -865,6 +866,7 @@ export class InternalAuthClass {
865
866
  * get preferred mfa method
866
867
  * @param {CognitoUser} user - the current cognito user
867
868
  * @param {GetPreferredMFAOpts} params - options for getting the current user preferred MFA
869
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
868
870
  */
869
871
  public getPreferredMFA(
870
872
  user: CognitoUser | any,
@@ -970,6 +972,7 @@ export class InternalAuthClass {
970
972
  * set preferred MFA method
971
973
  * @param {CognitoUser} user - the current Cognito user
972
974
  * @param {string} mfaMethod - preferred mfa method
975
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
973
976
  * @return - A promise resolve if success
974
977
  */
975
978
  public async setPreferredMFA(
@@ -1091,6 +1094,7 @@ export class InternalAuthClass {
1091
1094
  * disable SMS
1092
1095
  * @deprecated
1093
1096
  * @param {CognitoUser} user - the current user
1097
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1094
1098
  * @return - A promise resolves is success
1095
1099
  */
1096
1100
  public disableSMS(
@@ -1115,6 +1119,7 @@ export class InternalAuthClass {
1115
1119
  * enable SMS
1116
1120
  * @deprecated
1117
1121
  * @param {CognitoUser} user - the current user
1122
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1118
1123
  * @return - A promise resolves is success
1119
1124
  */
1120
1125
  public enableSMS(
@@ -1138,6 +1143,7 @@ export class InternalAuthClass {
1138
1143
  /**
1139
1144
  * Setup TOTP
1140
1145
  * @param {CognitoUser} user - the current user
1146
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1141
1147
  * @return - A promise resolves with the secret code if success
1142
1148
  */
1143
1149
  public setupTOTP(
@@ -1164,6 +1170,7 @@ export class InternalAuthClass {
1164
1170
  * verify TOTP setup
1165
1171
  * @param {CognitoUser} user - the current user
1166
1172
  * @param {string} challengeAnswer - challenge answer
1173
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1167
1174
  * @return - A promise resolves is success
1168
1175
  */
1169
1176
  public verifyTotpToken(
@@ -1211,6 +1218,9 @@ export class InternalAuthClass {
1211
1218
  * Send MFA code to confirm sign in
1212
1219
  * @param {Object} user - The CognitoUser object
1213
1220
  * @param {String} code - The confirmation code
1221
+ * @param {string} mfaType - optional mfaType: 'SMS_MFA' | 'SOFTWARE_TOKEN_MFA'
1222
+ * @param {ClientMetaData} clientMetadata - optional client metadata defaults to config
1223
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1214
1224
  */
1215
1225
  public confirmSignIn(
1216
1226
  user: CognitoUser | any,
@@ -1335,6 +1345,8 @@ export class InternalAuthClass {
1335
1345
  * Send the answer to a custom challenge
1336
1346
  * @param {CognitoUser} user - The CognitoUser object
1337
1347
  * @param {String} challengeResponses - The confirmation code
1348
+ * @param {ClientMetaData} clientMetadata - optional client metadata defaults to config
1349
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1338
1350
  */
1339
1351
  public sendCustomChallengeAnswer(
1340
1352
  user: CognitoUser | any,
@@ -1361,7 +1373,9 @@ export class InternalAuthClass {
1361
1373
 
1362
1374
  /**
1363
1375
  * Delete an authenticated users' attributes
1364
- * @param {CognitoUser} - The currently logged in user object
1376
+ * @param {CognitoUser} user - The currently logged in user object
1377
+ * @param {string[]} attributeNames - Attributes to delete
1378
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1365
1379
  * @return {Promise}
1366
1380
  **/
1367
1381
  public deleteUserAttributes(
@@ -1385,6 +1399,7 @@ export class InternalAuthClass {
1385
1399
 
1386
1400
  /**
1387
1401
  * Delete the current authenticated user
1402
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1388
1403
  * @return {Promise}
1389
1404
  **/
1390
1405
  // TODO: Check return type void
@@ -1469,7 +1484,10 @@ export class InternalAuthClass {
1469
1484
 
1470
1485
  /**
1471
1486
  * Update an authenticated users' attributes
1472
- * @param {CognitoUser} - The currently logged in user object
1487
+ * @param {CognitoUser} user - The currently logged in user object
1488
+ * @param {object} attributes - attributes to update
1489
+ * @param {ClientMetaData} clientMetadata - optional client metadata, defaults to config
1490
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1473
1491
  * @return {Promise}
1474
1492
  **/
1475
1493
  public updateUserAttributes(
@@ -1543,6 +1561,7 @@ export class InternalAuthClass {
1543
1561
  /**
1544
1562
  * Return user attributes
1545
1563
  * @param {Object} user - The CognitoUser object
1564
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1546
1565
  * @return - A promise resolves to user attributes if success
1547
1566
  */
1548
1567
  public userAttributes(
@@ -1687,6 +1706,8 @@ export class InternalAuthClass {
1687
1706
 
1688
1707
  /**
1689
1708
  * Get current authenticated user
1709
+ * @param {CurrentUserOpts} params - options for getting the current user
1710
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1690
1711
  * @return - A promise resolves to current authenticated CognitoUser if success
1691
1712
  */
1692
1713
  public currentUserPoolUser(
@@ -1820,6 +1841,7 @@ export class InternalAuthClass {
1820
1841
  /**
1821
1842
  * Get current authenticated user
1822
1843
  * @param {CurrentUserOpts} - options for getting the current user
1844
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1823
1845
  * @return - A promise resolves to current authenticated CognitoUser if success
1824
1846
  */
1825
1847
  public async currentAuthenticatedUser(
@@ -1875,6 +1897,7 @@ export class InternalAuthClass {
1875
1897
 
1876
1898
  /**
1877
1899
  * Get current user's session
1900
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1878
1901
  * @return - A promise resolves to session object if success
1879
1902
  */
1880
1903
  public currentSession(
@@ -1967,6 +1990,7 @@ export class InternalAuthClass {
1967
1990
  /**
1968
1991
  * Get the corresponding user session
1969
1992
  * @param {Object} user - The CognitoUser object
1993
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1970
1994
  * @return - A promise resolves to the session
1971
1995
  */
1972
1996
  public userSession(
@@ -1978,6 +2002,7 @@ export class InternalAuthClass {
1978
2002
 
1979
2003
  /**
1980
2004
  * Get authenticated credentials of current user.
2005
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
1981
2006
  * @return - A promise resolves to be current user's credentials
1982
2007
  */
1983
2008
  public async currentUserCredentials(
@@ -2058,6 +2083,7 @@ export class InternalAuthClass {
2058
2083
  * @param {Object} user - The CognitoUser
2059
2084
  * @param {Object} attr - The attribute to be verified
2060
2085
  * @param {String} code - The confirmation code
2086
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2061
2087
  * @return - A promise resolves to callback data if success
2062
2088
  */
2063
2089
  public verifyUserAttributeSubmit(
@@ -2098,6 +2124,7 @@ export class InternalAuthClass {
2098
2124
  * Confirm current user's attribute using a confirmation code
2099
2125
  * @param {Object} attr - The attribute to be verified
2100
2126
  * @param {String} code - The confirmation code
2127
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2101
2128
  * @return - A promise resolves to callback data if success
2102
2129
  */
2103
2130
  verifyCurrentUserAttributeSubmit(
@@ -2208,7 +2235,8 @@ export class InternalAuthClass {
2208
2235
 
2209
2236
  /**
2210
2237
  * Sign out method
2211
- * @
2238
+ * @param {SignOutOpts} opts - options for sign out
2239
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2212
2240
  * @return - A promise resolved if success
2213
2241
  */
2214
2242
  public async signOut(
@@ -2252,6 +2280,8 @@ export class InternalAuthClass {
2252
2280
  * @param {Object} user - The CognitoUser object
2253
2281
  * @param {String} oldPassword - the current password
2254
2282
  * @param {String} newPassword - the requested new password
2283
+ * @param {ClientMetaData} clientMetadata - optional client metadata, defaults to config
2284
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2255
2285
  * @return - A promise resolves if success
2256
2286
  */
2257
2287
  public changePassword(
@@ -2283,6 +2313,8 @@ export class InternalAuthClass {
2283
2313
  /**
2284
2314
  * Initiate a forgot password request
2285
2315
  * @param {String} username - the username to change password
2316
+ * @param {ClientMetaData} clientMetadata - optional client metadata, defaults to config
2317
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2286
2318
  * @return - A promise resolves if success
2287
2319
  */
2288
2320
  public forgotPassword(
@@ -2335,6 +2367,8 @@ export class InternalAuthClass {
2335
2367
  * @param {String} username - The username
2336
2368
  * @param {String} code - The confirmation code
2337
2369
  * @param {String} password - The new password
2370
+ * @param {ClientMetaData} clientMetadata - optional client metadata, defaults to config
2371
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2338
2372
  * @return - A promise that resolves if success
2339
2373
  */
2340
2374
  public forgotPasswordSubmit(
@@ -2390,6 +2424,7 @@ export class InternalAuthClass {
2390
2424
  /**
2391
2425
  * Get user information
2392
2426
  * @async
2427
+ * @param {CustomUserAgentDetails} customUserAgentDetails - Optional parameter to send user agent details
2393
2428
  * @return {Object }- current User's information
2394
2429
  */
2395
2430
  public async currentUserInfo(
@@ -2530,10 +2565,7 @@ export class InternalAuthClass {
2530
2565
  * Used to complete the OAuth flow with or without the Cognito Hosted UI
2531
2566
  * @param {String} URL - optional parameter for customers to pass in the response URL
2532
2567
  */
2533
- private async _handleAuthResponse(
2534
- URL?: string,
2535
- customUserAgentDetails?: CustomUserAgentDetails
2536
- ) {
2568
+ private async _handleAuthResponse(URL?: string) {
2537
2569
  if (this.oAuthFlowInProgress) {
2538
2570
  logger.debug(`Skipping URL ${URL} current flow in progress`);
2539
2571
  return;
@@ -2679,10 +2711,7 @@ export class InternalAuthClass {
2679
2711
  * @param {Object} credentials
2680
2712
  * @return {Object} - Credentials
2681
2713
  */
2682
- public essentialCredentials(
2683
- credentials,
2684
- customUserAgentDetails?: CustomUserAgentDetails
2685
- ): ICredentials {
2714
+ public essentialCredentials(credentials): ICredentials {
2686
2715
  return {
2687
2716
  accessKeyId: credentials.accessKeyId,
2688
2717
  sessionToken: credentials.sessionToken,