@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/dist/index.js CHANGED
@@ -850,6 +850,81 @@ function ApiErrorToJSONTyped(value, ignoreDiscriminator = false) {
850
850
  };
851
851
  }
852
852
 
853
+ // src/src/models/ApplicationSelf.ts
854
+ var ApplicationSelfEnvironmentEnum = {
855
+ TEST: "test",
856
+ LIVE: "live"
857
+ };
858
+ var ApplicationSelfSigningAlgorithmEnum = {
859
+ HS256: "HS256",
860
+ RS256: "RS256",
861
+ ES256: "ES256"
862
+ };
863
+ function instanceOfApplicationSelf(value) {
864
+ if (!("id" in value) || value["id"] === void 0) return false;
865
+ if (!("name" in value) || value["name"] === void 0) return false;
866
+ if (!("environment" in value) || value["environment"] === void 0) return false;
867
+ if (!("signingAlgorithm" in value) || value["signingAlgorithm"] === void 0) return false;
868
+ return true;
869
+ }
870
+ function ApplicationSelfFromJSON(json) {
871
+ return ApplicationSelfFromJSONTyped(json, false);
872
+ }
873
+ function ApplicationSelfFromJSONTyped(json, ignoreDiscriminator) {
874
+ if (json == null) {
875
+ return json;
876
+ }
877
+ return {
878
+ "id": json["id"],
879
+ "name": json["name"],
880
+ "environment": json["environment"],
881
+ "signingAlgorithm": json["signing_algorithm"]
882
+ };
883
+ }
884
+ function ApplicationSelfToJSON(json) {
885
+ return ApplicationSelfToJSONTyped(json, false);
886
+ }
887
+ function ApplicationSelfToJSONTyped(value, ignoreDiscriminator = false) {
888
+ if (value == null) {
889
+ return value;
890
+ }
891
+ return {
892
+ "id": value["id"],
893
+ "name": value["name"],
894
+ "environment": value["environment"],
895
+ "signing_algorithm": value["signingAlgorithm"]
896
+ };
897
+ }
898
+
899
+ // src/src/models/ApplicationSelfResponse.ts
900
+ function instanceOfApplicationSelfResponse(value) {
901
+ return true;
902
+ }
903
+ function ApplicationSelfResponseFromJSON(json) {
904
+ return ApplicationSelfResponseFromJSONTyped(json, false);
905
+ }
906
+ function ApplicationSelfResponseFromJSONTyped(json, ignoreDiscriminator) {
907
+ if (json == null) {
908
+ return json;
909
+ }
910
+ return {
911
+ "data": json["data"] == null ? void 0 : ApplicationSelfFromJSON(json["data"]),
912
+ "meta": json["meta"] == null ? void 0 : RequestMetaFromJSON(json["meta"])
913
+ };
914
+ }
915
+ function ApplicationSelfResponseToJSON(json) {
916
+ return ApplicationSelfResponseToJSONTyped(json, false);
917
+ }
918
+ function ApplicationSelfResponseToJSONTyped(value, ignoreDiscriminator = false) {
919
+ if (value == null) {
920
+ return value;
921
+ }
922
+ return {
923
+ "data": ApplicationSelfToJSON(value["data"]),
924
+ "meta": RequestMetaToJSON(value["meta"])
925
+ };
926
+ }
927
+
853
928
  // src/src/models/AuthEmailType.ts
854
929
  var AuthEmailType = {
855
930
  MAGIC_LINK: "magic_link",
@@ -1598,6 +1673,49 @@ function AuthLoginResponseToJSONTyped(value, ignoreDiscriminator = false) {
1598
1673
  };
1599
1674
  }
1600
1675
 
1676
+ // src/src/models/AuthMethods.ts
1677
+ function instanceOfAuthMethods(value) {
1678
+ if (!("hasPassword" in value) || value["hasPassword"] === void 0) return false;
1679
+ if (!("oauthProviders" in value) || value["oauthProviders"] === void 0) return false;
1680
+ if (!("mfaEnabled" in value) || value["mfaEnabled"] === void 0) return false;
1681
+ if (!("emailVerified" in value) || value["emailVerified"] === void 0) return false;
1682
+ if (!("phoneVerified" in value) || value["phoneVerified"] === void 0) return false;
1683
+ if (!("passkeys" in value) || value["passkeys"] === void 0) return false;
1684
+ return true;
1685
+ }
1686
+ function AuthMethodsFromJSON(json) {
1687
+ return AuthMethodsFromJSONTyped(json, false);
1688
+ }
1689
+ function AuthMethodsFromJSONTyped(json, ignoreDiscriminator) {
1690
+ if (json == null) {
1691
+ return json;
1692
+ }
1693
+ return {
1694
+ "hasPassword": json["has_password"],
1695
+ "oauthProviders": json["oauth_providers"],
1696
+ "mfaEnabled": json["mfa_enabled"],
1697
+ "emailVerified": json["email_verified"],
1698
+ "phoneVerified": json["phone_verified"],
1699
+ "passkeys": json["passkeys"]
1700
+ };
1701
+ }
1702
+ function AuthMethodsToJSON(json) {
1703
+ return AuthMethodsToJSONTyped(json, false);
1704
+ }
1705
+ function AuthMethodsToJSONTyped(value, ignoreDiscriminator = false) {
1706
+ if (value == null) {
1707
+ return value;
1708
+ }
1709
+ return {
1710
+ "has_password": value["hasPassword"],
1711
+ "oauth_providers": value["oauthProviders"],
1712
+ "mfa_enabled": value["mfaEnabled"],
1713
+ "email_verified": value["emailVerified"],
1714
+ "phone_verified": value["phoneVerified"],
1715
+ "passkeys": value["passkeys"]
1716
+ };
1717
+ }
1718
+
1601
1719
  // src/src/models/AuthResult.ts
1602
1720
  function instanceOfAuthResult(value) {
1603
1721
  return true;
@@ -5006,6 +5124,35 @@ function GetDomain200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
5006
5124
  };
5007
5125
  }
5008
5126
 
5127
+ // src/src/models/GetEndUserAuthMethods200Response.ts
5128
+ function instanceOfGetEndUserAuthMethods200Response(value) {
5129
+ return true;
5130
+ }
5131
+ function GetEndUserAuthMethods200ResponseFromJSON(json) {
5132
+ return GetEndUserAuthMethods200ResponseFromJSONTyped(json, false);
5133
+ }
5134
+ function GetEndUserAuthMethods200ResponseFromJSONTyped(json, ignoreDiscriminator) {
5135
+ if (json == null) {
5136
+ return json;
5137
+ }
5138
+ return {
5139
+ "data": json["data"] == null ? void 0 : AuthMethodsFromJSON(json["data"]),
5140
+ "meta": json["meta"] == null ? void 0 : GetDomain200ResponseMetaFromJSON(json["meta"])
5141
+ };
5142
+ }
5143
+ function GetEndUserAuthMethods200ResponseToJSON(json) {
5144
+ return GetEndUserAuthMethods200ResponseToJSONTyped(json, false);
5145
+ }
5146
+ function GetEndUserAuthMethods200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
5147
+ if (value == null) {
5148
+ return value;
5149
+ }
5150
+ return {
5151
+ "data": AuthMethodsToJSON(value["data"]),
5152
+ "meta": GetDomain200ResponseMetaToJSON(value["meta"])
5153
+ };
5154
+ }
5155
+
5009
5156
  // src/src/models/GetEndUserById200Response.ts
5010
5157
  function instanceOfGetEndUserById200Response(value) {
5011
5158
  return true;
@@ -16558,6 +16705,39 @@ function WithdrawSubscriberConsentRequestToJSONTyped(value, ignoreDiscriminator
16558
16705
  };
16559
16706
  }
16560
16707
 
16708
+ // src/src/apis/AuthApplicationApi.ts
16709
+ var AuthApplicationApi = class extends BaseAPI {
16710
+ /**
16711
+ * 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.
16712
+ * Get the authenticating application
16713
+ */
16714
+ async getSelfApplicationRaw(initOverrides) {
16715
+ const queryParameters = {};
16716
+ const headerParameters = {};
16717
+ if (this.configuration && this.configuration.apiKey) {
16718
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
16719
+ }
16720
+ if (this.configuration && this.configuration.apiKey) {
16721
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
16722
+ }
16723
+ const response = await this.request({
16724
+ path: `/auth/application`,
16725
+ method: "GET",
16726
+ headers: headerParameters,
16727
+ query: queryParameters
16728
+ }, initOverrides);
16729
+ return new JSONApiResponse(response, (jsonValue) => ApplicationSelfResponseFromJSON(jsonValue));
16730
+ }
16731
+ /**
16732
+ * 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.
16733
+ * Get the authenticating application
16734
+ */
16735
+ async getSelfApplication(initOverrides) {
16736
+ const response = await this.getSelfApplicationRaw(initOverrides);
16737
+ return await response.value();
16738
+ }
16739
+ };
16740
+
16561
16741
  // src/src/apis/AuthEmailOTPApi.ts
16562
16742
  var AuthEmailOTPApi = class extends BaseAPI {
16563
16743
  /**
@@ -17021,7 +17201,7 @@ var AuthEmailTemplatesApi = class extends BaseAPI {
17021
17201
  return await response.value();
17022
17202
  }
17023
17203
  /**
17024
- * 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.
17204
+ * 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.
17025
17205
  * Send a test render of a template
17026
17206
  */
17027
17207
  async sendAuthEmailTemplateTestRaw(requestParameters, initOverrides) {
@@ -17056,7 +17236,7 @@ var AuthEmailTemplatesApi = class extends BaseAPI {
17056
17236
  return new JSONApiResponse(response, (jsonValue) => AuthEmailTemplateTestResponseFromJSON(jsonValue));
17057
17237
  }
17058
17238
  /**
17059
- * 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.
17239
+ * 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.
17060
17240
  * Send a test render of a template
17061
17241
  */
17062
17242
  async sendAuthEmailTemplateTest(type, authEmailTemplateTestRequest, initOverrides) {
@@ -18987,6 +19167,41 @@ var AuthUserDirectoryApi = class extends BaseAPI {
18987
19167
  async deleteEndUserByApplication(userId, initOverrides) {
18988
19168
  await this.deleteEndUserByApplicationRaw({ userId }, initOverrides);
18989
19169
  }
19170
+ /**
19171
+ * 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.
19172
+ * Get an end user\'s sign-in methods (server-side admin)
19173
+ */
19174
+ async getEndUserAuthMethodsRaw(requestParameters, initOverrides) {
19175
+ if (requestParameters["userId"] == null) {
19176
+ throw new RequiredError(
19177
+ "userId",
19178
+ 'Required parameter "userId" was null or undefined when calling getEndUserAuthMethods().'
19179
+ );
19180
+ }
19181
+ const queryParameters = {};
19182
+ const headerParameters = {};
19183
+ if (this.configuration && this.configuration.apiKey) {
19184
+ headerParameters["X-Application-Secret"] = await this.configuration.apiKey("X-Application-Secret");
19185
+ }
19186
+ if (this.configuration && this.configuration.apiKey) {
19187
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
19188
+ }
19189
+ const response = await this.request({
19190
+ path: `/auth/users/{user_id}/auth-methods`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters["userId"]))),
19191
+ method: "GET",
19192
+ headers: headerParameters,
19193
+ query: queryParameters
19194
+ }, initOverrides);
19195
+ return new JSONApiResponse(response, (jsonValue) => GetEndUserAuthMethods200ResponseFromJSON(jsonValue));
19196
+ }
19197
+ /**
19198
+ * 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.
19199
+ * Get an end user\'s sign-in methods (server-side admin)
19200
+ */
19201
+ async getEndUserAuthMethods(userId, initOverrides) {
19202
+ const response = await this.getEndUserAuthMethodsRaw({ userId }, initOverrides);
19203
+ return await response.value();
19204
+ }
18990
19205
  /**
18991
19206
  * 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.
18992
19207
  * Look up an end user by email (server-side admin)
@@ -25845,7 +26060,8 @@ var Zyphr = class {
25845
26060
  emailOtp: new AuthEmailOTPApi(config),
25846
26061
  profile: new AuthUserProfileApi(config),
25847
26062
  userDirectory: new AuthUserDirectoryApi(config),
25848
- webauthn: new AuthWebAuthnApi(config)
26063
+ webauthn: new AuthWebAuthnApi(config),
26064
+ application: new AuthApplicationApi(config)
25849
26065
  };
25850
26066
  }
25851
26067
  /**
@@ -25892,7 +26108,14 @@ var ZyphrClientCredentialError = class extends Error {
25892
26108
  this.name = "ZyphrClientCredentialError";
25893
26109
  }
25894
26110
  };
25895
- var SECRET_KEY_PREFIXES = ["za_sec_", "zy_live_", "zy_test_"];
26111
+ var PUBLISHABLE_KEY_PREFIXES = ["za_live_pub_", "za_test_pub_", "za_pub_"];
26112
+ var SECRET_KEY_PREFIXES = [
26113
+ "za_live_sec_",
26114
+ "za_test_sec_",
26115
+ "za_sec_",
26116
+ "zy_live_",
26117
+ "zy_test_"
26118
+ ];
25896
26119
  var ZyphrClient = class {
25897
26120
  auth;
25898
26121
  /** Device registration for push (takes an OS-acquired token). */
@@ -25901,16 +26124,16 @@ var ZyphrClient = class {
25901
26124
  accessToken;
25902
26125
  constructor(options) {
25903
26126
  if (!options.applicationKey) {
25904
- throw new ZyphrClientCredentialError("applicationKey (za_pub_*) is required");
26127
+ throw new ZyphrClientCredentialError("applicationKey (za_live_pub_* / za_test_pub_*) is required");
25905
26128
  }
25906
26129
  if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
25907
26130
  throw new ZyphrClientCredentialError(
25908
- "ZyphrClient must be constructed with a publishable application key (za_pub_*), never a secret key. Secret keys must stay server-side."
26131
+ "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."
25909
26132
  );
25910
26133
  }
25911
- if (!options.applicationKey.startsWith("za_pub_")) {
26134
+ if (!PUBLISHABLE_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
25912
26135
  throw new ZyphrClientCredentialError(
25913
- "applicationKey must be a publishable application key (za_pub_*)."
26136
+ "applicationKey must be a publishable application key (za_live_pub_* / za_test_pub_*)."
25914
26137
  );
25915
26138
  }
25916
26139
  this.applicationKey = options.applicationKey;
@@ -26014,6 +26237,17 @@ export {
26014
26237
  ApiErrorMetaToJSONTyped,
26015
26238
  ApiErrorToJSON,
26016
26239
  ApiErrorToJSONTyped,
26240
+ ApplicationSelfEnvironmentEnum,
26241
+ ApplicationSelfFromJSON,
26242
+ ApplicationSelfFromJSONTyped,
26243
+ ApplicationSelfResponseFromJSON,
26244
+ ApplicationSelfResponseFromJSONTyped,
26245
+ ApplicationSelfResponseToJSON,
26246
+ ApplicationSelfResponseToJSONTyped,
26247
+ ApplicationSelfSigningAlgorithmEnum,
26248
+ ApplicationSelfToJSON,
26249
+ ApplicationSelfToJSONTyped,
26250
+ AuthApplicationApi,
26017
26251
  AuthEmailOTPApi,
26018
26252
  AuthEmailTemplateDefaultFromJSON,
26019
26253
  AuthEmailTemplateDefaultFromJSONTyped,
@@ -26103,6 +26337,10 @@ export {
26103
26337
  AuthLoginResultToJSONTyped,
26104
26338
  AuthMFAApi,
26105
26339
  AuthMagicLinksApi,
26340
+ AuthMethodsFromJSON,
26341
+ AuthMethodsFromJSONTyped,
26342
+ AuthMethodsToJSON,
26343
+ AuthMethodsToJSONTyped,
26106
26344
  AuthOAuthApi,
26107
26345
  AuthOrganizationsApi,
26108
26346
  AuthPasswordResetApi,
@@ -26510,6 +26748,10 @@ export {
26510
26748
  GetDomain200ResponseMetaToJSONTyped,
26511
26749
  GetDomain200ResponseToJSON,
26512
26750
  GetDomain200ResponseToJSONTyped,
26751
+ GetEndUserAuthMethods200ResponseFromJSON,
26752
+ GetEndUserAuthMethods200ResponseFromJSONTyped,
26753
+ GetEndUserAuthMethods200ResponseToJSON,
26754
+ GetEndUserAuthMethods200ResponseToJSONTyped,
26513
26755
  GetEndUserById200ResponseFromJSON,
26514
26756
  GetEndUserById200ResponseFromJSONTyped,
26515
26757
  GetEndUserById200ResponseToJSON,
@@ -28092,6 +28334,8 @@ export {
28092
28334
  instanceOfApiError,
28093
28335
  instanceOfApiErrorError,
28094
28336
  instanceOfApiErrorMeta,
28337
+ instanceOfApplicationSelf,
28338
+ instanceOfApplicationSelfResponse,
28095
28339
  instanceOfAuthEmailTemplate,
28096
28340
  instanceOfAuthEmailTemplateDefault,
28097
28341
  instanceOfAuthEmailTemplateDefaultResponse,
@@ -28112,6 +28356,7 @@ export {
28112
28356
  instanceOfAuthLoginResponse,
28113
28357
  instanceOfAuthLoginResult,
28114
28358
  instanceOfAuthLoginResultMfaChallenge,
28359
+ instanceOfAuthMethods,
28115
28360
  instanceOfAuthResult,
28116
28361
  instanceOfAuthResultResponse,
28117
28362
  instanceOfAuthSession,
@@ -28204,6 +28449,7 @@ export {
28204
28449
  instanceOfGenerateWaaSPortalToken201Response,
28205
28450
  instanceOfGetDomain200Response,
28206
28451
  instanceOfGetDomain200ResponseMeta,
28452
+ instanceOfGetEndUserAuthMethods200Response,
28207
28453
  instanceOfGetEndUserById200Response,
28208
28454
  instanceOfGetEndUserClaims200Response,
28209
28455
  instanceOfGetEndUserClaims200ResponseData,