@palbase/web 7.1.0 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  __configure,
8
8
  getRuntime
9
- } from "../chunk-P6TWUWZC.js";
9
+ } from "../chunk-VXQUBBHG.js";
10
10
  import "../chunk-ACCJV6FV.js";
11
11
  import "../chunk-CFDU23TB.js";
12
12
  import "../chunk-PZ5AY32C.js";
@@ -964,6 +964,20 @@ var AuthClient = class {
964
964
  body: params
965
965
  });
966
966
  }
967
+ /**
968
+ * Give a PASSWORDLESS account its first password.
969
+ *
970
+ * Separate from `changePassword` because that one cannot serve the case: it
971
+ * sends a current password and palauth answers an account that has none with
972
+ * 401. Requires a RECENT sign-in (403 `reauthentication_required` otherwise,
973
+ * the same gate passkey enrollment carries); an account that already has a
974
+ * password gets 409 `password_already_set`.
975
+ */
976
+ async setPassword(params) {
977
+ return this.httpClient.request("POST", "/auth/password/set", {
978
+ body: params
979
+ });
980
+ }
967
981
  // ── Token ───────────────────────────────────────────────
968
982
  async refresh() {
969
983
  const refreshToken = this.tokenManager.getRefreshToken();
@@ -1974,6 +1988,26 @@ var PalbeAuth = class {
1974
1988
  })
1975
1989
  );
1976
1990
  }
1991
+ /**
1992
+ * Give a passwordless account its FIRST password, in-app.
1993
+ *
1994
+ * For accounts created with a passkey or a social provider: they have no
1995
+ * current password, so `updatePassword` cannot serve them — it sends one and
1996
+ * the server answers 401. Before this existed the only route was the
1997
+ * password-RESET e-mail, which asks someone already signed in to go find
1998
+ * their inbox.
1999
+ *
2000
+ * Requires a RECENT sign-in, not merely a session: a first password is a
2001
+ * credential that outlives the rest, so the server answers 403
2002
+ * `reauthentication_required` on a stale one — the same gate
2003
+ * `registerPasskey` carries. An account that already has a password gets 409
2004
+ * `password_already_set`; change it with `updatePassword` instead.
2005
+ *
2006
+ * The session stays valid — no re-login.
2007
+ */
2008
+ async setPassword(newPassword) {
2009
+ unwrap(await this.rt.authClient.setPassword({ new_password: newPassword }));
2010
+ }
1977
2011
  async verifyEmail(params) {
1978
2012
  unwrap(await this.rt.authClient.verifyEmail(params));
1979
2013
  }
@@ -9273,7 +9307,7 @@ function defaultSessionStorage(key) {
9273
9307
  }
9274
9308
 
9275
9309
  // src/version.ts
9276
- var VERSION = "7.1.0";
9310
+ var VERSION = "7.2.0";
9277
9311
 
9278
9312
  // src/runtime.ts
9279
9313
  function buildRuntime(config) {