@delopay/sdk 0.3.0 → 0.3.2

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.cts CHANGED
@@ -2984,6 +2984,17 @@ declare class Users {
2984
2984
  changePassword(params: ChangePasswordRequest): Promise<UserResponse>;
2985
2985
  rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
2986
2986
  forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
2987
+ /**
2988
+ * Reset a user's password using the single-purpose JWT delivered by the
2989
+ * forgot-password email.
2990
+ *
2991
+ * The backend validates the token **twice**: first by the
2992
+ * `SinglePurposeJWTAuth` middleware (reads `Authorization: Bearer …`),
2993
+ * then by the handler itself (decodes `body.token` as an `EmailToken` and
2994
+ * looks up the user by the embedded email — see
2995
+ * `crates/router/src/core/user.rs:687`). The same JWT satisfies both, so
2996
+ * the SDK sends it in both places. Callers still pass `{ password, token }`.
2997
+ */
2987
2998
  resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
2988
2999
  verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
2989
3000
  sendVerificationEmail(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
package/dist/index.d.ts CHANGED
@@ -2984,6 +2984,17 @@ declare class Users {
2984
2984
  changePassword(params: ChangePasswordRequest): Promise<UserResponse>;
2985
2985
  rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
2986
2986
  forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
2987
+ /**
2988
+ * Reset a user's password using the single-purpose JWT delivered by the
2989
+ * forgot-password email.
2990
+ *
2991
+ * The backend validates the token **twice**: first by the
2992
+ * `SinglePurposeJWTAuth` middleware (reads `Authorization: Bearer …`),
2993
+ * then by the handler itself (decodes `body.token` as an `EmailToken` and
2994
+ * looks up the user by the embedded email — see
2995
+ * `crates/router/src/core/user.rs:687`). The same JWT satisfies both, so
2996
+ * the SDK sends it in both places. Callers still pass `{ password, token }`.
2997
+ */
2987
2998
  resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
2988
2999
  verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
2989
3000
  sendVerificationEmail(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
package/dist/index.js CHANGED
@@ -2029,8 +2029,22 @@ var Users = class {
2029
2029
  async forgotPassword(params) {
2030
2030
  return this.request("POST", "/user/forgot_password", { body: params });
2031
2031
  }
2032
+ /**
2033
+ * Reset a user's password using the single-purpose JWT delivered by the
2034
+ * forgot-password email.
2035
+ *
2036
+ * The backend validates the token **twice**: first by the
2037
+ * `SinglePurposeJWTAuth` middleware (reads `Authorization: Bearer …`),
2038
+ * then by the handler itself (decodes `body.token` as an `EmailToken` and
2039
+ * looks up the user by the embedded email — see
2040
+ * `crates/router/src/core/user.rs:687`). The same JWT satisfies both, so
2041
+ * the SDK sends it in both places. Callers still pass `{ password, token }`.
2042
+ */
2032
2043
  async resetPassword(params) {
2033
- return this.request("POST", "/user/reset_password", { body: params });
2044
+ return this.request("POST", "/user/reset_password", {
2045
+ body: params,
2046
+ headers: { Authorization: `Bearer ${params.token}` }
2047
+ });
2034
2048
  }
2035
2049
  async verifyEmail(params) {
2036
2050
  return this.request("POST", "/user/verify_email", { body: params });