@delopay/sdk 0.3.1 → 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
@@ -2988,10 +2988,12 @@ declare class Users {
2988
2988
  * Reset a user's password using the single-purpose JWT delivered by the
2989
2989
  * forgot-password email.
2990
2990
  *
2991
- * The backend's `SinglePurposeJWTAuth` reads the token from the
2992
- * `Authorization: Bearer …` header, not from the request body, so the
2993
- * SDK lifts the `token` field out of `params` and sends it as the header.
2994
- * Callers still pass `{ password, token }`the shape is unchanged.
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 }`.
2995
2997
  */
2996
2998
  resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
2997
2999
  verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
package/dist/index.d.ts CHANGED
@@ -2988,10 +2988,12 @@ declare class Users {
2988
2988
  * Reset a user's password using the single-purpose JWT delivered by the
2989
2989
  * forgot-password email.
2990
2990
  *
2991
- * The backend's `SinglePurposeJWTAuth` reads the token from the
2992
- * `Authorization: Bearer …` header, not from the request body, so the
2993
- * SDK lifts the `token` field out of `params` and sends it as the header.
2994
- * Callers still pass `{ password, token }`the shape is unchanged.
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 }`.
2995
2997
  */
2996
2998
  resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
2997
2999
  verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
package/dist/index.js CHANGED
@@ -2033,16 +2033,17 @@ var Users = class {
2033
2033
  * Reset a user's password using the single-purpose JWT delivered by the
2034
2034
  * forgot-password email.
2035
2035
  *
2036
- * The backend's `SinglePurposeJWTAuth` reads the token from the
2037
- * `Authorization: Bearer …` header, not from the request body, so the
2038
- * SDK lifts the `token` field out of `params` and sends it as the header.
2039
- * Callers still pass `{ password, token }`the shape is unchanged.
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 }`.
2040
2042
  */
2041
2043
  async resetPassword(params) {
2042
- const { token, password } = params;
2043
2044
  return this.request("POST", "/user/reset_password", {
2044
- body: { password },
2045
- headers: { Authorization: `Bearer ${token}` }
2045
+ body: params,
2046
+ headers: { Authorization: `Bearer ${params.token}` }
2046
2047
  });
2047
2048
  }
2048
2049
  async verifyEmail(params) {