@~lyre/auth 0.9.0 → 0.10.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.
package/dist/admin.d.ts CHANGED
@@ -175,11 +175,23 @@ declare class AccountsAdmin {
175
175
  appId?: string;
176
176
  profileData?: Record<string, string>;
177
177
  }): Promise<AccountsUser>;
178
- /** Change the signed-in user's password. Session-authed; Accounts verifies `currentPassword` and,
179
- * with `revokeOtherSessions`, logs the user out everywhere else. The target is the session's own
180
- * user — no id is passed. */
178
+ /** Set or change the signed-in user's password. Session-authed; the target is the session's own
179
+ * user — no id is passed.
180
+ *
181
+ * ONE call serves both cases. Accounts reads the credential and decides: with none it SETS the
182
+ * password (no `currentPassword` required); with one it verifies `currentPassword` and CHANGES
183
+ * it. The result's `mode` says which happened. With `revokeOtherSessions`, the user is logged
184
+ * out everywhere else. */
181
185
  changePassword(input: {
182
- currentPassword: string;
186
+ /**
187
+ * OPTIONAL, and omitted when the account has no password yet — someone who signed up with
188
+ * Google has none to verify. Accounts decides which case applies by reading the credential
189
+ * itself (`setOrChangePassword`), so omitting this cannot bypass verification: when a
190
+ * password DOES exist and this is absent, the request is rejected.
191
+ *
192
+ * Read `hasPassword` from the `/me` payload to decide whether to collect it.
193
+ */
194
+ currentPassword?: string;
183
195
  newPassword: string;
184
196
  confirmPassword?: string;
185
197
  revokeOtherSessions?: boolean;
package/dist/admin.js CHANGED
@@ -49,9 +49,13 @@ var AccountsAdmin = class {
49
49
  body: input
50
50
  });
51
51
  }
52
- /** Change the signed-in user's password. Session-authed; Accounts verifies `currentPassword` and,
53
- * with `revokeOtherSessions`, logs the user out everywhere else. The target is the session's own
54
- * user — no id is passed. */
52
+ /** Set or change the signed-in user's password. Session-authed; the target is the session's own
53
+ * user — no id is passed.
54
+ *
55
+ * ONE call serves both cases. Accounts reads the credential and decides: with none it SETS the
56
+ * password (no `currentPassword` required); with one it verifies `currentPassword` and CHANGES
57
+ * it. The result's `mode` says which happened. With `revokeOtherSessions`, the user is logged
58
+ * out everywhere else. */
55
59
  async changePassword(input) {
56
60
  return this.request("POST", "/api/auth/change-password", {
57
61
  auth: "session",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@~lyre/auth",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Shared Axis Accounts auth SDK — framework-agnostic session/identity core (HMAC-signed cookies, accounts login/callback/logout) plus an optional turnkey SvelteKit adapter.",
5
5
  "type": "module",
6
6
  "sideEffects": false,