@zyphr-dev/node-sdk 0.1.43 → 0.1.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyphr-dev/node-sdk",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "Official Zyphr SDK for Node.js, React, and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -2,6 +2,7 @@
2
2
  .npmignore
3
3
  README.md
4
4
  package.json
5
+ src/apis/AuthApplicationApi.ts
5
6
  src/apis/AuthEmailOTPApi.ts
6
7
  src/apis/AuthEmailTemplatesApi.ts
7
8
  src/apis/AuthEmailVerificationApi.ts
@@ -50,6 +51,8 @@ src/models/AddWorkflowStepRequest.ts
50
51
  src/models/ApiError.ts
51
52
  src/models/ApiErrorError.ts
52
53
  src/models/ApiErrorMeta.ts
54
+ src/models/ApplicationSelf.ts
55
+ src/models/ApplicationSelfResponse.ts
53
56
  src/models/AuthEmailTemplate.ts
54
57
  src/models/AuthEmailTemplateDefault.ts
55
58
  src/models/AuthEmailTemplateDefaultResponse.ts
@@ -70,6 +73,7 @@ src/models/AuthEmailType.ts
70
73
  src/models/AuthLoginResponse.ts
71
74
  src/models/AuthLoginResult.ts
72
75
  src/models/AuthLoginResultMfaChallenge.ts
76
+ src/models/AuthMethods.ts
73
77
  src/models/AuthResult.ts
74
78
  src/models/AuthResultResponse.ts
75
79
  src/models/AuthSession.ts
@@ -85,6 +89,7 @@ src/models/BulkUpsertAuthEmailTemplatesResponse.ts
85
89
  src/models/Category.ts
86
90
  src/models/CategoryListResponse.ts
87
91
  src/models/CategoryResponse.ts
92
+ src/models/ChangePasswordRequest.ts
88
93
  src/models/CloseWaaSEndpointCircuit200Response.ts
89
94
  src/models/CloseWaaSEndpointCircuit200ResponseData.ts
90
95
  src/models/ConfirmEmailVerificationRequest.ts
@@ -163,6 +168,7 @@ src/models/GenerateSubscriberTokenRequest.ts
163
168
  src/models/GenerateWaaSPortalToken201Response.ts
164
169
  src/models/GetDomain200Response.ts
165
170
  src/models/GetDomain200ResponseMeta.ts
171
+ src/models/GetEndUserAuthMethods200Response.ts
166
172
  src/models/GetEndUserById200Response.ts
167
173
  src/models/GetEndUserClaims200Response.ts
168
174
  src/models/GetEndUserClaims200ResponseData.ts
@@ -363,6 +369,7 @@ src/models/SetEndUserClaims200ResponseData.ts
363
369
  src/models/SetEndUserClaimsRequest.ts
364
370
  src/models/SetPreferencesRequest.ts
365
371
  src/models/SetPreferencesRequestPreferencesInner.ts
372
+ src/models/SetSelfApplicationTestRecipientsRequest.ts
366
373
  src/models/SignInAnonymouslyRequest.ts
367
374
  src/models/SignInWithGameCenterRequest.ts
368
375
  src/models/SignInWithGooglePlayGamesRequest.ts
@@ -500,6 +507,7 @@ src/models/WebhookDeliveryListResponse.ts
500
507
  src/models/WebhookDeliveryResponse.ts
501
508
  src/models/WebhookDeliveryRetryResponse.ts
502
509
  src/models/WebhookDeliveryRetryResponseData.ts
510
+ src/models/WebhookEventType.ts
503
511
  src/models/WebhookEventTypesResponse.ts
504
512
  src/models/WebhookEventTypesResponseData.ts
505
513
  src/models/WebhookIpsResponse.ts
package/src/client.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  import { Configuration } from './src/runtime.js';
17
17
  import type { Middleware, ResponseContext } from './src/runtime.js';
18
18
  import {
19
+ AuthApplicationApi,
19
20
  AuthEmailOTPApi,
20
21
  AuthEmailVerificationApi,
21
22
  AuthLoginApi,
@@ -52,13 +53,24 @@ import {
52
53
  import { parseErrorResponse } from './errors.js';
53
54
 
54
55
  export interface ZyphrOptions {
55
- /** Your Zyphr API key (zy_live_* or zy_test_*) */
56
+ /**
57
+ * Your Project-scoped Zyphr API key (`zy_live_*` / `zy_test_*`), sent as
58
+ * `Authorization: Bearer`. Used for notification APIs (emails, push, webhooks).
59
+ */
56
60
  apiKey: string;
57
61
  /** Override the base API URL (defaults to https://api.zyphr.dev/v1) */
58
62
  baseUrl?: string;
59
- /** Application public key (za_pub_*) for Auth-as-a-Service endpoints */
63
+ /**
64
+ * Application-scoped public key (`za_live_pub_*` / `za_test_pub_*`; legacy
65
+ * `za_pub_*` still accepted) for Auth-as-a-Service endpoints, sent as
66
+ * `X-Application-Key`. Distinct from the Project-scoped `apiKey` above.
67
+ */
60
68
  applicationKey?: string;
61
- /** Application secret key (za_sec_*) for Auth-as-a-Service endpoints */
69
+ /**
70
+ * Application-scoped secret key (`za_live_sec_*` / `za_test_sec_*`; legacy
71
+ * `za_sec_*` still accepted) for server-side Auth-as-a-Service endpoints, sent
72
+ * as `X-Application-Secret`. Must stay server-side — never ship in a client bundle.
73
+ */
62
74
  applicationSecret?: string;
63
75
  }
64
76
 
@@ -115,6 +127,8 @@ export class Zyphr {
115
127
  /** Server-side (secret-key) end-user directory: list/search/get/update/delete, invite, and the trusted claims store. */
116
128
  readonly userDirectory: AuthUserDirectoryApi;
117
129
  readonly webauthn: AuthWebAuthnApi;
130
+ /** Read the authenticating application's own non-sensitive metadata (id, name, environment, signing algorithm) via GET /auth/application. */
131
+ readonly application: AuthApplicationApi;
118
132
  };
119
133
 
120
134
  private readonly options: ZyphrOptions;
@@ -171,6 +185,7 @@ export class Zyphr {
171
185
  profile: new AuthUserProfileApi(config),
172
186
  userDirectory: new AuthUserDirectoryApi(config),
173
187
  webauthn: new AuthWebAuthnApi(config),
188
+ application: new AuthApplicationApi(config),
174
189
  };
175
190
  }
176
191
 
package/src/clientAuth.ts CHANGED
@@ -4,8 +4,14 @@
4
4
  * `ZyphrClient` is a browser / React Native-safe entry point for Auth-as-a-Service.
5
5
  * Unlike the server `Zyphr` client (which requires a secret API key and, for auth,
6
6
  * an application SECRET key), `ZyphrClient` is constructed with ONLY the publishable
7
- * application key (`za_pub_*`) — the key that is safe to ship in a client bundle —
8
- * plus, once the user is authenticated, their end-user access token.
7
+ * application key (`za_live_pub_*` in live mode, `za_test_pub_*` in test mode) — the
8
+ * key that is safe to ship in a client bundle — plus, once the user is authenticated,
9
+ * their end-user access token.
10
+ *
11
+ * These Application-scoped credentials (`X-Application-Key` publishable key, and the
12
+ * server-only `X-Application-Secret`) are distinct from the Project-scoped notification
13
+ * keys (`zy_live_*` / `zy_test_*`, sent as `Authorization: Bearer`) used by the server
14
+ * `Zyphr` client for emails/push/webhooks.
9
15
  *
10
16
  * It deliberately exposes ONLY the end-user-scoped auth surface (login, registration,
11
17
  * sessions, magic links, OAuth, phone, email-OTP, profile, MFA, WebAuthn, password
@@ -17,7 +23,7 @@
17
23
  * ```ts
18
24
  * import { ZyphrClient } from '@zyphr-dev/node-sdk';
19
25
  *
20
- * const zyphr = new ZyphrClient({ applicationKey: 'za_pub_xxx' });
26
+ * const zyphr = new ZyphrClient({ applicationKey: 'za_live_pub_xxx' });
21
27
  *
22
28
  * const login = await zyphr.auth.login.loginEndUser({ ... });
23
29
  * zyphr.setAccessToken(login.data.tokens.access_token);
@@ -47,7 +53,10 @@ import {
47
53
  import { parseErrorResponse } from './errors.js';
48
54
 
49
55
  export interface ZyphrClientOptions {
50
- /** Publishable application key (za_pub_*) — safe to embed in a client bundle. */
56
+ /**
57
+ * Publishable application key (`za_live_pub_*` / `za_test_pub_*`) — safe to
58
+ * embed in a client bundle. Legacy `za_pub_*` keys are also accepted.
59
+ */
51
60
  applicationKey: string;
52
61
  /** Override the base API URL (defaults to https://api.zyphr.dev/v1). */
53
62
  baseUrl?: string;
@@ -75,8 +84,31 @@ export class ZyphrClientCredentialError extends Error {
75
84
  }
76
85
  }
77
86
 
78
- /** Prefixes that must NEVER reach a client bundle. */
79
- const SECRET_KEY_PREFIXES = ['za_sec_', 'zy_live_', 'zy_test_'];
87
+ // Key prefixes are mirrored from the platform source of truth,
88
+ // packages/shared/src/constants/api.ts (APPLICATION_KEY_PREFIXES,
89
+ // SECRET_KEY_PREFIXES). They are inlined here because this is a standalone
90
+ // published package that cannot import @zyphr/shared at runtime — keep the two
91
+ // in sync if the prefixes ever change.
92
+
93
+ /**
94
+ * Publishable application-key prefixes accepted by the client-safe SDK.
95
+ * `za_live_pub_` / `za_test_pub_` are the current live/test prefixes; `za_pub_`
96
+ * is the deprecated legacy prefix, still accepted for backward compatibility.
97
+ */
98
+ const PUBLISHABLE_KEY_PREFIXES = ['za_live_pub_', 'za_test_pub_', 'za_pub_'];
99
+
100
+ /**
101
+ * Prefixes that must NEVER reach a client bundle: application SECRET keys
102
+ * (`za_live_sec_` / `za_test_sec_`, and legacy `za_sec_`) and Project-scoped
103
+ * notification API keys (`zy_live_*` / `zy_test_*`).
104
+ */
105
+ const SECRET_KEY_PREFIXES = [
106
+ 'za_live_sec_',
107
+ 'za_test_sec_',
108
+ 'za_sec_',
109
+ 'zy_live_',
110
+ 'zy_test_',
111
+ ];
80
112
 
81
113
  export class ZyphrClient {
82
114
  readonly auth: {
@@ -103,19 +135,20 @@ export class ZyphrClient {
103
135
 
104
136
  constructor(options: ZyphrClientOptions) {
105
137
  if (!options.applicationKey) {
106
- throw new ZyphrClientCredentialError('applicationKey (za_pub_*) is required');
138
+ throw new ZyphrClientCredentialError('applicationKey (za_live_pub_* / za_test_pub_*) is required');
107
139
  }
108
140
  // Guardrail: reject secret-shaped credentials so a secret can't be shipped
109
- // in a client bundle by mistake.
141
+ // in a client bundle by mistake. Checked before the publishable allow-list so
142
+ // a secret key produces the clearer "never a secret key" message.
110
143
  if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
111
144
  throw new ZyphrClientCredentialError(
112
- 'ZyphrClient must be constructed with a publishable application key (za_pub_*), ' +
113
- 'never a secret key. Secret keys must stay server-side.'
145
+ 'ZyphrClient must be constructed with a publishable application key ' +
146
+ '(za_live_pub_* / za_test_pub_*), never a secret key. Secret keys must stay server-side.'
114
147
  );
115
148
  }
116
- if (!options.applicationKey.startsWith('za_pub_')) {
149
+ if (!PUBLISHABLE_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
117
150
  throw new ZyphrClientCredentialError(
118
- 'applicationKey must be a publishable application key (za_pub_*).'
151
+ 'applicationKey must be a publishable application key (za_live_pub_* / za_test_pub_*).'
119
152
  );
120
153
  }
121
154
 
@@ -0,0 +1,162 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Zyphr API
5
+ * Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@zyphr.dev
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ ApiError,
19
+ ApplicationSelfResponse,
20
+ SetSelfApplicationTestRecipientsRequest,
21
+ } from '../models/index';
22
+ import {
23
+ ApiErrorFromJSON,
24
+ ApiErrorToJSON,
25
+ ApplicationSelfResponseFromJSON,
26
+ ApplicationSelfResponseToJSON,
27
+ SetSelfApplicationTestRecipientsRequestFromJSON,
28
+ SetSelfApplicationTestRecipientsRequestToJSON,
29
+ } from '../models/index';
30
+
31
+ export interface AuthApplicationApiSetSelfApplicationTestRecipientsOperationRequest {
32
+ setSelfApplicationTestRecipientsRequest: SetSelfApplicationTestRecipientsRequest;
33
+ }
34
+
35
+ /**
36
+ * AuthApplicationApi - interface
37
+ *
38
+ * @export
39
+ * @interface AuthApplicationApiInterface
40
+ */
41
+ export interface AuthApplicationApiInterface {
42
+ /**
43
+ * Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
44
+ * @summary Get the authenticating application
45
+ * @param {*} [options] Override http request option.
46
+ * @throws {RequiredError}
47
+ * @memberof AuthApplicationApiInterface
48
+ */
49
+ getSelfApplicationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>>;
50
+
51
+ /**
52
+ * Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
53
+ * Get the authenticating application
54
+ */
55
+ getSelfApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse>;
56
+
57
+ /**
58
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
59
+ * @summary Set the authenticating application\'s auth-email test allowlist
60
+ * @param {SetSelfApplicationTestRecipientsRequest} setSelfApplicationTestRecipientsRequest
61
+ * @param {*} [options] Override http request option.
62
+ * @throws {RequiredError}
63
+ * @memberof AuthApplicationApiInterface
64
+ */
65
+ setSelfApplicationTestRecipientsRaw(requestParameters: AuthApplicationApiSetSelfApplicationTestRecipientsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>>;
66
+
67
+ /**
68
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
69
+ * Set the authenticating application\'s auth-email test allowlist
70
+ */
71
+ setSelfApplicationTestRecipients(setSelfApplicationTestRecipientsRequest: SetSelfApplicationTestRecipientsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse>;
72
+
73
+ }
74
+
75
+ /**
76
+ *
77
+ */
78
+ export class AuthApplicationApi extends runtime.BaseAPI implements AuthApplicationApiInterface {
79
+
80
+ /**
81
+ * Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
82
+ * Get the authenticating application
83
+ */
84
+ async getSelfApplicationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>> {
85
+ const queryParameters: any = {};
86
+
87
+ const headerParameters: runtime.HTTPHeaders = {};
88
+
89
+ if (this.configuration && this.configuration.apiKey) {
90
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
91
+ }
92
+
93
+ if (this.configuration && this.configuration.apiKey) {
94
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
95
+ }
96
+
97
+ const response = await this.request({
98
+ path: `/auth/application`,
99
+ method: 'GET',
100
+ headers: headerParameters,
101
+ query: queryParameters,
102
+ }, initOverrides);
103
+
104
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
105
+ }
106
+
107
+ /**
108
+ * Return non-sensitive metadata about the application whose credentials authenticated this request. Lets an integrator read their own application_id (the sole tenant discriminator embedded in every end-user token) directly from the API, rather than only from the dashboard UI or by decoding a token. Returns only id, name, the calling environment\'s mode, and the JWT signing algorithm — never secrets, signing keys, or account-internal fields.
109
+ * Get the authenticating application
110
+ */
111
+ async getSelfApplication(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse> {
112
+ const response = await this.getSelfApplicationRaw(initOverrides);
113
+ return await response.value();
114
+ }
115
+
116
+ /**
117
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
118
+ * Set the authenticating application\'s auth-email test allowlist
119
+ */
120
+ async setSelfApplicationTestRecipientsRaw(requestParameters: AuthApplicationApiSetSelfApplicationTestRecipientsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ApplicationSelfResponse>> {
121
+ if (requestParameters['setSelfApplicationTestRecipientsRequest'] == null) {
122
+ throw new runtime.RequiredError(
123
+ 'setSelfApplicationTestRecipientsRequest',
124
+ 'Required parameter "setSelfApplicationTestRecipientsRequest" was null or undefined when calling setSelfApplicationTestRecipients().'
125
+ );
126
+ }
127
+
128
+ const queryParameters: any = {};
129
+
130
+ const headerParameters: runtime.HTTPHeaders = {};
131
+
132
+ headerParameters['Content-Type'] = 'application/json';
133
+
134
+ if (this.configuration && this.configuration.apiKey) {
135
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
136
+ }
137
+
138
+ if (this.configuration && this.configuration.apiKey) {
139
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
140
+ }
141
+
142
+ const response = await this.request({
143
+ path: `/auth/application`,
144
+ method: 'PATCH',
145
+ headers: headerParameters,
146
+ query: queryParameters,
147
+ body: SetSelfApplicationTestRecipientsRequestToJSON(requestParameters['setSelfApplicationTestRecipientsRequest']),
148
+ }, initOverrides);
149
+
150
+ return new runtime.JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
151
+ }
152
+
153
+ /**
154
+ * Set `test_recipients` — the per-application auth-email allowlist — on the application whose credentials authenticated this request. When non-empty, this allowlist gates ALL auth emails (only listed addresses receive them); an EMPTY array clears it and disables the gate. Lets an integrator manage the allowlist from their own infrastructure config instead of the dashboard. Application-SECRET scoped (server-side write): requires X-Application-Key AND X-Application-Secret. Mutates ONLY the authenticating application — it never takes an application id from the request, so there is no cross-tenant write path. The response mirrors GET /auth/application exactly (never returns secrets).
155
+ * Set the authenticating application\'s auth-email test allowlist
156
+ */
157
+ async setSelfApplicationTestRecipients(setSelfApplicationTestRecipientsRequest: SetSelfApplicationTestRecipientsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ApplicationSelfResponse> {
158
+ const response = await this.setSelfApplicationTestRecipientsRaw({ setSelfApplicationTestRecipientsRequest: setSelfApplicationTestRecipientsRequest }, initOverrides);
159
+ return await response.value();
160
+ }
161
+
162
+ }
@@ -240,7 +240,7 @@ export interface AuthEmailTemplatesApiInterface {
240
240
  restoreAuthEmailTemplateVersion(type: AuthEmailType, version: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateResponse>;
241
241
 
242
242
  /**
243
- * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
243
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
244
244
  * @summary Send a test render of a template
245
245
  * @param {AuthEmailType} type
246
246
  * @param {AuthEmailTemplateTestRequest} authEmailTemplateTestRequest
@@ -251,7 +251,7 @@ export interface AuthEmailTemplatesApiInterface {
251
251
  sendAuthEmailTemplateTestRaw(requestParameters: AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateTestResponse>>;
252
252
 
253
253
  /**
254
- * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
254
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
255
255
  * Send a test render of a template
256
256
  */
257
257
  sendAuthEmailTemplateTest(type: AuthEmailType, authEmailTemplateTestRequest: AuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateTestResponse>;
@@ -629,7 +629,7 @@ export class AuthEmailTemplatesApi extends runtime.BaseAPI implements AuthEmailT
629
629
  }
630
630
 
631
631
  /**
632
- * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
632
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
633
633
  * Send a test render of a template
634
634
  */
635
635
  async sendAuthEmailTemplateTestRaw(requestParameters: AuthEmailTemplatesApiSendAuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthEmailTemplateTestResponse>> {
@@ -673,7 +673,7 @@ export class AuthEmailTemplatesApi extends runtime.BaseAPI implements AuthEmailT
673
673
  }
674
674
 
675
675
  /**
676
- * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited.
676
+ * Renders the template (override or default) using sample/provided variables and sends to the recipient. The recipient must be in the application `test_recipients` allowlist. Rate-limited. When non-empty, `test_recipients` gates ALL auth emails this application sends (magic link, password reset, email verification, and email OTP) — not just these test renders. Only listed recipients receive auth email; any other recipient is silently blocked. Use it to make a non-production application safe from mass sends. An empty allowlist (the default) imposes no restriction and every recipient receives auth email normally.
677
677
  * Send a test render of a template
678
678
  */
679
679
  async sendAuthEmailTemplateTest(type: AuthEmailType, authEmailTemplateTestRequest: AuthEmailTemplateTestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthEmailTemplateTestResponse> {
@@ -15,6 +15,7 @@
15
15
 
16
16
  import * as runtime from '../runtime';
17
17
  import type {
18
+ GetEndUserAuthMethods200Response,
18
19
  GetEndUserById200Response,
19
20
  GetEndUserClaims200Response,
20
21
  InviteEndUser200Response,
@@ -25,6 +26,8 @@ import type {
25
26
  UpdateEndUserByApplicationRequest,
26
27
  } from '../models/index';
27
28
  import {
29
+ GetEndUserAuthMethods200ResponseFromJSON,
30
+ GetEndUserAuthMethods200ResponseToJSON,
28
31
  GetEndUserById200ResponseFromJSON,
29
32
  GetEndUserById200ResponseToJSON,
30
33
  GetEndUserClaims200ResponseFromJSON,
@@ -47,6 +50,10 @@ export interface AuthUserDirectoryApiDeleteEndUserByApplicationRequest {
47
50
  userId: string;
48
51
  }
49
52
 
53
+ export interface AuthUserDirectoryApiGetEndUserAuthMethodsRequest {
54
+ userId: string;
55
+ }
56
+
50
57
  export interface AuthUserDirectoryApiGetEndUserByEmailRequest {
51
58
  email: string;
52
59
  }
@@ -103,6 +110,22 @@ export interface AuthUserDirectoryApiInterface {
103
110
  */
104
111
  deleteEndUserByApplication(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
105
112
 
113
+ /**
114
+ * Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
115
+ * @summary Get an end user\'s sign-in methods (server-side admin)
116
+ * @param {string} userId
117
+ * @param {*} [options] Override http request option.
118
+ * @throws {RequiredError}
119
+ * @memberof AuthUserDirectoryApiInterface
120
+ */
121
+ getEndUserAuthMethodsRaw(requestParameters: AuthUserDirectoryApiGetEndUserAuthMethodsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetEndUserAuthMethods200Response>>;
122
+
123
+ /**
124
+ * Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
125
+ * Get an end user\'s sign-in methods (server-side admin)
126
+ */
127
+ getEndUserAuthMethods(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetEndUserAuthMethods200Response>;
128
+
106
129
  /**
107
130
  * Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
108
131
  * @summary Look up an end user by email (server-side admin)
@@ -269,6 +292,49 @@ export class AuthUserDirectoryApi extends runtime.BaseAPI implements AuthUserDir
269
292
  await this.deleteEndUserByApplicationRaw({ userId: userId }, initOverrides);
270
293
  }
271
294
 
295
+ /**
296
+ * Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
297
+ * Get an end user\'s sign-in methods (server-side admin)
298
+ */
299
+ async getEndUserAuthMethodsRaw(requestParameters: AuthUserDirectoryApiGetEndUserAuthMethodsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetEndUserAuthMethods200Response>> {
300
+ if (requestParameters['userId'] == null) {
301
+ throw new runtime.RequiredError(
302
+ 'userId',
303
+ 'Required parameter "userId" was null or undefined when calling getEndUserAuthMethods().'
304
+ );
305
+ }
306
+
307
+ const queryParameters: any = {};
308
+
309
+ const headerParameters: runtime.HTTPHeaders = {};
310
+
311
+ if (this.configuration && this.configuration.apiKey) {
312
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret"); // ApplicationSecret authentication
313
+ }
314
+
315
+ if (this.configuration && this.configuration.apiKey) {
316
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
317
+ }
318
+
319
+ const response = await this.request({
320
+ path: `/auth/users/{user_id}/auth-methods`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters['userId']))),
321
+ method: 'GET',
322
+ headers: headerParameters,
323
+ query: queryParameters,
324
+ }, initOverrides);
325
+
326
+ return new runtime.JSONApiResponse(response, (jsonValue) => GetEndUserAuthMethods200ResponseFromJSON(jsonValue));
327
+ }
328
+
329
+ /**
330
+ * Secret-key-scoped, aggregate view of the sign-in methods configured for a single end user within the authenticating application. Reports whether the user has a password, which OAuth providers are linked, whether MFA is enabled, whether email/phone are verified, and how many passkeys are registered — everything a customer admin needs to build a \"sign-in methods\" screen. Scoped to the application — a caller can never read a user belonging to another application.
331
+ * Get an end user\'s sign-in methods (server-side admin)
332
+ */
333
+ async getEndUserAuthMethods(userId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetEndUserAuthMethods200Response> {
334
+ const response = await this.getEndUserAuthMethodsRaw({ userId: userId }, initOverrides);
335
+ return await response.value();
336
+ }
337
+
272
338
  /**
273
339
  * Secret-key-scoped lookup of a single end user by email address within the authenticating application. Scoped to the application — never resolves a user from another application. Does not return the password hash.
274
340
  * Look up an end user by email (server-side admin)
@@ -17,7 +17,9 @@ import * as runtime from '../runtime';
17
17
  import type {
18
18
  ApiError,
19
19
  AuthUserResponse,
20
+ ChangePasswordRequest,
20
21
  EndUserDeleteResponse,
22
+ RefreshTokenResponse,
21
23
  UpdateEndUserRequest,
22
24
  } from '../models/index';
23
25
  import {
@@ -25,12 +27,20 @@ import {
25
27
  ApiErrorToJSON,
26
28
  AuthUserResponseFromJSON,
27
29
  AuthUserResponseToJSON,
30
+ ChangePasswordRequestFromJSON,
31
+ ChangePasswordRequestToJSON,
28
32
  EndUserDeleteResponseFromJSON,
29
33
  EndUserDeleteResponseToJSON,
34
+ RefreshTokenResponseFromJSON,
35
+ RefreshTokenResponseToJSON,
30
36
  UpdateEndUserRequestFromJSON,
31
37
  UpdateEndUserRequestToJSON,
32
38
  } from '../models/index';
33
39
 
40
+ export interface AuthUserProfileApiChangeEndUserPasswordRequest {
41
+ changePasswordRequest: ChangePasswordRequest;
42
+ }
43
+
34
44
  export interface AuthUserProfileApiUpdateEndUserOperationRequest {
35
45
  updateEndUserRequest: UpdateEndUserRequest;
36
46
  }
@@ -42,6 +52,22 @@ export interface AuthUserProfileApiUpdateEndUserOperationRequest {
42
52
  * @interface AuthUserProfileApiInterface
43
53
  */
44
54
  export interface AuthUserProfileApiInterface {
55
+ /**
56
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
57
+ * @summary Change password (authenticated session)
58
+ * @param {ChangePasswordRequest} changePasswordRequest
59
+ * @param {*} [options] Override http request option.
60
+ * @throws {RequiredError}
61
+ * @memberof AuthUserProfileApiInterface
62
+ */
63
+ changeEndUserPasswordRaw(requestParameters: AuthUserProfileApiChangeEndUserPasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RefreshTokenResponse>>;
64
+
65
+ /**
66
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
67
+ * Change password (authenticated session)
68
+ */
69
+ changeEndUserPassword(changePasswordRequest: ChangePasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RefreshTokenResponse>;
70
+
45
71
  /**
46
72
  * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
47
73
  * @summary Delete current end user account
@@ -95,6 +121,56 @@ export interface AuthUserProfileApiInterface {
95
121
  */
96
122
  export class AuthUserProfileApi extends runtime.BaseAPI implements AuthUserProfileApiInterface {
97
123
 
124
+ /**
125
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
126
+ * Change password (authenticated session)
127
+ */
128
+ async changeEndUserPasswordRaw(requestParameters: AuthUserProfileApiChangeEndUserPasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RefreshTokenResponse>> {
129
+ if (requestParameters['changePasswordRequest'] == null) {
130
+ throw new runtime.RequiredError(
131
+ 'changePasswordRequest',
132
+ 'Required parameter "changePasswordRequest" was null or undefined when calling changeEndUserPassword().'
133
+ );
134
+ }
135
+
136
+ const queryParameters: any = {};
137
+
138
+ const headerParameters: runtime.HTTPHeaders = {};
139
+
140
+ headerParameters['Content-Type'] = 'application/json';
141
+
142
+ if (this.configuration && this.configuration.accessToken) {
143
+ const token = this.configuration.accessToken;
144
+ const tokenString = await token("EndUserToken", []);
145
+
146
+ if (tokenString) {
147
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
148
+ }
149
+ }
150
+ if (this.configuration && this.configuration.apiKey) {
151
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key"); // ApplicationPublicKey authentication
152
+ }
153
+
154
+ const response = await this.request({
155
+ path: `/auth/users/change-password`,
156
+ method: 'POST',
157
+ headers: headerParameters,
158
+ query: queryParameters,
159
+ body: ChangePasswordRequestToJSON(requestParameters['changePasswordRequest']),
160
+ }, initOverrides);
161
+
162
+ return new runtime.JSONApiResponse(response, (jsonValue) => RefreshTokenResponseFromJSON(jsonValue));
163
+ }
164
+
165
+ /**
166
+ * Change the currently authenticated end user\'s password from a logged-in session. The caller must prove possession of the CURRENT password (`current_password`); the user is identified from the end-user token, not the request body, so a user can only change their own password. On success, all existing sessions are revoked and a fresh token pair is returned so the current session stays authenticated. Emits the `user.password_changed` webhook.
167
+ * Change password (authenticated session)
168
+ */
169
+ async changeEndUserPassword(changePasswordRequest: ChangePasswordRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RefreshTokenResponse> {
170
+ const response = await this.changeEndUserPasswordRaw({ changePasswordRequest: changePasswordRequest }, initOverrides);
171
+ return await response.value();
172
+ }
173
+
98
174
  /**
99
175
  * Delete the current end user account (GDPR right to erasure). This is a soft delete — the account is marked as deleted but data is retained for a period to allow for recovery or legal requirements.
100
176
  * Delete current end user account
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export * from './AuthApplicationApi';
3
4
  export * from './AuthEmailOTPApi';
4
5
  export * from './AuthEmailTemplatesApi';
5
6
  export * from './AuthEmailVerificationApi';