@fonderie/client 0.5.0 → 0.7.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.
@@ -123,7 +123,7 @@ new AuthClient(http: HttpClient, tokens: TokenStore): AuthClient
123
123
  .mfa: MfaClient
124
124
  .setAccessToken(token: string | undefined): void
125
125
  .register(input: IRegisterInput): Promise<IApiResponse<IRegisterResult>>
126
- .login(input: ILoginInput): Promise<IApiResponse<ILoginResult>>
126
+ .login(input: ILoginInput): Promise<IApiResponse<ILoginResult | IMfaRequiredResult>>
127
127
  .refreshTokens(refreshToken?: string | undefined): Promise<IApiResponse<IRefreshResult>>
128
128
  .forgotPassword(email: string): Promise<IApiResponse<undefined>>
129
129
  .resetPassword(input: IResetPasswordInput): Promise<IApiResponse<undefined>>
@@ -729,6 +729,10 @@ interface IMfaEnabledResult {
729
729
  user: IUserDTO;
730
730
  }
731
731
 
732
+ interface IMfaRequiredResult {
733
+ mfaToken: string;
734
+ }
735
+
732
736
  interface IMfaSetupResult {
733
737
  secret: string;
734
738
  uri: string;
@@ -1010,4 +1014,6 @@ interface IWorkspaceSettingsResult {
1010
1014
  }
1011
1015
 
1012
1016
  type SubscriberType = 'user' | 'workspace';
1017
+
1018
+ function isMfaRequired(result: ILoginResult | IMfaRequiredResult): result is IMfaRequiredResult
1013
1019
  ```
package/dist/index.cjs CHANGED
@@ -30,7 +30,8 @@ __export(index_exports, {
30
30
  FonderieClient: () => FonderieClient,
31
31
  WebhooksClient: () => WebhooksClient,
32
32
  WorkspacesClient: () => WorkspacesClient,
33
- createMemoryCache: () => createMemoryCache
33
+ createMemoryCache: () => createMemoryCache,
34
+ isMfaRequired: () => isMfaRequired
34
35
  });
35
36
  module.exports = __toCommonJS(index_exports);
36
37
 
@@ -204,6 +205,17 @@ var MfaClient = class {
204
205
  token: this.token()
205
206
  });
206
207
  }
208
+ // MFA-login: complete a login that returned MFA_REQUIRED. Authenticates with
209
+ // the temporary `mfaToken` (not the session) and verifies the TOTP `code` —
210
+ // same route as `verify`, different auth context. Returns the completed login.
211
+ verifyLogin(mfaToken, code) {
212
+ return this.http.request({
213
+ method: "POST",
214
+ path: "/auth/mfa/verify",
215
+ body: { token: code },
216
+ token: mfaToken
217
+ });
218
+ }
207
219
  disable(token) {
208
220
  return this.http.request({
209
221
  method: "POST",
@@ -1405,6 +1417,11 @@ var CourierAdminClient = class {
1405
1417
  });
1406
1418
  }
1407
1419
  };
1420
+
1421
+ // src/types.ts
1422
+ function isMfaRequired(result) {
1423
+ return !("tokens" in result);
1424
+ }
1408
1425
  // Annotate the CommonJS export names for ESM import in node:
1409
1426
  0 && (module.exports = {
1410
1427
  AuditClient,
@@ -1417,6 +1434,7 @@ var CourierAdminClient = class {
1417
1434
  FonderieClient,
1418
1435
  WebhooksClient,
1419
1436
  WorkspacesClient,
1420
- createMemoryCache
1437
+ createMemoryCache,
1438
+ isMfaRequired
1421
1439
  });
1422
1440
  //# sourceMappingURL=index.cjs.map