@vardario/cognito-client 1.0.1 → 2.1.0

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/lib/error.js CHANGED
@@ -1,117 +1,382 @@
1
- /**
2
- * Possible Cognito exceptions
3
- */
4
- export var CognitoException;
5
- (function (CognitoException) {
6
- /**
7
- * You do not have sufficient access to perform this action.
8
- */
9
- CognitoException["AccessDeniedException"] = "AccessDeniedException";
10
- /**
11
- * The request signature does not conform to AWS standards.
12
- */
13
- CognitoException["IncompleteSignature"] = "IncompleteSignature";
14
- /**
15
- * The request processing has failed because of an unknown error, exception or failure.
16
- */
17
- CognitoException["InternalFailure"] = "InternalFailure";
18
- /**
19
- * The action or operation requested is invalid. Verify that the action is typed correctly.
20
- */
21
- CognitoException["InvalidAction"] = "InvalidAction";
22
- /**
23
- * The X.509 certificate or AWS access key ID provided does not exist in our records.
24
- */
25
- CognitoException["InvalidClientTokenId"] = "InvalidClientTokenId";
26
- /**
27
- * You do not have permission to perform this action.
28
- */
29
- CognitoException["NotAuthorized"] = "NotAuthorized";
30
- /**
31
- * The AWS access key ID needs a subscription for the service.
32
- */
33
- CognitoException["OptInRequired"] = "OptInRequired";
34
- /**
35
- * The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp on the request is more than 15 minutes in the future.
36
- */
37
- CognitoException["RequestExpired"] = "RequestExpired";
38
- /**
39
- * The request has failed due to a temporary failure of the server.
40
- */
41
- CognitoException["ServiceUnavailable"] = "ServiceUnavailable";
42
- /**
43
- * The request was denied due to request throttling.
44
- */
45
- CognitoException["ThrottlingException"] = "ThrottlingException";
46
- /**
47
- * The input fails to satisfy the constraints specified by an AWS service.
48
- */
49
- CognitoException["ValidationError"] = "ValidationError";
50
- /**
51
- * This exception is thrown when AWS WAF doesn't allow your request based on a web ACL that's associated with your user pool.
52
- */
53
- CognitoException["ForbiddenException"] = "ForbiddenException";
54
- /**
55
- * This exception is thrown when Amazon Cognito encounters an internal error.
56
- */
57
- CognitoException["InternalErrorException"] = "InternalErrorException";
58
- /**
59
- * This exception is thrown when Amazon Cognito encounters an invalid AWS Lambda response.
60
- */
61
- CognitoException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
62
- /**
63
- * This exception is thrown when the Amazon Cognito service encounters an invalid parameter.
64
- */
65
- CognitoException["InvalidParameterException"] = "InvalidParameterException";
66
- /**
67
- * This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.
68
- */
69
- CognitoException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
70
- /**
71
- * This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.
72
- */
73
- CognitoException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
74
- /**
75
- * This exception is thrown when the user pool configuration is not valid.
76
- */
77
- CognitoException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
78
- /**
79
- * This exception is thrown when a user isn't authorized.
80
- */
81
- CognitoException["NotAuthorizedException"] = "NotAuthorizedException";
82
- /**
83
- * This exception is thrown when a password reset is required.
84
- */
85
- CognitoException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
86
- /**
87
- * This exception is thrown when the Amazon Cognito service can't find the requested resource.
88
- */
89
- CognitoException["ResourceNotFoundException"] = "ResourceNotFoundException";
90
- /**
91
- * This exception is thrown when the user has made too many requests for a given operation.
92
- */
93
- CognitoException["TooManyRequestsException"] = "TooManyRequestsException";
94
- /**
95
- * This exception is thrown when Amazon Cognito encounters an unexpected exception with AWS Lambda.
96
- */
97
- CognitoException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
98
- /**
99
- * This exception is thrown when the Amazon Cognito service encounters a user validation exception with the AWS Lambda service.
100
- */
101
- CognitoException["UserLambdaValidationException"] = "UserLambdaValidationException";
102
- /**
103
- * This exception is thrown when a user isn't confirmed successfully.
104
- */
105
- CognitoException["UserNotConfirmedException"] = "UserNotConfirmedException";
106
- /**
107
- * This exception is thrown when a user isn't found.
108
- */
109
- CognitoException["UserNotFoundException"] = "UserNotFoundException";
110
- /**
111
- * Unknown auth error happened.
112
- */
113
- CognitoException["Unknown"] = "unknown";
114
- })(CognitoException || (CognitoException = {}));
1
+ export var CognitoCommonException;
2
+ (function (CognitoCommonException) {
3
+ CognitoCommonException["Unknown"] = "Unknown";
4
+ })(CognitoCommonException || (CognitoCommonException = {}));
5
+ export var AssociateSoftwareTokenException;
6
+ (function (AssociateSoftwareTokenException) {
7
+ AssociateSoftwareTokenException["ConcurrentModificationException"] = "ConcurrentModificationException";
8
+ AssociateSoftwareTokenException["ForbiddenException"] = "ForbiddenException";
9
+ AssociateSoftwareTokenException["InternalErrorException"] = "InternalErrorException";
10
+ AssociateSoftwareTokenException["InvalidParameterException"] = "InvalidParameterException";
11
+ AssociateSoftwareTokenException["NotAuthorizedException"] = "NotAuthorizedException";
12
+ AssociateSoftwareTokenException["ResourceNotFoundException"] = "ResourceNotFoundException";
13
+ AssociateSoftwareTokenException["SoftwareTokenMFANotFoundException"] = "SoftwareTokenMFANotFoundException";
14
+ })(AssociateSoftwareTokenException || (AssociateSoftwareTokenException = {}));
15
+ export var ChangePasswordException;
16
+ (function (ChangePasswordException) {
17
+ ChangePasswordException["ForbiddenException"] = "ForbiddenException";
18
+ ChangePasswordException["InternalErrorException"] = "InternalErrorException";
19
+ ChangePasswordException["InvalidParameterException"] = "InvalidParameterException";
20
+ ChangePasswordException["InvalidPasswordException"] = "InvalidPasswordException";
21
+ ChangePasswordException["LimitExceededException"] = "LimitExceededException";
22
+ ChangePasswordException["NotAuthorizedException"] = "NotAuthorizedException";
23
+ ChangePasswordException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
24
+ ChangePasswordException["ResourceNotFoundException"] = "ResourceNotFoundException";
25
+ ChangePasswordException["TooManyRequestsException"] = "TooManyRequestsException";
26
+ ChangePasswordException["UserNotConfirmedException"] = "UserNotConfirmedException";
27
+ ChangePasswordException["UserNotFoundException"] = "UserNotFoundException";
28
+ })(ChangePasswordException || (ChangePasswordException = {}));
29
+ export var ConfirmDeviceException;
30
+ (function (ConfirmDeviceException) {
31
+ ConfirmDeviceException["ForbiddenException"] = "ForbiddenException";
32
+ ConfirmDeviceException["InternalErrorException"] = "InternalErrorException";
33
+ ConfirmDeviceException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
34
+ ConfirmDeviceException["InvalidParameterException"] = "InvalidParameterException";
35
+ ConfirmDeviceException["InvalidPasswordException"] = "InvalidPasswordException";
36
+ ConfirmDeviceException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
37
+ ConfirmDeviceException["NotAuthorizedException"] = "NotAuthorizedException";
38
+ ConfirmDeviceException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
39
+ ConfirmDeviceException["ResourceNotFoundException"] = "ResourceNotFoundException";
40
+ ConfirmDeviceException["TooManyRequestsException"] = "TooManyRequestsException";
41
+ ConfirmDeviceException["UsernameExistsException"] = "UsernameExistsException";
42
+ ConfirmDeviceException["UserNotConfirmedException"] = "UserNotConfirmedException";
43
+ ConfirmDeviceException["UserNotFoundException"] = "UserNotFoundException";
44
+ })(ConfirmDeviceException || (ConfirmDeviceException = {}));
45
+ export var ConfirmForgotPasswordException;
46
+ (function (ConfirmForgotPasswordException) {
47
+ ConfirmForgotPasswordException["CodeMismatchException"] = "CodeMismatchException";
48
+ ConfirmForgotPasswordException["ExpiredCodeException"] = "ExpiredCodeException";
49
+ ConfirmForgotPasswordException["ForbiddenException"] = "ForbiddenException";
50
+ ConfirmForgotPasswordException["InternalErrorException"] = "InternalErrorException";
51
+ ConfirmForgotPasswordException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
52
+ ConfirmForgotPasswordException["InvalidParameterException"] = "InvalidParameterException";
53
+ ConfirmForgotPasswordException["InvalidPasswordException"] = "InvalidPasswordException";
54
+ ConfirmForgotPasswordException["LimitExceededException"] = "LimitExceededException";
55
+ ConfirmForgotPasswordException["NotAuthorizedException"] = "NotAuthorizedException";
56
+ ConfirmForgotPasswordException["ResourceNotFoundException"] = "ResourceNotFoundException";
57
+ ConfirmForgotPasswordException["TooManyFailedAttemptsException"] = "TooManyFailedAttemptsException";
58
+ ConfirmForgotPasswordException["TooManyRequestsException"] = "TooManyRequestsException";
59
+ ConfirmForgotPasswordException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
60
+ ConfirmForgotPasswordException["UserLambdaValidationException"] = "UserLambdaValidationException";
61
+ ConfirmForgotPasswordException["UserNotConfirmedException"] = "UserNotConfirmedException";
62
+ ConfirmForgotPasswordException["UserNotFoundException"] = "UserNotFoundException";
63
+ })(ConfirmForgotPasswordException || (ConfirmForgotPasswordException = {}));
64
+ export var ConfirmSignUpException;
65
+ (function (ConfirmSignUpException) {
66
+ ConfirmSignUpException["AliasExistsException"] = "AliasExistsException";
67
+ ConfirmSignUpException["CodeMismatchException"] = "CodeMismatchException";
68
+ ConfirmSignUpException["ExpiredCodeException"] = "ExpiredCodeException";
69
+ ConfirmSignUpException["ForbiddenException"] = "ForbiddenException";
70
+ ConfirmSignUpException["InternalErrorException"] = "InternalErrorException";
71
+ ConfirmSignUpException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
72
+ ConfirmSignUpException["InvalidParameterException"] = "InvalidParameterException";
73
+ ConfirmSignUpException["LimitExceededException"] = "LimitExceededException";
74
+ ConfirmSignUpException["NotAuthorizedException"] = "NotAuthorizedException";
75
+ ConfirmSignUpException["ResourceNotFoundException"] = "ResourceNotFoundException";
76
+ ConfirmSignUpException["TooManyFailedAttemptsException"] = "TooManyFailedAttemptsException";
77
+ ConfirmSignUpException["TooManyRequestsException"] = "TooManyRequestsException";
78
+ ConfirmSignUpException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
79
+ ConfirmSignUpException["UserLambdaValidationException"] = "UserLambdaValidationException";
80
+ ConfirmSignUpException["UserNotFoundException"] = "UserNotFoundException";
81
+ })(ConfirmSignUpException || (ConfirmSignUpException = {}));
82
+ export var DeleteUserAttributesException;
83
+ (function (DeleteUserAttributesException) {
84
+ DeleteUserAttributesException["ForbiddenException"] = "ForbiddenException";
85
+ DeleteUserAttributesException["InternalErrorException"] = "InternalErrorException";
86
+ DeleteUserAttributesException["InvalidParameterException"] = "InvalidParameterException";
87
+ DeleteUserAttributesException["NotAuthorizedException"] = "NotAuthorizedException";
88
+ DeleteUserAttributesException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
89
+ DeleteUserAttributesException["ResourceNotFoundException"] = "ResourceNotFoundException";
90
+ DeleteUserAttributesException["TooManyRequestsException"] = "TooManyRequestsException";
91
+ DeleteUserAttributesException["UserNotConfirmedException"] = "UserNotConfirmedException";
92
+ DeleteUserAttributesException["UserNotFoundException"] = "UserNotFoundException";
93
+ })(DeleteUserAttributesException || (DeleteUserAttributesException = {}));
94
+ export var DeleteUserException;
95
+ (function (DeleteUserException) {
96
+ DeleteUserException["ForbiddenException"] = "ForbiddenException";
97
+ DeleteUserException["InternalErrorException"] = "InternalErrorException";
98
+ DeleteUserException["InvalidParameterException"] = "InvalidParameterException";
99
+ DeleteUserException["NotAuthorizedException"] = "NotAuthorizedException";
100
+ DeleteUserException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
101
+ DeleteUserException["ResourceNotFoundException"] = "ResourceNotFoundException";
102
+ DeleteUserException["TooManyRequestsException"] = "TooManyRequestsException";
103
+ DeleteUserException["UserNotConfirmedException"] = "UserNotConfirmedException";
104
+ DeleteUserException["UserNotFoundException"] = "UserNotFoundException";
105
+ })(DeleteUserException || (DeleteUserException = {}));
106
+ export var ForgetDeviceException;
107
+ (function (ForgetDeviceException) {
108
+ ForgetDeviceException["ForbiddenException"] = "ForbiddenException";
109
+ ForgetDeviceException["InternalErrorException"] = "InternalErrorException";
110
+ ForgetDeviceException["InvalidParameterException"] = "InvalidParameterException";
111
+ ForgetDeviceException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
112
+ ForgetDeviceException["NotAuthorizedException"] = "NotAuthorizedException";
113
+ ForgetDeviceException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
114
+ ForgetDeviceException["ResourceNotFoundException"] = "ResourceNotFoundException";
115
+ ForgetDeviceException["TooManyRequestsException"] = "TooManyRequestsException";
116
+ ForgetDeviceException["UserNotConfirmedException"] = "UserNotConfirmedException";
117
+ ForgetDeviceException["UserNotFoundException"] = "UserNotFoundException";
118
+ })(ForgetDeviceException || (ForgetDeviceException = {}));
119
+ export var ForgotPasswordException;
120
+ (function (ForgotPasswordException) {
121
+ ForgotPasswordException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
122
+ ForgotPasswordException["ForbiddenException"] = "ForbiddenException";
123
+ ForgotPasswordException["InternalErrorException"] = "InternalErrorException";
124
+ ForgotPasswordException["InvalidEmailRoleAccessPolicyException"] = "InvalidEmailRoleAccessPolicyException";
125
+ ForgotPasswordException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
126
+ ForgotPasswordException["InvalidParameterException"] = "InvalidParameterException";
127
+ ForgotPasswordException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
128
+ ForgotPasswordException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
129
+ ForgotPasswordException["LimitExceededException"] = "LimitExceededException";
130
+ ForgotPasswordException["NotAuthorizedException"] = "NotAuthorizedException";
131
+ ForgotPasswordException["ResourceNotFoundException"] = "ResourceNotFoundException";
132
+ ForgotPasswordException["TooManyRequestsException"] = "TooManyRequestsException";
133
+ ForgotPasswordException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
134
+ ForgotPasswordException["UserLambdaValidationException"] = "UserLambdaValidationException";
135
+ ForgotPasswordException["UserNotFoundException"] = "UserNotFoundException";
136
+ })(ForgotPasswordException || (ForgotPasswordException = {}));
137
+ export var GetUserException;
138
+ (function (GetUserException) {
139
+ GetUserException["ForbiddenException"] = "ForbiddenException";
140
+ GetUserException["InternalErrorException"] = "InternalErrorException";
141
+ GetUserException["InvalidParameterException"] = "InvalidParameterException";
142
+ GetUserException["NotAuthorizedException"] = "NotAuthorizedException";
143
+ GetUserException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
144
+ GetUserException["ResourceNotFoundException"] = "ResourceNotFoundException";
145
+ GetUserException["TooManyRequestsException"] = "TooManyRequestsException";
146
+ GetUserException["UserNotConfirmedException"] = "UserNotConfirmedException";
147
+ GetUserException["UserNotFoundException"] = "UserNotFoundException";
148
+ })(GetUserException || (GetUserException = {}));
149
+ export var GetIdException;
150
+ (function (GetIdException) {
151
+ GetIdException["ExternalServiceException"] = "ExternalServiceException";
152
+ GetIdException["InternalErrorException"] = "InternalErrorException";
153
+ GetIdException["InvalidParameterException"] = "InvalidParameterException";
154
+ GetIdException["LimitExceededException"] = "LimitExceededException";
155
+ GetIdException["NotAuthorizedException"] = "NotAuthorizedException";
156
+ GetIdException["ResourceConflictException"] = "ResourceConflictException";
157
+ GetIdException["ResourceNotFoundException"] = "ResourceNotFoundException";
158
+ GetIdException["TooManyRequestsException"] = "TooManyRequestsException";
159
+ })(GetIdException || (GetIdException = {}));
160
+ export var GetCredentialsForIdentityException;
161
+ (function (GetCredentialsForIdentityException) {
162
+ GetCredentialsForIdentityException["ExternalServiceException"] = "ExternalServiceException";
163
+ GetCredentialsForIdentityException["InternalErrorException"] = "InternalErrorException";
164
+ GetCredentialsForIdentityException["InvalidIdentityPoolConfigurationException"] = "InvalidIdentityPoolConfigurationException";
165
+ GetCredentialsForIdentityException["InvalidParameterException"] = "InvalidParameterException";
166
+ GetCredentialsForIdentityException["NotAuthorizedException"] = "NotAuthorizedException";
167
+ GetCredentialsForIdentityException["ResourceConflictException"] = "ResourceConflictException";
168
+ GetCredentialsForIdentityException["ResourceNotFoundException"] = "ResourceNotFoundException";
169
+ GetCredentialsForIdentityException["TooManyRequestsException"] = "TooManyRequestsException";
170
+ })(GetCredentialsForIdentityException || (GetCredentialsForIdentityException = {}));
171
+ export var GetUserAttributeVerificationException;
172
+ (function (GetUserAttributeVerificationException) {
173
+ GetUserAttributeVerificationException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
174
+ GetUserAttributeVerificationException["ForbiddenException"] = "ForbiddenException";
175
+ GetUserAttributeVerificationException["InternalErrorException"] = "InternalErrorException";
176
+ GetUserAttributeVerificationException["InvalidEmailRoleAccessPolicyException"] = "InvalidEmailRoleAccessPolicyException";
177
+ GetUserAttributeVerificationException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
178
+ GetUserAttributeVerificationException["InvalidParameterException"] = "InvalidParameterException";
179
+ GetUserAttributeVerificationException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
180
+ GetUserAttributeVerificationException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
181
+ GetUserAttributeVerificationException["LimitExceededException"] = "LimitExceededException";
182
+ GetUserAttributeVerificationException["NotAuthorizedException"] = "NotAuthorizedException";
183
+ GetUserAttributeVerificationException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
184
+ GetUserAttributeVerificationException["ResourceNotFoundException"] = "ResourceNotFoundException";
185
+ GetUserAttributeVerificationException["TooManyRequestsException"] = "TooManyRequestsException";
186
+ GetUserAttributeVerificationException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
187
+ GetUserAttributeVerificationException["UserLambdaValidationException"] = "UserLambdaValidationException";
188
+ GetUserAttributeVerificationException["UserNotConfirmedException"] = "UserNotConfirmedException";
189
+ GetUserAttributeVerificationException["UserNotFoundException"] = "UserNotFoundException";
190
+ })(GetUserAttributeVerificationException || (GetUserAttributeVerificationException = {}));
191
+ export var GlobalSignOutException;
192
+ (function (GlobalSignOutException) {
193
+ GlobalSignOutException["ForbiddenException"] = "ForbiddenException";
194
+ GlobalSignOutException["InternalErrorException"] = "InternalErrorException";
195
+ GlobalSignOutException["InvalidParameterException"] = "InvalidParameterException";
196
+ GlobalSignOutException["NotAuthorizedException"] = "NotAuthorizedException";
197
+ GlobalSignOutException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
198
+ GlobalSignOutException["ResourceNotFoundException"] = "ResourceNotFoundException";
199
+ GlobalSignOutException["TooManyRequestsException"] = "TooManyRequestsException";
200
+ GlobalSignOutException["UserNotConfirmedException"] = "UserNotConfirmedException";
201
+ })(GlobalSignOutException || (GlobalSignOutException = {}));
202
+ export var InitiateAuthException;
203
+ (function (InitiateAuthException) {
204
+ InitiateAuthException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
205
+ InitiateAuthException["ForbiddenException"] = "ForbiddenException";
206
+ InitiateAuthException["InternalErrorException"] = "InternalErrorException";
207
+ InitiateAuthException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
208
+ InitiateAuthException["InvalidParameterException"] = "InvalidParameterException";
209
+ InitiateAuthException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
210
+ InitiateAuthException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
211
+ InitiateAuthException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
212
+ InitiateAuthException["NotAuthorizedException"] = "NotAuthorizedException";
213
+ InitiateAuthException["ResourceNotFoundException"] = "ResourceNotFoundException";
214
+ InitiateAuthException["TooManyRequestsException"] = "TooManyRequestsException";
215
+ InitiateAuthException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
216
+ InitiateAuthException["UserLambdaValidationException"] = "UserLambdaValidationException";
217
+ InitiateAuthException["UserNotConfirmedException"] = "UserNotConfirmedException";
218
+ InitiateAuthException["UserNotFoundException"] = "UserNotFoundException";
219
+ })(InitiateAuthException || (InitiateAuthException = {}));
220
+ export var ResendConfirmationException;
221
+ (function (ResendConfirmationException) {
222
+ ResendConfirmationException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
223
+ ResendConfirmationException["ForbiddenException"] = "ForbiddenException";
224
+ ResendConfirmationException["InternalErrorException"] = "InternalErrorException";
225
+ ResendConfirmationException["InvalidEmailRoleAccessPolicyException"] = "InvalidEmailRoleAccessPolicyException";
226
+ ResendConfirmationException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
227
+ ResendConfirmationException["InvalidParameterException"] = "InvalidParameterException";
228
+ ResendConfirmationException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
229
+ ResendConfirmationException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
230
+ ResendConfirmationException["LimitExceededException"] = "LimitExceededException";
231
+ ResendConfirmationException["NotAuthorizedException"] = "NotAuthorizedException";
232
+ ResendConfirmationException["ResourceNotFoundException"] = "ResourceNotFoundException";
233
+ ResendConfirmationException["TooManyRequestsException"] = "TooManyRequestsException";
234
+ ResendConfirmationException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
235
+ ResendConfirmationException["UserLambdaValidationException"] = "UserLambdaValidationException";
236
+ ResendConfirmationException["UserNotFoundException"] = "UserNotFoundException";
237
+ })(ResendConfirmationException || (ResendConfirmationException = {}));
238
+ export var RespondToAuthChallengeException;
239
+ (function (RespondToAuthChallengeException) {
240
+ RespondToAuthChallengeException["AliasExistsException"] = "AliasExistsException";
241
+ RespondToAuthChallengeException["CodeMismatchException"] = "CodeMismatchException";
242
+ RespondToAuthChallengeException["ExpiredCodeException"] = "ExpiredCodeException";
243
+ RespondToAuthChallengeException["ForbiddenException"] = "ForbiddenException";
244
+ RespondToAuthChallengeException["InternalErrorException"] = "InternalErrorException";
245
+ RespondToAuthChallengeException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
246
+ RespondToAuthChallengeException["InvalidParameterException"] = "InvalidParameterException";
247
+ RespondToAuthChallengeException["InvalidPasswordException"] = "InvalidPasswordException";
248
+ RespondToAuthChallengeException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
249
+ RespondToAuthChallengeException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
250
+ RespondToAuthChallengeException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
251
+ RespondToAuthChallengeException["MFAMethodNotFoundException"] = "MFAMethodNotFoundException";
252
+ RespondToAuthChallengeException["NotAuthorizedException"] = "NotAuthorizedException";
253
+ RespondToAuthChallengeException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
254
+ RespondToAuthChallengeException["ResourceNotFoundException"] = "ResourceNotFoundException";
255
+ RespondToAuthChallengeException["SoftwareTokenMFANotFoundException"] = "SoftwareTokenMFANotFoundException";
256
+ RespondToAuthChallengeException["TooManyRequestsException"] = "TooManyRequestsException";
257
+ RespondToAuthChallengeException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
258
+ RespondToAuthChallengeException["UserLambdaValidationException"] = "UserLambdaValidationException";
259
+ RespondToAuthChallengeException["UserNotConfirmedException"] = "UserNotConfirmedException";
260
+ RespondToAuthChallengeException["UserNotFoundException"] = "UserNotFoundException";
261
+ })(RespondToAuthChallengeException || (RespondToAuthChallengeException = {}));
262
+ export var SetUserMFAPreferenceException;
263
+ (function (SetUserMFAPreferenceException) {
264
+ SetUserMFAPreferenceException["ForbiddenException"] = "ForbiddenException";
265
+ SetUserMFAPreferenceException["InternalErrorException"] = "InternalErrorException";
266
+ SetUserMFAPreferenceException["InvalidParameterException"] = "InvalidParameterException";
267
+ SetUserMFAPreferenceException["NotAuthorizedException"] = "NotAuthorizedException";
268
+ SetUserMFAPreferenceException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
269
+ SetUserMFAPreferenceException["ResourceNotFoundException"] = "ResourceNotFoundException";
270
+ SetUserMFAPreferenceException["UserNotConfirmedException"] = "UserNotConfirmedException";
271
+ SetUserMFAPreferenceException["UserNotFoundException"] = "UserNotFoundException";
272
+ })(SetUserMFAPreferenceException || (SetUserMFAPreferenceException = {}));
273
+ export var SignUpException;
274
+ (function (SignUpException) {
275
+ SignUpException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
276
+ SignUpException["InternalErrorException"] = "InternalErrorException";
277
+ SignUpException["InvalidEmailRoleAccessPolicyException"] = "InvalidEmailRoleAccessPolicyException";
278
+ SignUpException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
279
+ SignUpException["InvalidParameterException"] = "InvalidParameterException";
280
+ SignUpException["InvalidPasswordException"] = "InvalidPasswordException";
281
+ SignUpException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
282
+ SignUpException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
283
+ SignUpException["NotAuthorizedException"] = "NotAuthorizedException";
284
+ SignUpException["ResourceNotFoundException"] = "ResourceNotFoundException";
285
+ SignUpException["TooManyRequestsException"] = "TooManyRequestsException";
286
+ SignUpException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
287
+ SignUpException["UserLambdaValidationException"] = "UserLambdaValidationException";
288
+ SignUpException["UsernameExistsException"] = "UsernameExistsException";
289
+ })(SignUpException || (SignUpException = {}));
290
+ export var UpdateUserAttributesException;
291
+ (function (UpdateUserAttributesException) {
292
+ UpdateUserAttributesException["AliasExistsException"] = "AliasExistsException";
293
+ UpdateUserAttributesException["CodeDeliveryFailureException"] = "CodeDeliveryFailureException";
294
+ UpdateUserAttributesException["CodeMismatchException"] = "CodeMismatchException";
295
+ UpdateUserAttributesException["ExpiredCodeException"] = "ExpiredCodeException";
296
+ UpdateUserAttributesException["ForbiddenException"] = "ForbiddenException";
297
+ UpdateUserAttributesException["InternalErrorException"] = "InternalErrorException";
298
+ UpdateUserAttributesException["InvalidEmailRoleAccessPolicyException"] = "InvalidEmailRoleAccessPolicyException";
299
+ UpdateUserAttributesException["InvalidLambdaResponseException"] = "InvalidLambdaResponseException";
300
+ UpdateUserAttributesException["InvalidParameterException"] = "InvalidParameterException";
301
+ UpdateUserAttributesException["InvalidSmsRoleAccessPolicyException"] = "InvalidSmsRoleAccessPolicyException";
302
+ UpdateUserAttributesException["InvalidSmsRoleTrustRelationshipException"] = "InvalidSmsRoleTrustRelationshipException";
303
+ UpdateUserAttributesException["NotAuthorizedException"] = "NotAuthorizedException";
304
+ UpdateUserAttributesException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
305
+ UpdateUserAttributesException["ResourceNotFoundException"] = "ResourceNotFoundException";
306
+ UpdateUserAttributesException["TooManyRequestsException"] = "TooManyRequestsException";
307
+ UpdateUserAttributesException["UnexpectedLambdaException"] = "UnexpectedLambdaException";
308
+ UpdateUserAttributesException["UserLambdaValidationException"] = "UserLambdaValidationException";
309
+ UpdateUserAttributesException["UserNotConfirmedException"] = "UserNotConfirmedException";
310
+ UpdateUserAttributesException["UserNotFoundException"] = "UserNotFoundException";
311
+ })(UpdateUserAttributesException || (UpdateUserAttributesException = {}));
312
+ export var VerifySoftwareTokenException;
313
+ (function (VerifySoftwareTokenException) {
314
+ VerifySoftwareTokenException["CodeMismatchException"] = "CodeMismatchException";
315
+ VerifySoftwareTokenException["EnableSoftwareTokenMFAException"] = "EnableSoftwareTokenMFAException";
316
+ VerifySoftwareTokenException["ForbiddenException"] = "ForbiddenException";
317
+ VerifySoftwareTokenException["InternalErrorException"] = "InternalErrorException";
318
+ VerifySoftwareTokenException["InvalidParameterException"] = "InvalidParameterException";
319
+ VerifySoftwareTokenException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
320
+ VerifySoftwareTokenException["NotAuthorizedException"] = "NotAuthorizedException";
321
+ VerifySoftwareTokenException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
322
+ VerifySoftwareTokenException["ResourceNotFoundException"] = "ResourceNotFoundException";
323
+ VerifySoftwareTokenException["SoftwareTokenMFANotFoundException"] = "SoftwareTokenMFANotFoundException";
324
+ VerifySoftwareTokenException["TooManyRequestsException"] = "TooManyRequestsException";
325
+ VerifySoftwareTokenException["UserNotConfirmedException"] = "UserNotConfirmedException";
326
+ VerifySoftwareTokenException["UserNotFoundException"] = "UserNotFoundException";
327
+ })(VerifySoftwareTokenException || (VerifySoftwareTokenException = {}));
328
+ export var VerifyUserAttributeException;
329
+ (function (VerifyUserAttributeException) {
330
+ VerifyUserAttributeException["AliasExistsException"] = "AliasExistsException";
331
+ VerifyUserAttributeException["CodeMismatchException"] = "CodeMismatchException";
332
+ VerifyUserAttributeException["ExpiredCodeException"] = "ExpiredCodeException";
333
+ VerifyUserAttributeException["ForbiddenException"] = "ForbiddenException";
334
+ VerifyUserAttributeException["InternalErrorException"] = "InternalErrorException";
335
+ VerifyUserAttributeException["InvalidParameterException"] = "InvalidParameterException";
336
+ VerifyUserAttributeException["LimitExceededException"] = "LimitExceededException";
337
+ VerifyUserAttributeException["NotAuthorizedException"] = "NotAuthorizedException";
338
+ VerifyUserAttributeException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
339
+ VerifyUserAttributeException["ResourceNotFoundException"] = "ResourceNotFoundException";
340
+ VerifyUserAttributeException["TooManyRequestsException"] = "TooManyRequestsException";
341
+ VerifyUserAttributeException["UserNotConfirmedException"] = "UserNotConfirmedException";
342
+ VerifyUserAttributeException["UserNotFoundException"] = "UserNotFoundException";
343
+ })(VerifyUserAttributeException || (VerifyUserAttributeException = {}));
344
+ export var UpdateDeviceStatusException;
345
+ (function (UpdateDeviceStatusException) {
346
+ UpdateDeviceStatusException["ForbiddenException"] = "ForbiddenException";
347
+ UpdateDeviceStatusException["InternalErrorException"] = "InternalErrorException";
348
+ UpdateDeviceStatusException["InvalidParameterException"] = "InvalidParameterException";
349
+ UpdateDeviceStatusException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
350
+ UpdateDeviceStatusException["NotAuthorizedException"] = "NotAuthorizedException";
351
+ UpdateDeviceStatusException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
352
+ UpdateDeviceStatusException["ResourceNotFoundException"] = "ResourceNotFoundException";
353
+ UpdateDeviceStatusException["TooManyRequestsException"] = "TooManyRequestsException";
354
+ UpdateDeviceStatusException["UserNotConfirmedException"] = "UserNotConfirmedException";
355
+ UpdateDeviceStatusException["UserNotFoundException"] = "UserNotFoundException";
356
+ })(UpdateDeviceStatusException || (UpdateDeviceStatusException = {}));
357
+ export var ListDevicesException;
358
+ (function (ListDevicesException) {
359
+ ListDevicesException["ForbiddenException"] = "ForbiddenException";
360
+ ListDevicesException["InternalErrorException"] = "InternalErrorException";
361
+ ListDevicesException["InvalidParameterException"] = "InvalidParameterException";
362
+ ListDevicesException["InvalidUserPoolConfigurationException"] = "InvalidUserPoolConfigurationException";
363
+ ListDevicesException["NotAuthorizedException"] = "NotAuthorizedException";
364
+ ListDevicesException["PasswordResetRequiredException"] = "PasswordResetRequiredException";
365
+ ListDevicesException["ResourceNotFoundException"] = "ResourceNotFoundException";
366
+ ListDevicesException["TooManyRequestsException"] = "TooManyRequestsException";
367
+ ListDevicesException["UserNotConfirmedException"] = "UserNotConfirmedException";
368
+ ListDevicesException["UserNotFoundException"] = "UserNotFoundException";
369
+ })(ListDevicesException || (ListDevicesException = {}));
370
+ export var RevokeTokenException;
371
+ (function (RevokeTokenException) {
372
+ RevokeTokenException["ForbiddenException"] = "ForbiddenException";
373
+ RevokeTokenException["InternalErrorException"] = "InternalErrorException";
374
+ RevokeTokenException["InvalidParameterException"] = "InvalidParameterException";
375
+ RevokeTokenException["TooManyRequestsException"] = "TooManyRequestsException";
376
+ RevokeTokenException["UnauthorizedException"] = "UnauthorizedException";
377
+ RevokeTokenException["UnsupportedOperationException"] = "UnsupportedOperationException";
378
+ RevokeTokenException["UnsupportedTokenTypeException"] = "UnsupportedTokenTypeException";
379
+ })(RevokeTokenException || (RevokeTokenException = {}));
115
380
  export class CognitoError extends Error {
116
381
  constructor(message, cognitoException) {
117
382
  super(message);
package/lib/utils.d.ts CHANGED
@@ -21,3 +21,4 @@ export declare function decodeJwt<T = unknown>(jwt: string): {
21
21
  };
22
22
  export declare function randomBytes(num: number): Promise<Buffer>;
23
23
  export declare function formatTimestamp(date: Date): string;
24
+ export declare function calculateSecretHash(clientSecret: string, userPoolClientId: string, username: string): string;
package/lib/utils.js CHANGED
@@ -123,3 +123,11 @@ export async function randomBytes(num) {
123
123
  export function formatTimestamp(date) {
124
124
  return formatInTimeZone(date, 'UTC', "EEE MMM d HH:mm:ss 'UTC' yyyy");
125
125
  }
126
+ export function calculateSecretHash(clientSecret, userPoolClientId, username) {
127
+ const message = `${username}${userPoolClientId}`;
128
+ const hash = Buffer.from(hashJs
129
+ .hmac(hashJs.sha256, clientSecret)
130
+ .update(message)
131
+ .digest()).toString('base64');
132
+ return hash;
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vardario/cognito-client",
3
- "version": "1.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Sahin Vardar",
@@ -45,7 +45,8 @@
45
45
  "semantic-release": "^22.0.8",
46
46
  "testcontainers": "^10.2.2",
47
47
  "typescript": "^5.2.2",
48
- "vitest": "^0.34.6"
48
+ "vitest": "^0.34.6",
49
+ "vitest-fetch-mock": "^0.2.2"
49
50
  },
50
51
  "lint-staged": {
51
52
  "*": [