spaps-sdk 1.4.0 → 1.5.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/index.d.mts CHANGED
@@ -285,6 +285,17 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
285
285
  token: string;
286
286
  new_password: string;
287
287
  }) => Promise<void>;
288
+ /**
289
+ * Set or change password for authenticated users.
290
+ * For magic link / wallet users setting their first password, only new_password is required.
291
+ * For users changing an existing password, current_password is also required.
292
+ */
293
+ setPassword: (payload: {
294
+ current_password?: string;
295
+ new_password: string;
296
+ }) => Promise<{
297
+ message: string;
298
+ }>;
288
299
  register: (payload: {
289
300
  email: string;
290
301
  password: string;
package/dist/index.d.ts CHANGED
@@ -285,6 +285,17 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
285
285
  token: string;
286
286
  new_password: string;
287
287
  }) => Promise<void>;
288
+ /**
289
+ * Set or change password for authenticated users.
290
+ * For magic link / wallet users setting their first password, only new_password is required.
291
+ * For users changing an existing password, current_password is also required.
292
+ */
293
+ setPassword: (payload: {
294
+ current_password?: string;
295
+ new_password: string;
296
+ }) => Promise<{
297
+ message: string;
298
+ }>;
288
299
  register: (payload: {
289
300
  email: string;
290
301
  password: string;
package/dist/index.js CHANGED
@@ -466,6 +466,17 @@ var SPAPSClient = class {
466
466
  confirmPasswordReset: async (payload) => {
467
467
  await this.client.post("/api/auth/reset-password-confirm", payload);
468
468
  },
469
+ /**
470
+ * Set or change password for authenticated users.
471
+ * For magic link / wallet users setting their first password, only new_password is required.
472
+ * For users changing an existing password, current_password is also required.
473
+ */
474
+ setPassword: async (payload) => {
475
+ const res = await this.client.post("/api/auth/set-password", payload);
476
+ const body = res.data;
477
+ if (body?.success === false) throw new Error(body?.error?.message || "Set password failed");
478
+ return { message: body?.message || "Password updated successfully" };
479
+ },
469
480
  register: async (payload) => {
470
481
  const res = await this.client.post("/api/auth/register", payload);
471
482
  const body = res.data;
package/dist/index.mjs CHANGED
@@ -439,6 +439,17 @@ var SPAPSClient = class {
439
439
  confirmPasswordReset: async (payload) => {
440
440
  await this.client.post("/api/auth/reset-password-confirm", payload);
441
441
  },
442
+ /**
443
+ * Set or change password for authenticated users.
444
+ * For magic link / wallet users setting their first password, only new_password is required.
445
+ * For users changing an existing password, current_password is also required.
446
+ */
447
+ setPassword: async (payload) => {
448
+ const res = await this.client.post("/api/auth/set-password", payload);
449
+ const body = res.data;
450
+ if (body?.success === false) throw new Error(body?.error?.message || "Set password failed");
451
+ return { message: body?.message || "Password updated successfully" };
452
+ },
442
453
  register: async (payload) => {
443
454
  const res = await this.client.post("/api/auth/register", payload);
444
455
  const body = res.data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spaps-sdk",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Sweet Potato Authentication & Payment Service SDK - Zero-config client with built-in permission checking, role-based access control, and dayrate scheduling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",