@zyphr-dev/node-sdk 0.1.43 → 0.1.44
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/README.md +6 -4
- package/dist/index.cjs +277 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +326 -13
- package/dist/index.d.ts +326 -13
- package/dist/index.js +254 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/.openapi-generator/FILES +5 -0
- package/src/client.ts +18 -3
- package/src/clientAuth.ts +45 -12
- package/src/src/apis/AuthApplicationApi.ts +93 -0
- package/src/src/apis/AuthEmailTemplatesApi.ts +4 -4
- package/src/src/apis/AuthUserDirectoryApi.ts +66 -0
- package/src/src/apis/index.ts +1 -0
- package/src/src/models/ApplicationSelf.ts +118 -0
- package/src/src/models/ApplicationSelfResponse.ts +88 -0
- package/src/src/models/AuthEmailTemplateTestRequest.ts +1 -1
- package/src/src/models/AuthMethods.ts +111 -0
- package/src/src/models/GetEndUserAuthMethods200Response.ts +88 -0
- package/src/src/models/index.ts +4 -0
package/README.md
CHANGED
|
@@ -381,16 +381,18 @@ await zyphr.devices.deleteUserDevices('user_123');
|
|
|
381
381
|
|
|
382
382
|
Full Auth-as-a-Service API for end-user authentication: registration, login, MFA, magic links, OAuth, and more.
|
|
383
383
|
|
|
384
|
-
> **Important:** Auth endpoints
|
|
384
|
+
> **Important:** Auth endpoints use **Application-scoped** credentials (`X-Application-Key` + `X-Application-Secret`), which are distinct from the **Project-scoped** notification API key (`zy_live_*` / `zy_test_*`, sent as `Authorization: Bearer`). Create an application in the Zyphr dashboard first, then pass the credentials when constructing the client:
|
|
385
385
|
|
|
386
386
|
```ts
|
|
387
387
|
const zyphr = new Zyphr({
|
|
388
|
-
apiKey: process.env.ZYPHR_API_KEY!,
|
|
389
|
-
applicationKey: process.env.ZYPHR_APP_PUBLIC_KEY!,
|
|
390
|
-
applicationSecret: process.env.ZYPHR_APP_SECRET_KEY!, //
|
|
388
|
+
apiKey: process.env.ZYPHR_API_KEY!, // Project-scoped: zy_live_* / zy_test_*
|
|
389
|
+
applicationKey: process.env.ZYPHR_APP_PUBLIC_KEY!, // Application-scoped public: za_live_pub_* / za_test_pub_*
|
|
390
|
+
applicationSecret: process.env.ZYPHR_APP_SECRET_KEY!, // Application-scoped secret: za_live_sec_* / za_test_sec_*
|
|
391
391
|
});
|
|
392
392
|
```
|
|
393
393
|
|
|
394
|
+
> Legacy `za_pub_*` / `za_sec_*` application-key prefixes are deprecated but still accepted.
|
|
395
|
+
|
|
394
396
|
> **Common mistake:** `POST /v1/auth/register` creates a **platform account** (for the Zyphr dashboard). To register **end users** in your application, use `POST /v1/auth/users/register` via `zyphr.auth.registration.registerEndUser()`.
|
|
395
397
|
|
|
396
398
|
```ts
|
package/dist/index.cjs
CHANGED
|
@@ -61,6 +61,17 @@ __export(index_exports, {
|
|
|
61
61
|
ApiErrorMetaToJSONTyped: () => ApiErrorMetaToJSONTyped,
|
|
62
62
|
ApiErrorToJSON: () => ApiErrorToJSON,
|
|
63
63
|
ApiErrorToJSONTyped: () => ApiErrorToJSONTyped,
|
|
64
|
+
ApplicationSelfEnvironmentEnum: () => ApplicationSelfEnvironmentEnum,
|
|
65
|
+
ApplicationSelfFromJSON: () => ApplicationSelfFromJSON,
|
|
66
|
+
ApplicationSelfFromJSONTyped: () => ApplicationSelfFromJSONTyped,
|
|
67
|
+
ApplicationSelfResponseFromJSON: () => ApplicationSelfResponseFromJSON,
|
|
68
|
+
ApplicationSelfResponseFromJSONTyped: () => ApplicationSelfResponseFromJSONTyped,
|
|
69
|
+
ApplicationSelfResponseToJSON: () => ApplicationSelfResponseToJSON,
|
|
70
|
+
ApplicationSelfResponseToJSONTyped: () => ApplicationSelfResponseToJSONTyped,
|
|
71
|
+
ApplicationSelfSigningAlgorithmEnum: () => ApplicationSelfSigningAlgorithmEnum,
|
|
72
|
+
ApplicationSelfToJSON: () => ApplicationSelfToJSON,
|
|
73
|
+
ApplicationSelfToJSONTyped: () => ApplicationSelfToJSONTyped,
|
|
74
|
+
AuthApplicationApi: () => AuthApplicationApi,
|
|
64
75
|
AuthEmailOTPApi: () => AuthEmailOTPApi,
|
|
65
76
|
AuthEmailTemplateDefaultFromJSON: () => AuthEmailTemplateDefaultFromJSON,
|
|
66
77
|
AuthEmailTemplateDefaultFromJSONTyped: () => AuthEmailTemplateDefaultFromJSONTyped,
|
|
@@ -150,6 +161,10 @@ __export(index_exports, {
|
|
|
150
161
|
AuthLoginResultToJSONTyped: () => AuthLoginResultToJSONTyped,
|
|
151
162
|
AuthMFAApi: () => AuthMFAApi,
|
|
152
163
|
AuthMagicLinksApi: () => AuthMagicLinksApi,
|
|
164
|
+
AuthMethodsFromJSON: () => AuthMethodsFromJSON,
|
|
165
|
+
AuthMethodsFromJSONTyped: () => AuthMethodsFromJSONTyped,
|
|
166
|
+
AuthMethodsToJSON: () => AuthMethodsToJSON,
|
|
167
|
+
AuthMethodsToJSONTyped: () => AuthMethodsToJSONTyped,
|
|
153
168
|
AuthOAuthApi: () => AuthOAuthApi,
|
|
154
169
|
AuthOrganizationsApi: () => AuthOrganizationsApi,
|
|
155
170
|
AuthPasswordResetApi: () => AuthPasswordResetApi,
|
|
@@ -557,6 +572,10 @@ __export(index_exports, {
|
|
|
557
572
|
GetDomain200ResponseMetaToJSONTyped: () => GetDomain200ResponseMetaToJSONTyped,
|
|
558
573
|
GetDomain200ResponseToJSON: () => GetDomain200ResponseToJSON,
|
|
559
574
|
GetDomain200ResponseToJSONTyped: () => GetDomain200ResponseToJSONTyped,
|
|
575
|
+
GetEndUserAuthMethods200ResponseFromJSON: () => GetEndUserAuthMethods200ResponseFromJSON,
|
|
576
|
+
GetEndUserAuthMethods200ResponseFromJSONTyped: () => GetEndUserAuthMethods200ResponseFromJSONTyped,
|
|
577
|
+
GetEndUserAuthMethods200ResponseToJSON: () => GetEndUserAuthMethods200ResponseToJSON,
|
|
578
|
+
GetEndUserAuthMethods200ResponseToJSONTyped: () => GetEndUserAuthMethods200ResponseToJSONTyped,
|
|
560
579
|
GetEndUserById200ResponseFromJSON: () => GetEndUserById200ResponseFromJSON,
|
|
561
580
|
GetEndUserById200ResponseFromJSONTyped: () => GetEndUserById200ResponseFromJSONTyped,
|
|
562
581
|
GetEndUserById200ResponseToJSON: () => GetEndUserById200ResponseToJSON,
|
|
@@ -2139,6 +2158,8 @@ __export(index_exports, {
|
|
|
2139
2158
|
instanceOfApiError: () => instanceOfApiError,
|
|
2140
2159
|
instanceOfApiErrorError: () => instanceOfApiErrorError,
|
|
2141
2160
|
instanceOfApiErrorMeta: () => instanceOfApiErrorMeta,
|
|
2161
|
+
instanceOfApplicationSelf: () => instanceOfApplicationSelf,
|
|
2162
|
+
instanceOfApplicationSelfResponse: () => instanceOfApplicationSelfResponse,
|
|
2142
2163
|
instanceOfAuthEmailTemplate: () => instanceOfAuthEmailTemplate,
|
|
2143
2164
|
instanceOfAuthEmailTemplateDefault: () => instanceOfAuthEmailTemplateDefault,
|
|
2144
2165
|
instanceOfAuthEmailTemplateDefaultResponse: () => instanceOfAuthEmailTemplateDefaultResponse,
|
|
@@ -2159,6 +2180,7 @@ __export(index_exports, {
|
|
|
2159
2180
|
instanceOfAuthLoginResponse: () => instanceOfAuthLoginResponse,
|
|
2160
2181
|
instanceOfAuthLoginResult: () => instanceOfAuthLoginResult,
|
|
2161
2182
|
instanceOfAuthLoginResultMfaChallenge: () => instanceOfAuthLoginResultMfaChallenge,
|
|
2183
|
+
instanceOfAuthMethods: () => instanceOfAuthMethods,
|
|
2162
2184
|
instanceOfAuthResult: () => instanceOfAuthResult,
|
|
2163
2185
|
instanceOfAuthResultResponse: () => instanceOfAuthResultResponse,
|
|
2164
2186
|
instanceOfAuthSession: () => instanceOfAuthSession,
|
|
@@ -2251,6 +2273,7 @@ __export(index_exports, {
|
|
|
2251
2273
|
instanceOfGenerateWaaSPortalToken201Response: () => instanceOfGenerateWaaSPortalToken201Response,
|
|
2252
2274
|
instanceOfGetDomain200Response: () => instanceOfGetDomain200Response,
|
|
2253
2275
|
instanceOfGetDomain200ResponseMeta: () => instanceOfGetDomain200ResponseMeta,
|
|
2276
|
+
instanceOfGetEndUserAuthMethods200Response: () => instanceOfGetEndUserAuthMethods200Response,
|
|
2254
2277
|
instanceOfGetEndUserById200Response: () => instanceOfGetEndUserById200Response,
|
|
2255
2278
|
instanceOfGetEndUserClaims200Response: () => instanceOfGetEndUserClaims200Response,
|
|
2256
2279
|
instanceOfGetEndUserClaims200ResponseData: () => instanceOfGetEndUserClaims200ResponseData,
|
|
@@ -3476,6 +3499,81 @@ function ApiErrorToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
3476
3499
|
};
|
|
3477
3500
|
}
|
|
3478
3501
|
|
|
3502
|
+
// src/src/models/ApplicationSelf.ts
|
|
3503
|
+
var ApplicationSelfEnvironmentEnum = {
|
|
3504
|
+
TEST: "test",
|
|
3505
|
+
LIVE: "live"
|
|
3506
|
+
};
|
|
3507
|
+
var ApplicationSelfSigningAlgorithmEnum = {
|
|
3508
|
+
HS256: "HS256",
|
|
3509
|
+
RS256: "RS256",
|
|
3510
|
+
ES256: "ES256"
|
|
3511
|
+
};
|
|
3512
|
+
function instanceOfApplicationSelf(value) {
|
|
3513
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
3514
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
3515
|
+
if (!("environment" in value) || value["environment"] === void 0) return false;
|
|
3516
|
+
if (!("signingAlgorithm" in value) || value["signingAlgorithm"] === void 0) return false;
|
|
3517
|
+
return true;
|
|
3518
|
+
}
|
|
3519
|
+
function ApplicationSelfFromJSON(json) {
|
|
3520
|
+
return ApplicationSelfFromJSONTyped(json, false);
|
|
3521
|
+
}
|
|
3522
|
+
function ApplicationSelfFromJSONTyped(json, ignoreDiscriminator) {
|
|
3523
|
+
if (json == null) {
|
|
3524
|
+
return json;
|
|
3525
|
+
}
|
|
3526
|
+
return {
|
|
3527
|
+
"id": json["id"],
|
|
3528
|
+
"name": json["name"],
|
|
3529
|
+
"environment": json["environment"],
|
|
3530
|
+
"signingAlgorithm": json["signing_algorithm"]
|
|
3531
|
+
};
|
|
3532
|
+
}
|
|
3533
|
+
function ApplicationSelfToJSON(json) {
|
|
3534
|
+
return ApplicationSelfToJSONTyped(json, false);
|
|
3535
|
+
}
|
|
3536
|
+
function ApplicationSelfToJSONTyped(value, ignoreDiscriminator = false) {
|
|
3537
|
+
if (value == null) {
|
|
3538
|
+
return value;
|
|
3539
|
+
}
|
|
3540
|
+
return {
|
|
3541
|
+
"id": value["id"],
|
|
3542
|
+
"name": value["name"],
|
|
3543
|
+
"environment": value["environment"],
|
|
3544
|
+
"signing_algorithm": value["signingAlgorithm"]
|
|
3545
|
+
};
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
// src/src/models/ApplicationSelfResponse.ts
|
|
3549
|
+
function instanceOfApplicationSelfResponse(value) {
|
|
3550
|
+
return true;
|
|
3551
|
+
}
|
|
3552
|
+
function ApplicationSelfResponseFromJSON(json) {
|
|
3553
|
+
return ApplicationSelfResponseFromJSONTyped(json, false);
|
|
3554
|
+
}
|
|
3555
|
+
function ApplicationSelfResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
3556
|
+
if (json == null) {
|
|
3557
|
+
return json;
|
|
3558
|
+
}
|
|
3559
|
+
return {
|
|
3560
|
+
"data": json["data"] == null ? void 0 : ApplicationSelfFromJSON(json["data"]),
|
|
3561
|
+
"meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
|
|
3562
|
+
};
|
|
3563
|
+
}
|
|
3564
|
+
function ApplicationSelfResponseToJSON(json) {
|
|
3565
|
+
return ApplicationSelfResponseToJSONTyped(json, false);
|
|
3566
|
+
}
|
|
3567
|
+
function ApplicationSelfResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
3568
|
+
if (value == null) {
|
|
3569
|
+
return value;
|
|
3570
|
+
}
|
|
3571
|
+
return {
|
|
3572
|
+
"data": ApplicationSelfToJSON(value["data"]),
|
|
3573
|
+
"meta": RequestMetaToJSON(value["meta"])
|
|
3574
|
+
};
|
|
3575
|
+
}
|
|
3576
|
+
|
|
3479
3577
|
// src/src/models/AuthEmailType.ts
|
|
3480
3578
|
var AuthEmailType = {
|
|
3481
3579
|
MAGIC_LINK: "magic_link",
|
|
@@ -4224,6 +4322,49 @@ function AuthLoginResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
4224
4322
|
};
|
|
4225
4323
|
}
|
|
4226
4324
|
|
|
4325
|
+
// src/src/models/AuthMethods.ts
|
|
4326
|
+
function instanceOfAuthMethods(value) {
|
|
4327
|
+
if (!("hasPassword" in value) || value["hasPassword"] === void 0) return false;
|
|
4328
|
+
if (!("oauthProviders" in value) || value["oauthProviders"] === void 0) return false;
|
|
4329
|
+
if (!("mfaEnabled" in value) || value["mfaEnabled"] === void 0) return false;
|
|
4330
|
+
if (!("emailVerified" in value) || value["emailVerified"] === void 0) return false;
|
|
4331
|
+
if (!("phoneVerified" in value) || value["phoneVerified"] === void 0) return false;
|
|
4332
|
+
if (!("passkeys" in value) || value["passkeys"] === void 0) return false;
|
|
4333
|
+
return true;
|
|
4334
|
+
}
|
|
4335
|
+
function AuthMethodsFromJSON(json) {
|
|
4336
|
+
return AuthMethodsFromJSONTyped(json, false);
|
|
4337
|
+
}
|
|
4338
|
+
function AuthMethodsFromJSONTyped(json, ignoreDiscriminator) {
|
|
4339
|
+
if (json == null) {
|
|
4340
|
+
return json;
|
|
4341
|
+
}
|
|
4342
|
+
return {
|
|
4343
|
+
"hasPassword": json["has_password"],
|
|
4344
|
+
"oauthProviders": json["oauth_providers"],
|
|
4345
|
+
"mfaEnabled": json["mfa_enabled"],
|
|
4346
|
+
"emailVerified": json["email_verified"],
|
|
4347
|
+
"phoneVerified": json["phone_verified"],
|
|
4348
|
+
"passkeys": json["passkeys"]
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
function AuthMethodsToJSON(json) {
|
|
4352
|
+
return AuthMethodsToJSONTyped(json, false);
|
|
4353
|
+
}
|
|
4354
|
+
function AuthMethodsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
4355
|
+
if (value == null) {
|
|
4356
|
+
return value;
|
|
4357
|
+
}
|
|
4358
|
+
return {
|
|
4359
|
+
"has_password": value["hasPassword"],
|
|
4360
|
+
"oauth_providers": value["oauthProviders"],
|
|
4361
|
+
"mfa_enabled": value["mfaEnabled"],
|
|
4362
|
+
"email_verified": value["emailVerified"],
|
|
4363
|
+
"phone_verified": value["phoneVerified"],
|
|
4364
|
+
"passkeys": value["passkeys"]
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4367
|
+
|
|
4227
4368
|
// src/src/models/AuthResult.ts
|
|
4228
4369
|
function instanceOfAuthResult(value) {
|
|
4229
4370
|
return true;
|
|
@@ -7632,6 +7773,35 @@ function GetDomain200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
7632
7773
|
};
|
|
7633
7774
|
}
|
|
7634
7775
|
|
|
7776
|
+
// src/src/models/GetEndUserAuthMethods200Response.ts
|
|
7777
|
+
function instanceOfGetEndUserAuthMethods200Response(value) {
|
|
7778
|
+
return true;
|
|
7779
|
+
}
|
|
7780
|
+
function GetEndUserAuthMethods200ResponseFromJSON(json) {
|
|
7781
|
+
return GetEndUserAuthMethods200ResponseFromJSONTyped(json, false);
|
|
7782
|
+
}
|
|
7783
|
+
function GetEndUserAuthMethods200ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
7784
|
+
if (json == null) {
|
|
7785
|
+
return json;
|
|
7786
|
+
}
|
|
7787
|
+
return {
|
|
7788
|
+
"data": json["data"] == null ? void 0 : AuthMethodsFromJSON(json["data"]),
|
|
7789
|
+
"meta": json["meta"] == null ? void 0 : GetDomain200ResponseMetaFromJSON(json["meta"])
|
|
7790
|
+
};
|
|
7791
|
+
}
|
|
7792
|
+
function GetEndUserAuthMethods200ResponseToJSON(json) {
|
|
7793
|
+
return GetEndUserAuthMethods200ResponseToJSONTyped(json, false);
|
|
7794
|
+
}
|
|
7795
|
+
function GetEndUserAuthMethods200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
7796
|
+
if (value == null) {
|
|
7797
|
+
return value;
|
|
7798
|
+
}
|
|
7799
|
+
return {
|
|
7800
|
+
"data": AuthMethodsToJSON(value["data"]),
|
|
7801
|
+
"meta": GetDomain200ResponseMetaToJSON(value["meta"])
|
|
7802
|
+
};
|
|
7803
|
+
}
|
|
7804
|
+
|
|
7635
7805
|
// src/src/models/GetEndUserById200Response.ts
|
|
7636
7806
|
function instanceOfGetEndUserById200Response(value) {
|
|
7637
7807
|
return true;
|
|
@@ -19184,6 +19354,39 @@ function WithdrawSubscriberConsentRequestToJSONTyped(value, ignoreDiscriminator
|
|
|
19184
19354
|
};
|
|
19185
19355
|
}
|
|
19186
19356
|
|
|
19357
|
+
// src/src/apis/AuthApplicationApi.ts
|
|
19358
|
+
var AuthApplicationApi = class extends BaseAPI {
|
|
19359
|
+
/**
|
|
19360
|
+
* 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.
|
|
19361
|
+
* Get the authenticating application
|
|
19362
|
+
*/
|
|
19363
|
+
async getSelfApplicationRaw(initOverrides) {
|
|
19364
|
+
const queryParameters = {};
|
|
19365
|
+
const headerParameters = {};
|
|
19366
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19367
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
19368
|
+
}
|
|
19369
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
19370
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
19371
|
+
}
|
|
19372
|
+
const response = await this.request({
|
|
19373
|
+
path: `/auth/application`,
|
|
19374
|
+
method: "GET",
|
|
19375
|
+
headers: headerParameters,
|
|
19376
|
+
query: queryParameters
|
|
19377
|
+
}, initOverrides);
|
|
19378
|
+
return new JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
|
|
19379
|
+
}
|
|
19380
|
+
/**
|
|
19381
|
+
* 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.
|
|
19382
|
+
* Get the authenticating application
|
|
19383
|
+
*/
|
|
19384
|
+
async getSelfApplication(initOverrides) {
|
|
19385
|
+
const response = await this.getSelfApplicationRaw(initOverrides);
|
|
19386
|
+
return await response.value();
|
|
19387
|
+
}
|
|
19388
|
+
};
|
|
19389
|
+
|
|
19187
19390
|
// src/src/apis/AuthEmailOTPApi.ts
|
|
19188
19391
|
var AuthEmailOTPApi = class extends BaseAPI {
|
|
19189
19392
|
/**
|
|
@@ -19647,7 +19850,7 @@ var AuthEmailTemplatesApi = class extends BaseAPI {
|
|
|
19647
19850
|
return await response.value();
|
|
19648
19851
|
}
|
|
19649
19852
|
/**
|
|
19650
|
-
* 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.
|
|
19853
|
+
* 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.
|
|
19651
19854
|
* Send a test render of a template
|
|
19652
19855
|
*/
|
|
19653
19856
|
async sendAuthEmailTemplateTestRaw(requestParameters, initOverrides) {
|
|
@@ -19682,7 +19885,7 @@ var AuthEmailTemplatesApi = class extends BaseAPI {
|
|
|
19682
19885
|
return new JSONApiResponse(response, (jsonValue) => AuthEmailTemplateTestResponseFromJSON(jsonValue));
|
|
19683
19886
|
}
|
|
19684
19887
|
/**
|
|
19685
|
-
* 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.
|
|
19888
|
+
* 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.
|
|
19686
19889
|
* Send a test render of a template
|
|
19687
19890
|
*/
|
|
19688
19891
|
async sendAuthEmailTemplateTest(type, authEmailTemplateTestRequest, initOverrides) {
|
|
@@ -21613,6 +21816,41 @@ var AuthUserDirectoryApi = class extends BaseAPI {
|
|
|
21613
21816
|
async deleteEndUserByApplication(userId, initOverrides) {
|
|
21614
21817
|
await this.deleteEndUserByApplicationRaw({ userId }, initOverrides);
|
|
21615
21818
|
}
|
|
21819
|
+
/**
|
|
21820
|
+
* 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.
|
|
21821
|
+
* Get an end user\'s sign-in methods (server-side admin)
|
|
21822
|
+
*/
|
|
21823
|
+
async getEndUserAuthMethodsRaw(requestParameters, initOverrides) {
|
|
21824
|
+
if (requestParameters["userId"] == null) {
|
|
21825
|
+
throw new RequiredError(
|
|
21826
|
+
"userId",
|
|
21827
|
+
'Required parameter "userId" was null or undefined when calling getEndUserAuthMethods().'
|
|
21828
|
+
);
|
|
21829
|
+
}
|
|
21830
|
+
const queryParameters = {};
|
|
21831
|
+
const headerParameters = {};
|
|
21832
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
21833
|
+
headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
|
|
21834
|
+
}
|
|
21835
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
21836
|
+
headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
|
|
21837
|
+
}
|
|
21838
|
+
const response = await this.request({
|
|
21839
|
+
path: `/auth/users/{user_id}/auth-methods`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
|
|
21840
|
+
method: "GET",
|
|
21841
|
+
headers: headerParameters,
|
|
21842
|
+
query: queryParameters
|
|
21843
|
+
}, initOverrides);
|
|
21844
|
+
return new JSONApiResponse(response, (jsonValue) => GetEndUserAuthMethods200ResponseFromJSON(jsonValue));
|
|
21845
|
+
}
|
|
21846
|
+
/**
|
|
21847
|
+
* 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.
|
|
21848
|
+
* Get an end user\'s sign-in methods (server-side admin)
|
|
21849
|
+
*/
|
|
21850
|
+
async getEndUserAuthMethods(userId, initOverrides) {
|
|
21851
|
+
const response = await this.getEndUserAuthMethodsRaw({ userId }, initOverrides);
|
|
21852
|
+
return await response.value();
|
|
21853
|
+
}
|
|
21616
21854
|
/**
|
|
21617
21855
|
* 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.
|
|
21618
21856
|
* Look up an end user by email (server-side admin)
|
|
@@ -28471,7 +28709,8 @@ var Zyphr = class {
|
|
|
28471
28709
|
emailOtp: new AuthEmailOTPApi(config),
|
|
28472
28710
|
profile: new AuthUserProfileApi(config),
|
|
28473
28711
|
userDirectory: new AuthUserDirectoryApi(config),
|
|
28474
|
-
webauthn: new AuthWebAuthnApi(config)
|
|
28712
|
+
webauthn: new AuthWebAuthnApi(config),
|
|
28713
|
+
application: new AuthApplicationApi(config)
|
|
28475
28714
|
};
|
|
28476
28715
|
}
|
|
28477
28716
|
/**
|
|
@@ -28518,7 +28757,14 @@ var ZyphrClientCredentialError = class extends Error {
|
|
|
28518
28757
|
this.name = "ZyphrClientCredentialError";
|
|
28519
28758
|
}
|
|
28520
28759
|
};
|
|
28521
|
-
var
|
|
28760
|
+
var PUBLISHABLE_KEY_PREFIXES = ["za_live_pub_", "za_test_pub_", "za_pub_"];
|
|
28761
|
+
var SECRET_KEY_PREFIXES = [
|
|
28762
|
+
"za_live_sec_",
|
|
28763
|
+
"za_test_sec_",
|
|
28764
|
+
"za_sec_",
|
|
28765
|
+
"zy_live_",
|
|
28766
|
+
"zy_test_"
|
|
28767
|
+
];
|
|
28522
28768
|
var ZyphrClient = class {
|
|
28523
28769
|
auth;
|
|
28524
28770
|
/** Device registration for push (takes an OS-acquired token). */
|
|
@@ -28527,16 +28773,16 @@ var ZyphrClient = class {
|
|
|
28527
28773
|
accessToken;
|
|
28528
28774
|
constructor(options) {
|
|
28529
28775
|
if (!options.applicationKey) {
|
|
28530
|
-
throw new ZyphrClientCredentialError("applicationKey (
|
|
28776
|
+
throw new ZyphrClientCredentialError("applicationKey (za_live_pub_* / za_test_pub_*) is required");
|
|
28531
28777
|
}
|
|
28532
28778
|
if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
|
|
28533
28779
|
throw new ZyphrClientCredentialError(
|
|
28534
|
-
"ZyphrClient must be constructed with a publishable application key (
|
|
28780
|
+
"ZyphrClient must be constructed with a publishable application key (za_live_pub_* / za_test_pub_*), never a secret key. Secret keys must stay server-side."
|
|
28535
28781
|
);
|
|
28536
28782
|
}
|
|
28537
|
-
if (!options.applicationKey.startsWith(
|
|
28783
|
+
if (!PUBLISHABLE_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
|
|
28538
28784
|
throw new ZyphrClientCredentialError(
|
|
28539
|
-
"applicationKey must be a publishable application key (
|
|
28785
|
+
"applicationKey must be a publishable application key (za_live_pub_* / za_test_pub_*)."
|
|
28540
28786
|
);
|
|
28541
28787
|
}
|
|
28542
28788
|
this.applicationKey = options.applicationKey;
|
|
@@ -28641,6 +28887,17 @@ var SDK_VERSION = "0.1.0";
|
|
|
28641
28887
|
ApiErrorMetaToJSONTyped,
|
|
28642
28888
|
ApiErrorToJSON,
|
|
28643
28889
|
ApiErrorToJSONTyped,
|
|
28890
|
+
ApplicationSelfEnvironmentEnum,
|
|
28891
|
+
ApplicationSelfFromJSON,
|
|
28892
|
+
ApplicationSelfFromJSONTyped,
|
|
28893
|
+
ApplicationSelfResponseFromJSON,
|
|
28894
|
+
ApplicationSelfResponseFromJSONTyped,
|
|
28895
|
+
ApplicationSelfResponseToJSON,
|
|
28896
|
+
ApplicationSelfResponseToJSONTyped,
|
|
28897
|
+
ApplicationSelfSigningAlgorithmEnum,
|
|
28898
|
+
ApplicationSelfToJSON,
|
|
28899
|
+
ApplicationSelfToJSONTyped,
|
|
28900
|
+
AuthApplicationApi,
|
|
28644
28901
|
AuthEmailOTPApi,
|
|
28645
28902
|
AuthEmailTemplateDefaultFromJSON,
|
|
28646
28903
|
AuthEmailTemplateDefaultFromJSONTyped,
|
|
@@ -28730,6 +28987,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
28730
28987
|
AuthLoginResultToJSONTyped,
|
|
28731
28988
|
AuthMFAApi,
|
|
28732
28989
|
AuthMagicLinksApi,
|
|
28990
|
+
AuthMethodsFromJSON,
|
|
28991
|
+
AuthMethodsFromJSONTyped,
|
|
28992
|
+
AuthMethodsToJSON,
|
|
28993
|
+
AuthMethodsToJSONTyped,
|
|
28733
28994
|
AuthOAuthApi,
|
|
28734
28995
|
AuthOrganizationsApi,
|
|
28735
28996
|
AuthPasswordResetApi,
|
|
@@ -29137,6 +29398,10 @@ var SDK_VERSION = "0.1.0";
|
|
|
29137
29398
|
GetDomain200ResponseMetaToJSONTyped,
|
|
29138
29399
|
GetDomain200ResponseToJSON,
|
|
29139
29400
|
GetDomain200ResponseToJSONTyped,
|
|
29401
|
+
GetEndUserAuthMethods200ResponseFromJSON,
|
|
29402
|
+
GetEndUserAuthMethods200ResponseFromJSONTyped,
|
|
29403
|
+
GetEndUserAuthMethods200ResponseToJSON,
|
|
29404
|
+
GetEndUserAuthMethods200ResponseToJSONTyped,
|
|
29140
29405
|
GetEndUserById200ResponseFromJSON,
|
|
29141
29406
|
GetEndUserById200ResponseFromJSONTyped,
|
|
29142
29407
|
GetEndUserById200ResponseToJSON,
|
|
@@ -30719,6 +30984,8 @@ var SDK_VERSION = "0.1.0";
|
|
|
30719
30984
|
instanceOfApiError,
|
|
30720
30985
|
instanceOfApiErrorError,
|
|
30721
30986
|
instanceOfApiErrorMeta,
|
|
30987
|
+
instanceOfApplicationSelf,
|
|
30988
|
+
instanceOfApplicationSelfResponse,
|
|
30722
30989
|
instanceOfAuthEmailTemplate,
|
|
30723
30990
|
instanceOfAuthEmailTemplateDefault,
|
|
30724
30991
|
instanceOfAuthEmailTemplateDefaultResponse,
|
|
@@ -30739,6 +31006,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
30739
31006
|
instanceOfAuthLoginResponse,
|
|
30740
31007
|
instanceOfAuthLoginResult,
|
|
30741
31008
|
instanceOfAuthLoginResultMfaChallenge,
|
|
31009
|
+
instanceOfAuthMethods,
|
|
30742
31010
|
instanceOfAuthResult,
|
|
30743
31011
|
instanceOfAuthResultResponse,
|
|
30744
31012
|
instanceOfAuthSession,
|
|
@@ -30831,6 +31099,7 @@ var SDK_VERSION = "0.1.0";
|
|
|
30831
31099
|
instanceOfGenerateWaaSPortalToken201Response,
|
|
30832
31100
|
instanceOfGetDomain200Response,
|
|
30833
31101
|
instanceOfGetDomain200ResponseMeta,
|
|
31102
|
+
instanceOfGetEndUserAuthMethods200Response,
|
|
30834
31103
|
instanceOfGetEndUserById200Response,
|
|
30835
31104
|
instanceOfGetEndUserClaims200Response,
|
|
30836
31105
|
instanceOfGetEndUserClaims200ResponseData,
|