@venturekit/auth 0.0.34 → 0.0.36

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.
@@ -6,29 +6,38 @@
6
6
  * for any `ChallengeName` Cognito returns — fine for service-style
7
7
  * authentication where the token triplet is the only acceptable
8
8
  * outcome. {@link signInWithPasswordOrChallenge} relaxes that for
9
- * apps that need to drive the **first-login `NEW_PASSWORD_REQUIRED`
10
- * flow**: an admin invites a user with `AdminCreateUser`, the user
11
- * lands in `FORCE_CHANGE_PASSWORD`, and their first sign-in attempt
12
- * must echo a fresh permanent password back through
13
- * `RespondToAuthChallenge` before tokens are issued.
9
+ * apps whose UI drives the challenges a user has to complete before
10
+ * tokens are issued:
14
11
  *
15
- * Other challenges (MFA, software-token setup, …) still throw — V0
16
- * Cognito User Pools created by VentureKit's CDK stack ship with MFA
17
- * disabled, so any chained challenge is a config drift the operator
18
- * should investigate rather than silently route around.
12
+ * - `NEW_PASSWORD_REQUIRED` — an admin invited the user
13
+ * (`AdminCreateUser`), they land in `FORCE_CHANGE_PASSWORD`, and
14
+ * their first sign-in must echo a permanent password back through
15
+ * {@link respondToNewPasswordChallenge}.
16
+ * - `SOFTWARE_TOKEN_MFA` — the user has a TOTP authenticator
17
+ * enrolled (pool MFA `optional` with the user's preference set, or
18
+ * `required`); the code goes back through `respondToSoftwareTokenMfa`
19
+ * (`mfa.ts`).
20
+ * - `MFA_SETUP` — the pool requires MFA and the user has no
21
+ * authenticator yet; `beginTotpSetup` / `confirmTotpSetup` /
22
+ * `completeMfaSetupChallenge` (`mfa.ts`) enrol one on the session.
23
+ *
24
+ * Anything else (`SMS_MFA`, `CUSTOM_CHALLENGE`, …) still throws
25
+ * `auth_challenge_required`: no VentureKit flow drives it, so a pool
26
+ * returning it is a configuration drift for the operator to look at
27
+ * rather than something to route around silently.
19
28
  */
20
29
  import type { AuthServerConfig } from './config.js';
21
- import { type SignInResult } from './tokens.js';
30
+ import { extractSignInTokens, type SignInResult } from './tokens.js';
22
31
  import type { SignInCredentials } from './sign-in.js';
32
+ /** The challenges a consumer's UI can drive. Extend one at a time, together with the flow that completes it. */
33
+ export type SignInChallengeName = 'NEW_PASSWORD_REQUIRED' | 'SOFTWARE_TOKEN_MFA' | 'MFA_SETUP';
23
34
  /**
24
35
  * Challenge envelope surfaced to the caller when Cognito withholds
25
- * tokens until the user completes a step. The discriminator stays
26
- * narrow on purpose — additional challenge names should be added
27
- * one-by-one as the consumer's UI grows to handle them.
36
+ * tokens until the user completes a step.
28
37
  */
29
38
  export interface SignInChallenge {
30
- challenge: 'NEW_PASSWORD_REQUIRED';
31
- /** Opaque session token to pass back to {@link respondToNewPasswordChallenge}. */
39
+ challenge: SignInChallengeName;
40
+ /** Opaque session token to pass back to the flow that completes this challenge. */
32
41
  session: string;
33
42
  /** Echo of the username that triggered the challenge. */
34
43
  username: string;
@@ -41,16 +50,28 @@ export type SignInOrChallengeResult = {
41
50
  challenge: SignInChallenge;
42
51
  };
43
52
  /**
44
- * Sign-in path that surfaces the `NEW_PASSWORD_REQUIRED` challenge
45
- * Cognito raises for admin-invited users on their first attempt.
53
+ * Turn a Cognito auth response into tokens or a surfaced challenge.
54
+ * Shared by every flow that may end in either — the initial sign-in
55
+ * and each `RespondToAuthChallenge` that Cognito can chain another
56
+ * challenge onto (a new password followed by MFA, a TOTP enrolment
57
+ * followed by the code).
46
58
  *
47
- * Returns either the issued tokens (happy path) or a structured
48
- * challenge envelope the calling route can forward to the SPA so the
49
- * user can pick a permanent password through
50
- * {@link respondToNewPasswordChallenge}.
59
+ * @internal
60
+ */
61
+ export declare function resolveChallengeResponse(res: {
62
+ ChallengeName?: string;
63
+ Session?: string;
64
+ AuthenticationResult?: Parameters<typeof extractSignInTokens>[0];
65
+ }, username: string, unsupportedCode: 'auth_challenge_required' | 'unsupported_challenge'): SignInOrChallengeResult;
66
+ /**
67
+ * Sign-in path that surfaces the challenges a UI can drive
68
+ * (`NEW_PASSWORD_REQUIRED`, `SOFTWARE_TOKEN_MFA`, `MFA_SETUP`) instead
69
+ * of throwing on them.
51
70
  *
52
- * Other challenges (MFA, etc.) still surface as
53
- * `auth_challenge_required` errors — see file header for rationale.
71
+ * Returns either the issued tokens (happy path) or a structured
72
+ * challenge envelope the calling route can forward to the SPA. Other
73
+ * challenges still surface as `auth_challenge_required` errors — see
74
+ * the file header for rationale.
54
75
  */
55
76
  export declare function signInWithPasswordOrChallenge(credentials: SignInCredentials, config?: AuthServerConfig): Promise<SignInOrChallengeResult>;
56
77
  export interface RespondNewPasswordInput {
@@ -61,14 +82,24 @@ export interface RespondNewPasswordInput {
61
82
  /** Opaque session token returned by `signInWithPasswordOrChallenge`. */
62
83
  session: string;
63
84
  }
85
+ /**
86
+ * Complete a `NEW_PASSWORD_REQUIRED` challenge with a permanent
87
+ * password, surfacing whatever Cognito asks for next. On a pool with
88
+ * MFA, the new password is typically followed by `SOFTWARE_TOKEN_MFA`
89
+ * (an enrolled user) or `MFA_SETUP` (a user who has yet to enrol) —
90
+ * the same envelope `signInWithPasswordOrChallenge` returns, so a
91
+ * UI handles it with the same code.
92
+ */
93
+ export declare function completeNewPasswordChallenge(input: RespondNewPasswordInput, config?: AuthServerConfig): Promise<SignInOrChallengeResult>;
64
94
  /**
65
95
  * Complete a `NEW_PASSWORD_REQUIRED` challenge with a permanent
66
96
  * password. Returns the issued tokens — the user is now logged in
67
97
  * and the temporary password is dead.
68
98
  *
69
- * A chained challenge in the response (e.g. MFA) surfaces as a
70
- * `unsupported_challenge` (HTTP 400) AuthError so an operator can
71
- * fix the misconfiguration rather than silently lose the user.
99
+ * Any chained challenge (MFA) surfaces as an `unsupported_challenge`
100
+ * (HTTP 400) AuthError: this is the flow for pools without MFA, kept
101
+ * for consumers that only ever expect tokens. A consumer whose pool
102
+ * has MFA uses {@link completeNewPasswordChallenge}.
72
103
  */
73
104
  export declare function respondToNewPasswordChallenge(input: RespondNewPasswordInput, config?: AuthServerConfig): Promise<SignInResult>;
74
105
  //# sourceMappingURL=challenge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/server/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,uBAAuB,CAAC;IACnC,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,WAAW,EAAE,iBAAiB,EAC9B,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,uBAAuB,CAAC,CA0ClC;AAED,MAAM,WAAW,uBAAuB;IACtC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,uBAAuB,EAC9B,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,YAAY,CAAC,CA2BvB"}
1
+ {"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/server/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,OA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;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,uBAAuB,EAC9B,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,uBAAuB,CAAC,CAoBlC;AAED;;;;;;;;;GASG;AACH,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,uBAAuB,EAC9B,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,YAAY,CAAC,CAUvB"}
@@ -6,33 +6,72 @@
6
6
  * for any `ChallengeName` Cognito returns — fine for service-style
7
7
  * authentication where the token triplet is the only acceptable
8
8
  * outcome. {@link signInWithPasswordOrChallenge} relaxes that for
9
- * apps that need to drive the **first-login `NEW_PASSWORD_REQUIRED`
10
- * flow**: an admin invites a user with `AdminCreateUser`, the user
11
- * lands in `FORCE_CHANGE_PASSWORD`, and their first sign-in attempt
12
- * must echo a fresh permanent password back through
13
- * `RespondToAuthChallenge` before tokens are issued.
9
+ * apps whose UI drives the challenges a user has to complete before
10
+ * tokens are issued:
14
11
  *
15
- * Other challenges (MFA, software-token setup, …) still throw — V0
16
- * Cognito User Pools created by VentureKit's CDK stack ship with MFA
17
- * disabled, so any chained challenge is a config drift the operator
18
- * should investigate rather than silently route around.
12
+ * - `NEW_PASSWORD_REQUIRED` — an admin invited the user
13
+ * (`AdminCreateUser`), they land in `FORCE_CHANGE_PASSWORD`, and
14
+ * their first sign-in must echo a permanent password back through
15
+ * {@link respondToNewPasswordChallenge}.
16
+ * - `SOFTWARE_TOKEN_MFA` — the user has a TOTP authenticator
17
+ * enrolled (pool MFA `optional` with the user's preference set, or
18
+ * `required`); the code goes back through `respondToSoftwareTokenMfa`
19
+ * (`mfa.ts`).
20
+ * - `MFA_SETUP` — the pool requires MFA and the user has no
21
+ * authenticator yet; `beginTotpSetup` / `confirmTotpSetup` /
22
+ * `completeMfaSetupChallenge` (`mfa.ts`) enrol one on the session.
23
+ *
24
+ * Anything else (`SMS_MFA`, `CUSTOM_CHALLENGE`, …) still throws
25
+ * `auth_challenge_required`: no VentureKit flow drives it, so a pool
26
+ * returning it is a configuration drift for the operator to look at
27
+ * rather than something to route around silently.
19
28
  */
20
29
  import { ChallengeNameType, InitiateAuthCommand, RespondToAuthChallengeCommand, } from '@aws-sdk/client-cognito-identity-provider';
21
30
  import { loadAuthServerConfig } from './config.js';
22
31
  import { getCognitoClient } from './cognito-client.js';
23
32
  import { AuthError, mapProviderError } from './errors.js';
24
33
  import { extractSignInTokens } from './tokens.js';
34
+ const SURFACED_CHALLENGES = new Set([
35
+ 'NEW_PASSWORD_REQUIRED',
36
+ 'SOFTWARE_TOKEN_MFA',
37
+ 'MFA_SETUP',
38
+ ]);
25
39
  /**
26
- * Sign-in path that surfaces the `NEW_PASSWORD_REQUIRED` challenge
27
- * Cognito raises for admin-invited users on their first attempt.
40
+ * Turn a Cognito auth response into tokens or a surfaced challenge.
41
+ * Shared by every flow that may end in either — the initial sign-in
42
+ * and each `RespondToAuthChallenge` that Cognito can chain another
43
+ * challenge onto (a new password followed by MFA, a TOTP enrolment
44
+ * followed by the code).
28
45
  *
29
- * Returns either the issued tokens (happy path) or a structured
30
- * challenge envelope the calling route can forward to the SPA so the
31
- * user can pick a permanent password through
32
- * {@link respondToNewPasswordChallenge}.
46
+ * @internal
47
+ */
48
+ export function resolveChallengeResponse(res, username, unsupportedCode) {
49
+ if (res.ChallengeName) {
50
+ if (SURFACED_CHALLENGES.has(res.ChallengeName) && res.Session) {
51
+ return {
52
+ kind: 'challenge',
53
+ challenge: {
54
+ challenge: res.ChallengeName,
55
+ session: res.Session,
56
+ username,
57
+ },
58
+ };
59
+ }
60
+ throw new AuthError(unsupportedCode, unsupportedCode === 'auth_challenge_required'
61
+ ? `Identity provider requires challenge: ${res.ChallengeName}.`
62
+ : `Unsupported chained challenge: ${res.ChallengeName}`, 400);
63
+ }
64
+ return { kind: 'tokens', tokens: extractSignInTokens(res.AuthenticationResult) };
65
+ }
66
+ /**
67
+ * Sign-in path that surfaces the challenges a UI can drive
68
+ * (`NEW_PASSWORD_REQUIRED`, `SOFTWARE_TOKEN_MFA`, `MFA_SETUP`) instead
69
+ * of throwing on them.
33
70
  *
34
- * Other challenges (MFA, etc.) still surface as
35
- * `auth_challenge_required` errors — see file header for rationale.
71
+ * Returns either the issued tokens (happy path) or a structured
72
+ * challenge envelope the calling route can forward to the SPA. Other
73
+ * challenges still surface as `auth_challenge_required` errors — see
74
+ * the file header for rationale.
36
75
  */
37
76
  export async function signInWithPasswordOrChallenge(credentials, config = loadAuthServerConfig()) {
38
77
  const client = getCognitoClient(config.region, config.endpoint);
@@ -46,24 +85,7 @@ export async function signInWithPasswordOrChallenge(credentials, config = loadAu
46
85
  PASSWORD: credentials.password,
47
86
  },
48
87
  }));
49
- if (res.ChallengeName === ChallengeNameType.NEW_PASSWORD_REQUIRED &&
50
- res.Session) {
51
- return {
52
- kind: 'challenge',
53
- challenge: {
54
- challenge: 'NEW_PASSWORD_REQUIRED',
55
- session: res.Session,
56
- username,
57
- },
58
- };
59
- }
60
- if (res.ChallengeName) {
61
- throw new AuthError('auth_challenge_required', `Identity provider requires challenge: ${res.ChallengeName}.`, 400);
62
- }
63
- return {
64
- kind: 'tokens',
65
- tokens: extractSignInTokens(res.AuthenticationResult),
66
- };
88
+ return resolveChallengeResponse(res, username, 'auth_challenge_required');
67
89
  }
68
90
  catch (err) {
69
91
  if (err instanceof AuthError)
@@ -73,14 +95,13 @@ export async function signInWithPasswordOrChallenge(credentials, config = loadAu
73
95
  }
74
96
  /**
75
97
  * Complete a `NEW_PASSWORD_REQUIRED` challenge with a permanent
76
- * password. Returns the issued tokens — the user is now logged in
77
- * and the temporary password is dead.
78
- *
79
- * A chained challenge in the response (e.g. MFA) surfaces as a
80
- * `unsupported_challenge` (HTTP 400) AuthError so an operator can
81
- * fix the misconfiguration rather than silently lose the user.
98
+ * password, surfacing whatever Cognito asks for next. On a pool with
99
+ * MFA, the new password is typically followed by `SOFTWARE_TOKEN_MFA`
100
+ * (an enrolled user) or `MFA_SETUP` (a user who has yet to enrol) —
101
+ * the same envelope `signInWithPasswordOrChallenge` returns, so a
102
+ * UI handles it with the same code.
82
103
  */
83
- export async function respondToNewPasswordChallenge(input, config = loadAuthServerConfig()) {
104
+ export async function completeNewPasswordChallenge(input, config = loadAuthServerConfig()) {
84
105
  const client = getCognitoClient(config.region, config.endpoint);
85
106
  const username = input.username.toLowerCase();
86
107
  try {
@@ -93,10 +114,7 @@ export async function respondToNewPasswordChallenge(input, config = loadAuthServ
93
114
  NEW_PASSWORD: input.newPassword,
94
115
  },
95
116
  }));
96
- if (res.ChallengeName) {
97
- throw new AuthError('unsupported_challenge', `Unsupported chained challenge: ${res.ChallengeName}`, 400);
98
- }
99
- return extractSignInTokens(res.AuthenticationResult);
117
+ return resolveChallengeResponse(res, username, 'unsupported_challenge');
100
118
  }
101
119
  catch (err) {
102
120
  if (err instanceof AuthError)
@@ -104,4 +122,21 @@ export async function respondToNewPasswordChallenge(input, config = loadAuthServ
104
122
  throw mapProviderError(err, 'sign_in_challenge_failed');
105
123
  }
106
124
  }
125
+ /**
126
+ * Complete a `NEW_PASSWORD_REQUIRED` challenge with a permanent
127
+ * password. Returns the issued tokens — the user is now logged in
128
+ * and the temporary password is dead.
129
+ *
130
+ * Any chained challenge (MFA) surfaces as an `unsupported_challenge`
131
+ * (HTTP 400) AuthError: this is the flow for pools without MFA, kept
132
+ * for consumers that only ever expect tokens. A consumer whose pool
133
+ * has MFA uses {@link completeNewPasswordChallenge}.
134
+ */
135
+ export async function respondToNewPasswordChallenge(input, config = loadAuthServerConfig()) {
136
+ const out = await completeNewPasswordChallenge(input, config);
137
+ if (out.kind === 'challenge') {
138
+ throw new AuthError('unsupported_challenge', `Unsupported chained challenge: ${out.challenge.challenge}`, 400);
139
+ }
140
+ return out.tokens;
141
+ }
107
142
  //# sourceMappingURL=challenge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"challenge.js","sourceRoot":"","sources":["../../src/server/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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AAC,WAAW;YAC5B,aAAa,EAAE,iBAAiB,CAAC,qBAAqB;YACtD,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,kBAAkB,EAAE;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,YAAY,EAAE,KAAK,CAAC,WAAW;aAChC;SACF,CAAC,CACH,CAAC;QACF,OAAO,wBAAwB,CAAC,GAAG,EAAE,QAAQ,EAAE,uBAAuB,CAAC,CAAC;IAC1E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,SAAS;YAAE,MAAM,GAAG,CAAC;QACxC,MAAM,gBAAgB,CAAC,GAAG,EAAE,0BAA0B,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,KAA8B,EAC9B,SAA2B,oBAAoB,EAAE;IAEjD,MAAM,GAAG,GAAG,MAAM,4BAA4B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CACjB,uBAAuB,EACvB,kCAAkC,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,EAC3D,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC"}
@@ -26,8 +26,10 @@ export type { AuthServerConfig, LoadAuthServerConfigOptions } from './config.js'
26
26
  export { loadAuthServerConfig, authIntentEnvPrefix } from './config.js';
27
27
  export type { SignInCredentials, SignInResult } from './sign-in.js';
28
28
  export { signInWithPassword } from './sign-in.js';
29
- export type { SignInChallenge, SignInOrChallengeResult, RespondNewPasswordInput, } from './challenge.js';
30
- export { signInWithPasswordOrChallenge, respondToNewPasswordChallenge, } from './challenge.js';
29
+ export type { SignInChallenge, SignInChallengeName, SignInOrChallengeResult, RespondNewPasswordInput, } from './challenge.js';
30
+ export { signInWithPasswordOrChallenge, completeNewPasswordChallenge, respondToNewPasswordChallenge, } from './challenge.js';
31
+ export type { TotpSetup, MfaStatus, BeginTotpSetupInput, BeginTotpSetupForChallengeInput, ConfirmTotpSetupInput, SetTotpPreferenceInput, RespondSoftwareTokenMfaInput, CompleteMfaSetupInput, AdminGetMfaStatusInput, AdminSetTotpPreferenceInput, OtpauthUriInput, } from './mfa.js';
32
+ export { beginTotpSetup, beginTotpSetupForChallenge, confirmTotpSetup, setTotpPreference, respondToSoftwareTokenMfa, completeMfaSetupChallenge, adminGetMfaStatus, adminSetTotpPreference, otpauthUri, } from './mfa.js';
31
33
  export type { SignUpInput, SignUpResult } from './sign-up.js';
32
34
  export { signUpUser } from './sign-up.js';
33
35
  export type { AdminInviteUserInput, AdminInviteUserResult, AdminUpdateAttributesInput, } from './admin-users.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAExE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,YAAY,EACV,eAAe,EACf,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,YAAY,EACV,oBAAoB,EACpB,qBAAqB,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CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,EAC5B,0BAA0B,EAC1B,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gCAAgC,EAChC,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mCAAmC,GACpC,MAAM,mBAAmB,CAAC"}
@@ -24,7 +24,8 @@
24
24
  export { AuthError, mapProviderError } from './errors.js';
25
25
  export { loadAuthServerConfig, authIntentEnvPrefix } from './config.js';
26
26
  export { signInWithPassword } from './sign-in.js';
27
- export { signInWithPasswordOrChallenge, respondToNewPasswordChallenge, } from './challenge.js';
27
+ export { signInWithPasswordOrChallenge, completeNewPasswordChallenge, respondToNewPasswordChallenge, } from './challenge.js';
28
+ export { beginTotpSetup, beginTotpSetupForChallenge, confirmTotpSetup, setTotpPreference, respondToSoftwareTokenMfa, completeMfaSetupChallenge, adminGetMfaStatus, adminSetTotpPreference, otpauthUri, } from './mfa.js';
28
29
  export { signUpUser } from './sign-up.js';
29
30
  export { adminInviteUser, adminUpdateUserAttributes, adminDisableUser, adminEnableUser, adminDeleteUser, } from './admin-users.js';
30
31
  export { refreshSession } from './refresh.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAShE,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQtD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhE,kEAAkE;AAClE,uEAAuE;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAQnD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EAC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AO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mCAAmC,GACpC,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * TOTP multi-factor authentication: enrolling an authenticator, and
3
+ * answering the code at sign-in.
4
+ *
5
+ * Cognito calls this a "software token". The factor is a shared secret
6
+ * the user scans into an authenticator app (Google Authenticator, 1Password,
7
+ * Aegis…), which then derives a six-digit code from it every 30 seconds
8
+ * (RFC 6238). Two things make it worth choosing over SMS: it costs nothing
9
+ * per sign-in, and it cannot be taken by a carrier-level SIM swap — which is
10
+ * the attack that makes SMS a second factor in name only.
11
+ *
12
+ * # The two enrolment paths
13
+ *
14
+ * Where a user enrols from decides which Cognito command associates the
15
+ * secret, and the difference is the whole reason this module exists:
16
+ *
17
+ * - **Under a session** (a signed-in user turning MFA on, or being made to
18
+ * before they may work): {@link beginTotpSetup} takes their *access
19
+ * token*, {@link confirmTotpSetup} verifies the first code, and
20
+ * {@link setTotpPreference} makes TOTP their preferred factor so the next
21
+ * sign-in asks for a code.
22
+ * - **Inside the sign-in itself** (the pool requires MFA and Cognito
23
+ * answered `MFA_SETUP`, which happens before any token exists):
24
+ * {@link beginTotpSetupForChallenge} takes the *challenge session*, and
25
+ * {@link completeMfaSetupChallenge} both verifies the first code and
26
+ * finishes the sign-in, returning tokens. No `setTotpPreference` is
27
+ * needed — completing `MFA_SETUP` makes the factor preferred.
28
+ *
29
+ * Each `AssociateSoftwareToken` call issues a **new** secret and invalidates
30
+ * the previous one, and every one of these calls returns a fresh Cognito
31
+ * session that the *next* call in the chain must use. Both are why the
32
+ * session/secret pair travels back to the caller rather than being held here:
33
+ * these flows run in a Lambda that will not be the one handling the next
34
+ * request.
35
+ *
36
+ * # What is not here
37
+ *
38
+ * SMS MFA. Adding it means a Cognito SNS role, per-message cost, and the
39
+ * SIM-swap exposure above; a consumer that needs it should say so
40
+ * deliberately rather than get it because this module was generous.
41
+ */
42
+ import type { AuthServerConfig } from './config.js';
43
+ import type { SignInOrChallengeResult } from './challenge.js';
44
+ import type { SignInResult } from './tokens.js';
45
+ /** The secret to show as a QR code, and the session the confirmation must carry. */
46
+ export interface TotpSetup {
47
+ /** Base32 shared secret. Shown once; an authenticator keeps it from here on. */
48
+ secret: string;
49
+ /**
50
+ * The Cognito session the next call must present. `null` for the
51
+ * session-token path ({@link beginTotpSetup}), where the access token is
52
+ * the credential and there is no challenge to carry forward.
53
+ */
54
+ session: string | null;
55
+ }
56
+ export interface BeginTotpSetupInput {
57
+ /** The signed-in user's **access** token (not the id token: Cognito's user-facing MFA APIs take the access token). */
58
+ accessToken: string;
59
+ }
60
+ /**
61
+ * Start enrolment for a signed-in user: a fresh secret to scan, which
62
+ * {@link confirmTotpSetup} then proves they hold.
63
+ *
64
+ * Any previously associated, unconfirmed secret is invalidated — so a user
65
+ * who abandoned a setup and starts again gets a clean one.
66
+ */
67
+ export declare function beginTotpSetup(input: BeginTotpSetupInput, config?: AuthServerConfig): Promise<TotpSetup>;
68
+ export interface BeginTotpSetupForChallengeInput {
69
+ /** The `MFA_SETUP` challenge session from the sign-in. */
70
+ session: string;
71
+ }
72
+ /**
73
+ * Start enrolment inside a sign-in that answered `MFA_SETUP`: there is no
74
+ * token yet, so the challenge session is the credential. The session comes
75
+ * back **rotated** — {@link completeMfaSetupChallenge} must use the one
76
+ * returned here, not the one that was passed in.
77
+ */
78
+ export declare function beginTotpSetupForChallenge(input: BeginTotpSetupForChallengeInput, config?: AuthServerConfig): Promise<TotpSetup>;
79
+ export interface ConfirmTotpSetupInput {
80
+ accessToken: string;
81
+ /** The six digits the authenticator shows for the secret just scanned. */
82
+ code: string;
83
+ /** Shown in the authenticator's entry when the user later has several ("MSB — iPhone"). */
84
+ deviceName?: string;
85
+ }
86
+ /**
87
+ * Prove the user holds the secret, for the session path. A wrong or stale
88
+ * code is `invalid_code` (400) — the caller lets them try the next one.
89
+ *
90
+ * Verification alone does not make Cognito *ask* for the code: that is
91
+ * {@link setTotpPreference}, which the caller runs next.
92
+ */
93
+ export declare function confirmTotpSetup(input: ConfirmTotpSetupInput, config?: AuthServerConfig): Promise<void>;
94
+ export interface SetTotpPreferenceInput {
95
+ accessToken: string;
96
+ /** `false` turns the factor off without deleting it; the user must confirm a new secret to turn it on again. */
97
+ enabled: boolean;
98
+ }
99
+ /** Make TOTP the user's preferred factor (or stop it being one), for the session path. */
100
+ export declare function setTotpPreference(input: SetTotpPreferenceInput, config?: AuthServerConfig): Promise<void>;
101
+ export interface RespondSoftwareTokenMfaInput {
102
+ username: string;
103
+ /** The six digits from the authenticator. */
104
+ code: string;
105
+ /** The `SOFTWARE_TOKEN_MFA` challenge session. */
106
+ session: string;
107
+ }
108
+ /**
109
+ * Answer the code at sign-in. Returns the tokens, or — because Cognito may
110
+ * chain one challenge onto another — whatever it asks for next, in the same
111
+ * envelope the sign-in used.
112
+ *
113
+ * A wrong code arrives as `CodeMismatchException` and leaves as
114
+ * `invalid_code` (400) with the session still usable, so the caller can let
115
+ * the user retype it; an expired session is `expired_code` and sends them
116
+ * back to the password step. Cognito counts the failures itself and locks
117
+ * the user out on its own terms.
118
+ */
119
+ export declare function respondToSoftwareTokenMfa(input: RespondSoftwareTokenMfaInput, config?: AuthServerConfig): Promise<SignInOrChallengeResult>;
120
+ export interface CompleteMfaSetupInput {
121
+ username: string;
122
+ /** The six digits for the secret {@link beginTotpSetupForChallenge} returned. */
123
+ code: string;
124
+ /** The session **that call** returned, not the one the sign-in gave. */
125
+ session: string;
126
+ }
127
+ /**
128
+ * Finish a sign-in that answered `MFA_SETUP`: verify the first code against
129
+ * the just-associated secret and receive the tokens. Completing this makes
130
+ * TOTP the user's factor, so the next sign-in asks for a code.
131
+ */
132
+ export declare function completeMfaSetupChallenge(input: CompleteMfaSetupInput, config?: AuthServerConfig): Promise<SignInResult>;
133
+ /** Whether a user has a confirmed TOTP factor, as the pool sees it. */
134
+ export interface MfaStatus {
135
+ /** A software token is enrolled and preferred, so sign-in will ask for a code. */
136
+ totpEnabled: boolean;
137
+ /** Every factor Cognito lists as enabled for the user (`SOFTWARE_TOKEN_MFA`, `SMS_MFA`). */
138
+ factors: string[];
139
+ }
140
+ export interface AdminGetMfaStatusInput {
141
+ username: string;
142
+ }
143
+ /**
144
+ * Read a user's factors as an administrator — for a console that shows who
145
+ * has enrolled, and for a policy that refuses to let certain roles work
146
+ * until they have.
147
+ *
148
+ * Admin-side on purpose: the answer must not depend on the caller holding
149
+ * that user's token. A user the pool does not know reads as "nothing
150
+ * enrolled" rather than throwing, so a policy check treats a deleted user
151
+ * as unenrolled instead of erroring.
152
+ */
153
+ export declare function adminGetMfaStatus(input: AdminGetMfaStatusInput, config?: AuthServerConfig): Promise<MfaStatus>;
154
+ export interface AdminSetTotpPreferenceInput {
155
+ username: string;
156
+ enabled: boolean;
157
+ }
158
+ /**
159
+ * Turn a user's TOTP factor off as an administrator — the recovery path when
160
+ * someone loses their phone. It does not delete the secret; the user enrols a
161
+ * new one on their next sign-in (`MFA_SETUP`) or from their profile.
162
+ *
163
+ * A console must treat this as a privileged, audited action: for a minute it
164
+ * leaves a password as the only thing between an attacker and that account.
165
+ */
166
+ export declare function adminSetTotpPreference(input: AdminSetTotpPreferenceInput, config?: AuthServerConfig): Promise<void>;
167
+ export interface OtpauthUriInput {
168
+ /** Base32 secret from {@link beginTotpSetup} / {@link beginTotpSetupForChallenge}. */
169
+ secret: string;
170
+ /** What the authenticator shows as the account — the user's e-mail or phone. */
171
+ account: string;
172
+ /** What it shows as the issuer — the product name, not the AWS pool id. */
173
+ issuer: string;
174
+ }
175
+ /**
176
+ * The `otpauth://` URI an authenticator app reads, for the caller to render
177
+ * as a QR code (and to offer as text, for a password manager on the same
178
+ * device that cannot scan the screen it is on).
179
+ *
180
+ * Built here rather than in each consumer because the escaping is easy to get
181
+ * wrong: the label carries the issuer *and* the account separated by a colon,
182
+ * each percent-encoded, and the issuer is repeated as a parameter — an app
183
+ * that only reads one of the two otherwise shows "MSB" for every account.
184
+ */
185
+ export declare function otpauthUri(input: OtpauthUriInput): string;
186
+ //# sourceMappingURL=mfa.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.d.ts","sourceRoot":"","sources":["../../src/server/mfa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAWH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAKpD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,sHAAsH;IACtH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,mBAAmB,EAC1B,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,SAAS,CAAC,CAYpB;AAED,MAAM,WAAW,+BAA+B;IAC9C,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,EACtC,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,SAAS,CAAC,CAYpB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,qBAAqB,EAC5B,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,IAAI,CAAC,CA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AClB;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,EAClC,MAAM,GAAE,gBAAyC,GAChD,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,MAAM,WAAW,eAAe;IAC9B,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAIzD"}
@@ -0,0 +1,259 @@
1
+ /**
2
+ * TOTP multi-factor authentication: enrolling an authenticator, and
3
+ * answering the code at sign-in.
4
+ *
5
+ * Cognito calls this a "software token". The factor is a shared secret
6
+ * the user scans into an authenticator app (Google Authenticator, 1Password,
7
+ * Aegis…), which then derives a six-digit code from it every 30 seconds
8
+ * (RFC 6238). Two things make it worth choosing over SMS: it costs nothing
9
+ * per sign-in, and it cannot be taken by a carrier-level SIM swap — which is
10
+ * the attack that makes SMS a second factor in name only.
11
+ *
12
+ * # The two enrolment paths
13
+ *
14
+ * Where a user enrols from decides which Cognito command associates the
15
+ * secret, and the difference is the whole reason this module exists:
16
+ *
17
+ * - **Under a session** (a signed-in user turning MFA on, or being made to
18
+ * before they may work): {@link beginTotpSetup} takes their *access
19
+ * token*, {@link confirmTotpSetup} verifies the first code, and
20
+ * {@link setTotpPreference} makes TOTP their preferred factor so the next
21
+ * sign-in asks for a code.
22
+ * - **Inside the sign-in itself** (the pool requires MFA and Cognito
23
+ * answered `MFA_SETUP`, which happens before any token exists):
24
+ * {@link beginTotpSetupForChallenge} takes the *challenge session*, and
25
+ * {@link completeMfaSetupChallenge} both verifies the first code and
26
+ * finishes the sign-in, returning tokens. No `setTotpPreference` is
27
+ * needed — completing `MFA_SETUP` makes the factor preferred.
28
+ *
29
+ * Each `AssociateSoftwareToken` call issues a **new** secret and invalidates
30
+ * the previous one, and every one of these calls returns a fresh Cognito
31
+ * session that the *next* call in the chain must use. Both are why the
32
+ * session/secret pair travels back to the caller rather than being held here:
33
+ * these flows run in a Lambda that will not be the one handling the next
34
+ * request.
35
+ *
36
+ * # What is not here
37
+ *
38
+ * SMS MFA. Adding it means a Cognito SNS role, per-message cost, and the
39
+ * SIM-swap exposure above; a consumer that needs it should say so
40
+ * deliberately rather than get it because this module was generous.
41
+ */
42
+ import { AdminGetUserCommand, AdminSetUserMFAPreferenceCommand, AssociateSoftwareTokenCommand, ChallengeNameType, RespondToAuthChallengeCommand, SetUserMFAPreferenceCommand, VerifySoftwareTokenCommand, } from '@aws-sdk/client-cognito-identity-provider';
43
+ import { loadAuthServerConfig } from './config.js';
44
+ import { getCognitoClient } from './cognito-client.js';
45
+ import { AuthError, mapProviderError } from './errors.js';
46
+ import { resolveChallengeResponse } from './challenge.js';
47
+ /** A six-digit TOTP code, as an authenticator app shows it. */
48
+ const TOTP_CODE = /^\d{6}$/;
49
+ function assertCode(code) {
50
+ const trimmed = code.trim().replace(/\s+/g, '');
51
+ if (!TOTP_CODE.test(trimmed)) {
52
+ throw new AuthError('invalid_code', 'A six-digit authenticator code is required', 400);
53
+ }
54
+ return trimmed;
55
+ }
56
+ /**
57
+ * Start enrolment for a signed-in user: a fresh secret to scan, which
58
+ * {@link confirmTotpSetup} then proves they hold.
59
+ *
60
+ * Any previously associated, unconfirmed secret is invalidated — so a user
61
+ * who abandoned a setup and starts again gets a clean one.
62
+ */
63
+ export async function beginTotpSetup(input, config = loadAuthServerConfig()) {
64
+ const client = getCognitoClient(config.region, config.endpoint);
65
+ try {
66
+ const res = await client.send(new AssociateSoftwareTokenCommand({ AccessToken: input.accessToken }));
67
+ if (!res.SecretCode) {
68
+ throw new AuthError('mfa_setup_failed', 'Identity provider returned no authenticator secret', 500);
69
+ }
70
+ return { secret: res.SecretCode, session: null };
71
+ }
72
+ catch (err) {
73
+ if (err instanceof AuthError)
74
+ throw err;
75
+ throw mapProviderError(err, 'mfa_setup_failed');
76
+ }
77
+ }
78
+ /**
79
+ * Start enrolment inside a sign-in that answered `MFA_SETUP`: there is no
80
+ * token yet, so the challenge session is the credential. The session comes
81
+ * back **rotated** — {@link completeMfaSetupChallenge} must use the one
82
+ * returned here, not the one that was passed in.
83
+ */
84
+ export async function beginTotpSetupForChallenge(input, config = loadAuthServerConfig()) {
85
+ const client = getCognitoClient(config.region, config.endpoint);
86
+ try {
87
+ const res = await client.send(new AssociateSoftwareTokenCommand({ Session: input.session }));
88
+ if (!res.SecretCode || !res.Session) {
89
+ throw new AuthError('mfa_setup_failed', 'Identity provider returned no authenticator secret', 500);
90
+ }
91
+ return { secret: res.SecretCode, session: res.Session };
92
+ }
93
+ catch (err) {
94
+ if (err instanceof AuthError)
95
+ throw err;
96
+ throw mapProviderError(err, 'mfa_setup_failed');
97
+ }
98
+ }
99
+ /**
100
+ * Prove the user holds the secret, for the session path. A wrong or stale
101
+ * code is `invalid_code` (400) — the caller lets them try the next one.
102
+ *
103
+ * Verification alone does not make Cognito *ask* for the code: that is
104
+ * {@link setTotpPreference}, which the caller runs next.
105
+ */
106
+ export async function confirmTotpSetup(input, config = loadAuthServerConfig()) {
107
+ const client = getCognitoClient(config.region, config.endpoint);
108
+ try {
109
+ const res = await client.send(new VerifySoftwareTokenCommand({
110
+ AccessToken: input.accessToken,
111
+ UserCode: assertCode(input.code),
112
+ ...(input.deviceName ? { FriendlyDeviceName: input.deviceName } : {}),
113
+ }));
114
+ if (res.Status !== 'SUCCESS') {
115
+ throw new AuthError('invalid_code', 'That authenticator code was not accepted', 400);
116
+ }
117
+ }
118
+ catch (err) {
119
+ if (err instanceof AuthError)
120
+ throw err;
121
+ throw mapProviderError(err, 'mfa_setup_failed');
122
+ }
123
+ }
124
+ /** Make TOTP the user's preferred factor (or stop it being one), for the session path. */
125
+ export async function setTotpPreference(input, config = loadAuthServerConfig()) {
126
+ const client = getCognitoClient(config.region, config.endpoint);
127
+ try {
128
+ await client.send(new SetUserMFAPreferenceCommand({
129
+ AccessToken: input.accessToken,
130
+ SoftwareTokenMfaSettings: { Enabled: input.enabled, PreferredMfa: input.enabled },
131
+ }));
132
+ }
133
+ catch (err) {
134
+ throw mapProviderError(err, 'mfa_preference_failed');
135
+ }
136
+ }
137
+ /**
138
+ * Answer the code at sign-in. Returns the tokens, or — because Cognito may
139
+ * chain one challenge onto another — whatever it asks for next, in the same
140
+ * envelope the sign-in used.
141
+ *
142
+ * A wrong code arrives as `CodeMismatchException` and leaves as
143
+ * `invalid_code` (400) with the session still usable, so the caller can let
144
+ * the user retype it; an expired session is `expired_code` and sends them
145
+ * back to the password step. Cognito counts the failures itself and locks
146
+ * the user out on its own terms.
147
+ */
148
+ export async function respondToSoftwareTokenMfa(input, config = loadAuthServerConfig()) {
149
+ const client = getCognitoClient(config.region, config.endpoint);
150
+ const username = input.username.toLowerCase();
151
+ try {
152
+ const res = await client.send(new RespondToAuthChallengeCommand({
153
+ ClientId: config.appClientId,
154
+ ChallengeName: ChallengeNameType.SOFTWARE_TOKEN_MFA,
155
+ Session: input.session,
156
+ ChallengeResponses: {
157
+ USERNAME: username,
158
+ SOFTWARE_TOKEN_MFA_CODE: assertCode(input.code),
159
+ },
160
+ }));
161
+ return resolveChallengeResponse(res, username, 'unsupported_challenge');
162
+ }
163
+ catch (err) {
164
+ if (err instanceof AuthError)
165
+ throw err;
166
+ throw mapProviderError(err, 'mfa_failed');
167
+ }
168
+ }
169
+ /**
170
+ * Finish a sign-in that answered `MFA_SETUP`: verify the first code against
171
+ * the just-associated secret and receive the tokens. Completing this makes
172
+ * TOTP the user's factor, so the next sign-in asks for a code.
173
+ */
174
+ export async function completeMfaSetupChallenge(input, config = loadAuthServerConfig()) {
175
+ const client = getCognitoClient(config.region, config.endpoint);
176
+ const username = input.username.toLowerCase();
177
+ try {
178
+ const res = await client.send(new RespondToAuthChallengeCommand({
179
+ ClientId: config.appClientId,
180
+ ChallengeName: ChallengeNameType.MFA_SETUP,
181
+ Session: input.session,
182
+ ChallengeResponses: {
183
+ USERNAME: username,
184
+ SOFTWARE_TOKEN_MFA_CODE: assertCode(input.code),
185
+ },
186
+ }));
187
+ const out = resolveChallengeResponse(res, username, 'unsupported_challenge');
188
+ if (out.kind === 'challenge') {
189
+ throw new AuthError('unsupported_challenge', `Unsupported chained challenge: ${out.challenge.challenge}`, 400);
190
+ }
191
+ return out.tokens;
192
+ }
193
+ catch (err) {
194
+ if (err instanceof AuthError)
195
+ throw err;
196
+ throw mapProviderError(err, 'mfa_setup_failed');
197
+ }
198
+ }
199
+ /**
200
+ * Read a user's factors as an administrator — for a console that shows who
201
+ * has enrolled, and for a policy that refuses to let certain roles work
202
+ * until they have.
203
+ *
204
+ * Admin-side on purpose: the answer must not depend on the caller holding
205
+ * that user's token. A user the pool does not know reads as "nothing
206
+ * enrolled" rather than throwing, so a policy check treats a deleted user
207
+ * as unenrolled instead of erroring.
208
+ */
209
+ export async function adminGetMfaStatus(input, config = loadAuthServerConfig()) {
210
+ const client = getCognitoClient(config.region, config.endpoint);
211
+ try {
212
+ const res = await client.send(new AdminGetUserCommand({ UserPoolId: config.userPoolId, Username: input.username.toLowerCase() }));
213
+ const factors = res.UserMFASettingList ?? [];
214
+ return { totpEnabled: factors.includes('SOFTWARE_TOKEN_MFA'), factors: [...factors] };
215
+ }
216
+ catch (err) {
217
+ const name = err.name;
218
+ if (name === 'UserNotFoundException')
219
+ return { totpEnabled: false, factors: [] };
220
+ throw mapProviderError(err, 'mfa_status_failed', 500);
221
+ }
222
+ }
223
+ /**
224
+ * Turn a user's TOTP factor off as an administrator — the recovery path when
225
+ * someone loses their phone. It does not delete the secret; the user enrols a
226
+ * new one on their next sign-in (`MFA_SETUP`) or from their profile.
227
+ *
228
+ * A console must treat this as a privileged, audited action: for a minute it
229
+ * leaves a password as the only thing between an attacker and that account.
230
+ */
231
+ export async function adminSetTotpPreference(input, config = loadAuthServerConfig()) {
232
+ const client = getCognitoClient(config.region, config.endpoint);
233
+ try {
234
+ await client.send(new AdminSetUserMFAPreferenceCommand({
235
+ UserPoolId: config.userPoolId,
236
+ Username: input.username.toLowerCase(),
237
+ SoftwareTokenMfaSettings: { Enabled: input.enabled, PreferredMfa: input.enabled },
238
+ }));
239
+ }
240
+ catch (err) {
241
+ throw mapProviderError(err, 'mfa_preference_failed');
242
+ }
243
+ }
244
+ /**
245
+ * The `otpauth://` URI an authenticator app reads, for the caller to render
246
+ * as a QR code (and to offer as text, for a password manager on the same
247
+ * device that cannot scan the screen it is on).
248
+ *
249
+ * Built here rather than in each consumer because the escaping is easy to get
250
+ * wrong: the label carries the issuer *and* the account separated by a colon,
251
+ * each percent-encoded, and the issuer is repeated as a parameter — an app
252
+ * that only reads one of the two otherwise shows "MSB" for every account.
253
+ */
254
+ export function otpauthUri(input) {
255
+ const label = `${encodeURIComponent(input.issuer)}:${encodeURIComponent(input.account)}`;
256
+ const params = new URLSearchParams({ secret: input.secret, issuer: input.issuer });
257
+ return `otpauth://totp/${label}?${params.toString()}`;
258
+ }
259
+ //# sourceMappingURL=mfa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mfa.js","sourceRoot":"","sources":["../../src/server/mfa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EACL,mBAAmB,EACnB,gCAAgC,EAChC,6BAA6B,EAC7B,iBAAiB,EACjB,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,+DAA+D;AAC/D,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,SAAS,U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gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CACf,IAAI,gCAAgC,CAAC;YACnC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE;YACtC,wBAAwB,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,OAAO,EAAE;SAClF,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,gBAAgB,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;IACvD,CAAC;AACH,CAAC;AAWD;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,KAAK,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;IACzF,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,OAAO,kBAAkB,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AACxD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venturekit/auth",
3
- "version": "0.0.34",
3
+ "version": "0.0.36",
4
4
  "description": "Authentication and authorization for VentureKit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,14 +41,14 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@venturekit/core": "0.0.34",
44
+ "@venturekit/core": "0.0.36",
45
45
  "@aws-sdk/client-cognito-identity-provider": "^3.1126.0",
46
46
  "@aws-sdk/client-secrets-manager": "^3.1126.0",
47
47
  "aws-jwt-verify": "^4.0.1"
48
48
  },
49
49
  "peerDependencies": {
50
- "@venturekit/data": "0.0.34",
51
- "@venturekit/runtime": "0.0.34"
50
+ "@venturekit/data": "0.0.36",
51
+ "@venturekit/runtime": "0.0.36"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@venturekit/data": {
@@ -59,10 +59,10 @@
59
59
  }
60
60
  },
61
61
  "devDependencies": {
62
- "@venturekit/data": "0.0.34",
63
- "@venturekit/runtime": "0.0.34",
64
- "@types/aws-lambda": "^8.10.131",
65
- "@types/node": "^26.1.2",
62
+ "@venturekit/data": "0.0.36",
63
+ "@venturekit/runtime": "0.0.36",
64
+ "@types/aws-lambda": "^8.10.163",
65
+ "@types/node": "^26.5.1",
66
66
  "typescript": "^5.3.0"
67
67
  },
68
68
  "scripts": {