@fnd-platform/cognito-auth 1.0.0-alpha.1 → 1.0.0-alpha.3

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.
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ "use strict";
2
2
  /**
3
3
  * Cognito authentication client for frontend applications.
4
4
  *
@@ -7,11 +7,11 @@
7
7
  *
8
8
  * @packageDocumentation
9
9
  */
10
- Object.defineProperty(exports, '__esModule', { value: true });
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.FndAuthClient = void 0;
12
12
  exports.clearClientCache = clearClientCache;
13
- const client_cognito_identity_provider_1 = require('@aws-sdk/client-cognito-identity-provider');
14
- const errors_js_1 = require('./errors.js');
13
+ const client_cognito_identity_provider_1 = require("@aws-sdk/client-cognito-identity-provider");
14
+ const errors_js_1 = require("./errors.js");
15
15
  /**
16
16
  * Cache for Cognito clients keyed by configuration.
17
17
  */
@@ -20,27 +20,27 @@ const clientCache = new Map();
20
20
  * Generates a cache key for the given configuration.
21
21
  */
22
22
  function getCacheKey(config) {
23
- const region = config.region ?? process.env.AWS_REGION ?? 'us-east-1';
24
- return `${config.userPoolId}:${config.clientId}:${region}`;
23
+ const region = config.region ?? process.env.AWS_REGION ?? 'us-east-1';
24
+ return `${config.userPoolId}:${config.clientId}:${region}`;
25
25
  }
26
26
  /**
27
27
  * Gets or creates a Cognito client for the given configuration.
28
28
  */
29
29
  function getClient(config) {
30
- const key = getCacheKey(config);
31
- let client = clientCache.get(key);
32
- if (!client) {
33
- const region = config.region ?? process.env.AWS_REGION ?? 'us-east-1';
34
- client = new client_cognito_identity_provider_1.CognitoIdentityProviderClient({ region });
35
- clientCache.set(key, client);
36
- }
37
- return client;
30
+ const key = getCacheKey(config);
31
+ let client = clientCache.get(key);
32
+ if (!client) {
33
+ const region = config.region ?? process.env.AWS_REGION ?? 'us-east-1';
34
+ client = new client_cognito_identity_provider_1.CognitoIdentityProviderClient({ region });
35
+ clientCache.set(key, client);
36
+ }
37
+ return client;
38
38
  }
39
39
  /**
40
40
  * Clears the client cache. Useful for testing.
41
41
  */
42
42
  function clearClientCache() {
43
- clientCache.clear();
43
+ clientCache.clear();
44
44
  }
45
45
  /**
46
46
  * Cognito authentication client for frontend applications.
@@ -66,205 +66,326 @@ function clearClientCache() {
66
66
  * ```
67
67
  */
68
68
  class FndAuthClient {
69
- client;
70
- clientId;
71
- /**
72
- * Creates a new FndAuthClient.
73
- *
74
- * @param config - Configuration for the auth client
75
- */
76
- constructor(config) {
77
- this.client = getClient(config);
78
- this.clientId = config.clientId;
79
- }
80
- /**
81
- * Signs in a user with email and password.
82
- *
83
- * @param email - User's email address
84
- * @param password - User's password
85
- * @returns Authentication tokens
86
- * @throws {AuthError} If authentication fails
87
- *
88
- * @example
89
- * ```typescript
90
- * try {
91
- * const tokens = await authClient.signIn('user@example.com', 'password');
92
- * console.log('Logged in!', tokens.accessToken);
93
- * } catch (error) {
94
- * if (error instanceof AuthError && error.code === 'USER_NOT_CONFIRMED') {
95
- * // Redirect to confirmation page
96
- * }
97
- * }
98
- * ```
99
- */
100
- async signIn(email, password) {
101
- try {
102
- const result = await this.client.send(
103
- new client_cognito_identity_provider_1.InitiateAuthCommand({
104
- AuthFlow: client_cognito_identity_provider_1.AuthFlowType.USER_PASSWORD_AUTH,
105
- ClientId: this.clientId,
106
- AuthParameters: {
107
- USERNAME: email,
108
- PASSWORD: password,
109
- },
110
- })
111
- );
112
- if (!result.AuthenticationResult) {
113
- throw new Error('Authentication failed - no result returned');
114
- }
115
- const { AccessToken, IdToken, RefreshToken, ExpiresIn } = result.AuthenticationResult;
116
- if (!AccessToken || !IdToken || !RefreshToken) {
117
- throw new Error('Authentication failed - missing tokens');
118
- }
119
- return {
120
- accessToken: AccessToken,
121
- idToken: IdToken,
122
- refreshToken: RefreshToken,
123
- expiresIn: ExpiresIn ?? 3600,
124
- };
125
- } catch (error) {
126
- throw (0, errors_js_1.mapCognitoError)(error, 'Sign in failed');
69
+ client;
70
+ clientId;
71
+ /**
72
+ * Creates a new FndAuthClient.
73
+ *
74
+ * @param config - Configuration for the auth client
75
+ */
76
+ constructor(config) {
77
+ this.client = getClient(config);
78
+ this.clientId = config.clientId;
127
79
  }
128
- }
129
- /**
130
- * Signs up a new user.
131
- *
132
- * @param email - User's email address
133
- * @param password - User's password
134
- * @param name - Optional user's name
135
- * @returns Sign-up result with confirmation status
136
- * @throws {AuthError} If sign-up fails
137
- *
138
- * @example
139
- * ```typescript
140
- * const result = await authClient.signUp('user@example.com', 'password', 'John Doe');
141
- * if (!result.userConfirmed) {
142
- * // Show confirmation code input
143
- * console.log(`Code sent to ${result.codeDeliveryDetails?.destination}`);
144
- * }
145
- * ```
146
- */
147
- async signUp(email, password, name) {
148
- try {
149
- const userAttributes = [{ Name: 'email', Value: email }];
150
- if (name) {
151
- userAttributes.push({ Name: 'name', Value: name });
152
- }
153
- const result = await this.client.send(
154
- new client_cognito_identity_provider_1.SignUpCommand({
155
- ClientId: this.clientId,
156
- Username: email,
157
- Password: password,
158
- UserAttributes: userAttributes,
159
- })
160
- );
161
- return {
162
- userConfirmed: result.UserConfirmed ?? false,
163
- codeDeliveryDetails: result.CodeDeliveryDetails
164
- ? {
165
- destination: result.CodeDeliveryDetails.Destination,
166
- deliveryMedium: result.CodeDeliveryDetails.DeliveryMedium,
80
+ /**
81
+ * Signs in a user with email and password.
82
+ *
83
+ * @param email - User's email address
84
+ * @param password - User's password
85
+ * @returns Authentication tokens
86
+ * @throws {AuthError} If authentication fails
87
+ * @throws {NewPasswordRequiredError} If user must change password first
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * try {
92
+ * const tokens = await authClient.signIn('user@example.com', 'password');
93
+ * console.log('Logged in!', tokens.accessToken);
94
+ * } catch (error) {
95
+ * if (error instanceof NewPasswordRequiredError) {
96
+ * // Redirect to change password page
97
+ * redirect(`/change-password?session=${error.session}&email=${email}`);
98
+ * } else if (error instanceof AuthError && error.code === 'USER_NOT_CONFIRMED') {
99
+ * // Redirect to confirmation page
100
+ * }
101
+ * }
102
+ * ```
103
+ */
104
+ async signIn(email, password) {
105
+ try {
106
+ const result = await this.client.send(new client_cognito_identity_provider_1.InitiateAuthCommand({
107
+ AuthFlow: client_cognito_identity_provider_1.AuthFlowType.USER_PASSWORD_AUTH,
108
+ ClientId: this.clientId,
109
+ AuthParameters: {
110
+ USERNAME: email,
111
+ PASSWORD: password,
112
+ },
113
+ }));
114
+ // Check if a challenge is required (e.g., NEW_PASSWORD_REQUIRED)
115
+ if (result.ChallengeName === client_cognito_identity_provider_1.ChallengeNameType.NEW_PASSWORD_REQUIRED) {
116
+ if (!result.Session) {
117
+ throw new Error('Challenge returned without session');
118
+ }
119
+ throw new errors_js_1.NewPasswordRequiredError(result.Session, email);
120
+ }
121
+ if (!result.AuthenticationResult) {
122
+ throw new Error('Authentication failed - no result returned');
167
123
  }
168
- : undefined,
169
- };
170
- } catch (error) {
171
- throw (0, errors_js_1.mapCognitoError)(error, 'Sign up failed');
124
+ const { AccessToken, IdToken, RefreshToken, ExpiresIn } = result.AuthenticationResult;
125
+ if (!AccessToken || !IdToken || !RefreshToken) {
126
+ throw new Error('Authentication failed - missing tokens');
127
+ }
128
+ return {
129
+ accessToken: AccessToken,
130
+ idToken: IdToken,
131
+ refreshToken: RefreshToken,
132
+ expiresIn: ExpiresIn ?? 3600,
133
+ };
134
+ }
135
+ catch (error) {
136
+ // Re-throw NewPasswordRequiredError without wrapping
137
+ if (error instanceof errors_js_1.NewPasswordRequiredError) {
138
+ throw error;
139
+ }
140
+ throw (0, errors_js_1.mapCognitoError)(error, 'Sign in failed');
141
+ }
172
142
  }
173
- }
174
- /**
175
- * Confirms a user's sign-up with the verification code.
176
- *
177
- * @param email - User's email address
178
- * @param code - Verification code from email/SMS
179
- * @throws {AuthError} If confirmation fails
180
- *
181
- * @example
182
- * ```typescript
183
- * await authClient.confirmSignUp('user@example.com', '123456');
184
- * // User is now confirmed, can sign in
185
- * ```
186
- */
187
- async confirmSignUp(email, code) {
188
- try {
189
- await this.client.send(
190
- new client_cognito_identity_provider_1.ConfirmSignUpCommand({
191
- ClientId: this.clientId,
192
- Username: email,
193
- ConfirmationCode: code,
194
- })
195
- );
196
- } catch (error) {
197
- throw (0, errors_js_1.mapCognitoError)(error, 'Confirmation failed');
143
+ /**
144
+ * Completes password change for users with FORCE_CHANGE_PASSWORD status.
145
+ *
146
+ * Use this after catching NewPasswordRequiredError from signIn().
147
+ *
148
+ * @param email - User's email address
149
+ * @param newPassword - New password to set
150
+ * @param session - Session token from NewPasswordRequiredError
151
+ * @returns Authentication tokens
152
+ * @throws {AuthError} If password change fails
153
+ *
154
+ * @example
155
+ * ```typescript
156
+ * // After catching NewPasswordRequiredError
157
+ * const tokens = await authClient.completeNewPassword(
158
+ * email,
159
+ * newPassword,
160
+ * error.session
161
+ * );
162
+ * ```
163
+ */
164
+ async completeNewPassword(email, newPassword, session) {
165
+ try {
166
+ const result = await this.client.send(new client_cognito_identity_provider_1.RespondToAuthChallengeCommand({
167
+ ClientId: this.clientId,
168
+ ChallengeName: client_cognito_identity_provider_1.ChallengeNameType.NEW_PASSWORD_REQUIRED,
169
+ Session: session,
170
+ ChallengeResponses: {
171
+ USERNAME: email,
172
+ NEW_PASSWORD: newPassword,
173
+ },
174
+ }));
175
+ if (!result.AuthenticationResult) {
176
+ throw new Error('Password change failed - no result returned');
177
+ }
178
+ const { AccessToken, IdToken, RefreshToken, ExpiresIn } = result.AuthenticationResult;
179
+ if (!AccessToken || !IdToken || !RefreshToken) {
180
+ throw new Error('Password change failed - missing tokens');
181
+ }
182
+ return {
183
+ accessToken: AccessToken,
184
+ idToken: IdToken,
185
+ refreshToken: RefreshToken,
186
+ expiresIn: ExpiresIn ?? 3600,
187
+ };
188
+ }
189
+ catch (error) {
190
+ throw (0, errors_js_1.mapCognitoError)(error, 'Password change failed');
191
+ }
198
192
  }
199
- }
200
- /**
201
- * Refreshes authentication tokens using a refresh token.
202
- *
203
- * @param refreshToken - The refresh token from a previous authentication
204
- * @returns New authentication tokens
205
- * @throws {AuthError} If refresh fails
206
- *
207
- * @example
208
- * ```typescript
209
- * // When access token is about to expire
210
- * const newTokens = await authClient.refreshTokens(tokens.refreshToken);
211
- * ```
212
- */
213
- async refreshTokens(refreshToken) {
214
- try {
215
- const result = await this.client.send(
216
- new client_cognito_identity_provider_1.InitiateAuthCommand({
217
- AuthFlow: client_cognito_identity_provider_1.AuthFlowType.REFRESH_TOKEN_AUTH,
218
- ClientId: this.clientId,
219
- AuthParameters: {
220
- REFRESH_TOKEN: refreshToken,
221
- },
222
- })
223
- );
224
- if (!result.AuthenticationResult) {
225
- throw new Error('Token refresh failed - no result returned');
226
- }
227
- const { AccessToken, IdToken, ExpiresIn } = result.AuthenticationResult;
228
- if (!AccessToken || !IdToken) {
229
- throw new Error('Token refresh failed - missing tokens');
230
- }
231
- return {
232
- accessToken: AccessToken,
233
- idToken: IdToken,
234
- // Refresh token doesn't change on refresh
235
- refreshToken: refreshToken,
236
- expiresIn: ExpiresIn ?? 3600,
237
- };
238
- } catch (error) {
239
- throw (0, errors_js_1.mapCognitoError)(error, 'Token refresh failed');
193
+ /**
194
+ * Initiates forgot password flow.
195
+ *
196
+ * Sends a verification code to the user's email for password reset.
197
+ *
198
+ * @param email - User's email address
199
+ * @returns Delivery details for the reset code
200
+ * @throws {AuthError} If request fails
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const result = await authClient.forgotPassword('user@example.com');
205
+ * console.log(`Code sent to ${result.codeDeliveryDetails?.destination}`);
206
+ * ```
207
+ */
208
+ async forgotPassword(email) {
209
+ try {
210
+ const result = await this.client.send(new client_cognito_identity_provider_1.ForgotPasswordCommand({
211
+ ClientId: this.clientId,
212
+ Username: email,
213
+ }));
214
+ return {
215
+ codeDeliveryDetails: result.CodeDeliveryDetails
216
+ ? {
217
+ destination: result.CodeDeliveryDetails.Destination,
218
+ deliveryMedium: result.CodeDeliveryDetails.DeliveryMedium,
219
+ }
220
+ : undefined,
221
+ };
222
+ }
223
+ catch (error) {
224
+ throw (0, errors_js_1.mapCognitoError)(error, 'Forgot password request failed');
225
+ }
226
+ }
227
+ /**
228
+ * Completes forgot password flow with verification code.
229
+ *
230
+ * @param email - User's email address
231
+ * @param code - Verification code from email
232
+ * @param newPassword - New password to set
233
+ * @throws {AuthError} If password reset fails
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * await authClient.confirmForgotPassword('user@example.com', '123456', 'NewP@ssw0rd');
238
+ * // User can now sign in with new password
239
+ * ```
240
+ */
241
+ async confirmForgotPassword(email, code, newPassword) {
242
+ try {
243
+ await this.client.send(new client_cognito_identity_provider_1.ConfirmForgotPasswordCommand({
244
+ ClientId: this.clientId,
245
+ Username: email,
246
+ ConfirmationCode: code,
247
+ Password: newPassword,
248
+ }));
249
+ }
250
+ catch (error) {
251
+ throw (0, errors_js_1.mapCognitoError)(error, 'Password reset failed');
252
+ }
253
+ }
254
+ /**
255
+ * Signs up a new user.
256
+ *
257
+ * @param email - User's email address
258
+ * @param password - User's password
259
+ * @param name - Optional user's name
260
+ * @returns Sign-up result with confirmation status
261
+ * @throws {AuthError} If sign-up fails
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * const result = await authClient.signUp('user@example.com', 'password', 'John Doe');
266
+ * if (!result.userConfirmed) {
267
+ * // Show confirmation code input
268
+ * console.log(`Code sent to ${result.codeDeliveryDetails?.destination}`);
269
+ * }
270
+ * ```
271
+ */
272
+ async signUp(email, password, name) {
273
+ try {
274
+ const userAttributes = [{ Name: 'email', Value: email }];
275
+ if (name) {
276
+ userAttributes.push({ Name: 'name', Value: name });
277
+ }
278
+ const result = await this.client.send(new client_cognito_identity_provider_1.SignUpCommand({
279
+ ClientId: this.clientId,
280
+ Username: email,
281
+ Password: password,
282
+ UserAttributes: userAttributes,
283
+ }));
284
+ return {
285
+ userConfirmed: result.UserConfirmed ?? false,
286
+ codeDeliveryDetails: result.CodeDeliveryDetails
287
+ ? {
288
+ destination: result.CodeDeliveryDetails.Destination,
289
+ deliveryMedium: result.CodeDeliveryDetails.DeliveryMedium,
290
+ }
291
+ : undefined,
292
+ };
293
+ }
294
+ catch (error) {
295
+ throw (0, errors_js_1.mapCognitoError)(error, 'Sign up failed');
296
+ }
297
+ }
298
+ /**
299
+ * Confirms a user's sign-up with the verification code.
300
+ *
301
+ * @param email - User's email address
302
+ * @param code - Verification code from email/SMS
303
+ * @throws {AuthError} If confirmation fails
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * await authClient.confirmSignUp('user@example.com', '123456');
308
+ * // User is now confirmed, can sign in
309
+ * ```
310
+ */
311
+ async confirmSignUp(email, code) {
312
+ try {
313
+ await this.client.send(new client_cognito_identity_provider_1.ConfirmSignUpCommand({
314
+ ClientId: this.clientId,
315
+ Username: email,
316
+ ConfirmationCode: code,
317
+ }));
318
+ }
319
+ catch (error) {
320
+ throw (0, errors_js_1.mapCognitoError)(error, 'Confirmation failed');
321
+ }
322
+ }
323
+ /**
324
+ * Refreshes authentication tokens using a refresh token.
325
+ *
326
+ * @param refreshToken - The refresh token from a previous authentication
327
+ * @returns New authentication tokens
328
+ * @throws {AuthError} If refresh fails
329
+ *
330
+ * @example
331
+ * ```typescript
332
+ * // When access token is about to expire
333
+ * const newTokens = await authClient.refreshTokens(tokens.refreshToken);
334
+ * ```
335
+ */
336
+ async refreshTokens(refreshToken) {
337
+ try {
338
+ const result = await this.client.send(new client_cognito_identity_provider_1.InitiateAuthCommand({
339
+ AuthFlow: client_cognito_identity_provider_1.AuthFlowType.REFRESH_TOKEN_AUTH,
340
+ ClientId: this.clientId,
341
+ AuthParameters: {
342
+ REFRESH_TOKEN: refreshToken,
343
+ },
344
+ }));
345
+ if (!result.AuthenticationResult) {
346
+ throw new Error('Token refresh failed - no result returned');
347
+ }
348
+ const { AccessToken, IdToken, ExpiresIn } = result.AuthenticationResult;
349
+ if (!AccessToken || !IdToken) {
350
+ throw new Error('Token refresh failed - missing tokens');
351
+ }
352
+ return {
353
+ accessToken: AccessToken,
354
+ idToken: IdToken,
355
+ // Refresh token doesn't change on refresh
356
+ refreshToken: refreshToken,
357
+ expiresIn: ExpiresIn ?? 3600,
358
+ };
359
+ }
360
+ catch (error) {
361
+ throw (0, errors_js_1.mapCognitoError)(error, 'Token refresh failed');
362
+ }
240
363
  }
241
- }
242
- /**
243
- * Signs out the user from all devices.
244
- *
245
- * This invalidates all refresh tokens for the user, effectively
246
- * signing them out from all devices.
247
- *
248
- * @param accessToken - The user's current access token
249
- * @throws {AuthError} If sign-out fails
250
- *
251
- * @example
252
- * ```typescript
253
- * await authClient.signOut(tokens.accessToken);
254
- * // User is now signed out from all devices
255
- * ```
256
- */
257
- async signOut(accessToken) {
258
- try {
259
- await this.client.send(
260
- new client_cognito_identity_provider_1.GlobalSignOutCommand({
261
- AccessToken: accessToken,
262
- })
263
- );
264
- } catch (error) {
265
- throw (0, errors_js_1.mapCognitoError)(error, 'Sign out failed');
364
+ /**
365
+ * Signs out the user from all devices.
366
+ *
367
+ * This invalidates all refresh tokens for the user, effectively
368
+ * signing them out from all devices.
369
+ *
370
+ * @param accessToken - The user's current access token
371
+ * @throws {AuthError} If sign-out fails
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * await authClient.signOut(tokens.accessToken);
376
+ * // User is now signed out from all devices
377
+ * ```
378
+ */
379
+ async signOut(accessToken) {
380
+ try {
381
+ await this.client.send(new client_cognito_identity_provider_1.GlobalSignOutCommand({
382
+ AccessToken: accessToken,
383
+ }));
384
+ }
385
+ catch (error) {
386
+ throw (0, errors_js_1.mapCognitoError)(error, 'Sign out failed');
387
+ }
266
388
  }
267
- }
268
389
  }
269
390
  exports.FndAuthClient = FndAuthClient;
270
- //# sourceMappingURL=auth-client.js.map
391
+ //# sourceMappingURL=auth-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-client.js","sourceRoot":"","sources":["../../src/client/auth-client.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA2CH,4CAEC;AA3CD,gGAOm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