@poly-x/core 0.1.0-alpha.4 → 0.1.0-alpha.6

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.cjs CHANGED
@@ -769,7 +769,8 @@ function parsePasswordOutcome(status, body) {
769
769
  };
770
770
  if (status === 403 && b.userPasswordSet === true && typeof b.userId === "string") return {
771
771
  type: "password_change_required",
772
- userId: b.userId
772
+ userId: b.userId,
773
+ ticket: typeof b.ticket === "string" ? b.ticket : void 0
773
774
  };
774
775
  if (status === 403) return { type: "no_access" };
775
776
  return { type: "invalid_credentials" };
@@ -927,7 +928,8 @@ var AuthClient = class {
927
928
  body: {
928
929
  userId: params.userId,
929
930
  newPassword: params.newPassword,
930
- confirmPassword: params.confirmPassword
931
+ confirmPassword: params.confirmPassword,
932
+ ...params.ticket ? { ticket: params.ticket } : {}
931
933
  }
932
934
  });
933
935
  if (response.status !== 200) throw this.toError(response);
package/dist/index.d.cts CHANGED
@@ -447,6 +447,7 @@ type PasswordAuthOutcome = {
447
447
  } | {
448
448
  type: "password_change_required";
449
449
  userId: string;
450
+ ticket?: string;
450
451
  } | {
451
452
  type: "no_access";
452
453
  };
@@ -506,6 +507,12 @@ interface SetPasswordParams {
506
507
  userId: string;
507
508
  newPassword: string;
508
509
  confirmPassword: string;
510
+ /**
511
+ * Single-use proof-of-possession ticket from the `password_change_required`
512
+ * outcome. When present the platform trusts the ticket over `userId`; when the
513
+ * backend enforces tickets, it's required. Omit against older backends.
514
+ */
515
+ ticket?: string;
509
516
  }
510
517
  interface AuthorizeWithPasswordParams {
511
518
  email: string;
package/dist/index.d.mts CHANGED
@@ -447,6 +447,7 @@ type PasswordAuthOutcome = {
447
447
  } | {
448
448
  type: "password_change_required";
449
449
  userId: string;
450
+ ticket?: string;
450
451
  } | {
451
452
  type: "no_access";
452
453
  };
@@ -506,6 +507,12 @@ interface SetPasswordParams {
506
507
  userId: string;
507
508
  newPassword: string;
508
509
  confirmPassword: string;
510
+ /**
511
+ * Single-use proof-of-possession ticket from the `password_change_required`
512
+ * outcome. When present the platform trusts the ticket over `userId`; when the
513
+ * backend enforces tickets, it's required. Omit against older backends.
514
+ */
515
+ ticket?: string;
509
516
  }
510
517
  interface AuthorizeWithPasswordParams {
511
518
  email: string;
package/dist/index.mjs CHANGED
@@ -768,7 +768,8 @@ function parsePasswordOutcome(status, body) {
768
768
  };
769
769
  if (status === 403 && b.userPasswordSet === true && typeof b.userId === "string") return {
770
770
  type: "password_change_required",
771
- userId: b.userId
771
+ userId: b.userId,
772
+ ticket: typeof b.ticket === "string" ? b.ticket : void 0
772
773
  };
773
774
  if (status === 403) return { type: "no_access" };
774
775
  return { type: "invalid_credentials" };
@@ -926,7 +927,8 @@ var AuthClient = class {
926
927
  body: {
927
928
  userId: params.userId,
928
929
  newPassword: params.newPassword,
929
- confirmPassword: params.confirmPassword
930
+ confirmPassword: params.confirmPassword,
931
+ ...params.ticket ? { ticket: params.ticket } : {}
930
932
  }
931
933
  });
932
934
  if (response.status !== 200) throw this.toError(response);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poly-x/core",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.6",
4
4
  "description": "Framework-agnostic core of the PolyX SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",