@delopay/sdk 0.3.2 → 0.3.3
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.cjs +20 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2985,15 +2985,20 @@ declare class Users {
|
|
|
2985
2985
|
rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
|
|
2986
2986
|
forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
2987
2987
|
/**
|
|
2988
|
-
* Reset a user's password using the
|
|
2989
|
-
*
|
|
2990
|
-
*
|
|
2991
|
-
*
|
|
2992
|
-
* `
|
|
2993
|
-
*
|
|
2994
|
-
*
|
|
2995
|
-
*
|
|
2996
|
-
*
|
|
2988
|
+
* Reset a user's password using the email link token.
|
|
2989
|
+
*
|
|
2990
|
+
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2991
|
+
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2992
|
+
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
2993
|
+
*
|
|
2994
|
+
* 1. Exchange the EmailToken for a SinglePurposeToken at `/user/from_email`
|
|
2995
|
+
* (`crates/router/src/core/user.rs:2773`, no auth required).
|
|
2996
|
+
* 2. Call `/user/reset_password` with the SinglePurposeToken as
|
|
2997
|
+
* `Authorization: Bearer` and the original EmailToken in the body —
|
|
2998
|
+
* the handler decodes body.token as an EmailToken to look up the user
|
|
2999
|
+
* (`crates/router/src/core/user.rs:687`).
|
|
3000
|
+
*
|
|
3001
|
+
* Callers just pass `{ password, token }` (the token from the URL).
|
|
2997
3002
|
*/
|
|
2998
3003
|
resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
|
|
2999
3004
|
verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2985,15 +2985,20 @@ declare class Users {
|
|
|
2985
2985
|
rotatePassword(params: ResetPasswordRequest): Promise<UserResponse>;
|
|
2986
2986
|
forgotPassword(params: ForgotPasswordRequest): Promise<Record<string, unknown>>;
|
|
2987
2987
|
/**
|
|
2988
|
-
* Reset a user's password using the
|
|
2989
|
-
*
|
|
2990
|
-
*
|
|
2991
|
-
*
|
|
2992
|
-
* `
|
|
2993
|
-
*
|
|
2994
|
-
*
|
|
2995
|
-
*
|
|
2996
|
-
*
|
|
2988
|
+
* Reset a user's password using the email link token.
|
|
2989
|
+
*
|
|
2990
|
+
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2991
|
+
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2992
|
+
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
2993
|
+
*
|
|
2994
|
+
* 1. Exchange the EmailToken for a SinglePurposeToken at `/user/from_email`
|
|
2995
|
+
* (`crates/router/src/core/user.rs:2773`, no auth required).
|
|
2996
|
+
* 2. Call `/user/reset_password` with the SinglePurposeToken as
|
|
2997
|
+
* `Authorization: Bearer` and the original EmailToken in the body —
|
|
2998
|
+
* the handler decodes body.token as an EmailToken to look up the user
|
|
2999
|
+
* (`crates/router/src/core/user.rs:687`).
|
|
3000
|
+
*
|
|
3001
|
+
* Callers just pass `{ password, token }` (the token from the URL).
|
|
2997
3002
|
*/
|
|
2998
3003
|
resetPassword(params: ResetPasswordRequest): Promise<Record<string, unknown>>;
|
|
2999
3004
|
verifyEmail(params: Record<string, unknown>): Promise<AuthResponse>;
|
package/dist/index.js
CHANGED
|
@@ -2030,20 +2030,30 @@ var Users = class {
|
|
|
2030
2030
|
return this.request("POST", "/user/forgot_password", { body: params });
|
|
2031
2031
|
}
|
|
2032
2032
|
/**
|
|
2033
|
-
* Reset a user's password using the
|
|
2034
|
-
* forgot-password email.
|
|
2033
|
+
* Reset a user's password using the email link token.
|
|
2035
2034
|
*
|
|
2036
|
-
* The
|
|
2037
|
-
* `SinglePurposeJWTAuth`
|
|
2038
|
-
*
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2041
|
-
*
|
|
2035
|
+
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2036
|
+
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2037
|
+
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
2038
|
+
*
|
|
2039
|
+
* 1. Exchange the EmailToken for a SinglePurposeToken at `/user/from_email`
|
|
2040
|
+
* (`crates/router/src/core/user.rs:2773`, no auth required).
|
|
2041
|
+
* 2. Call `/user/reset_password` with the SinglePurposeToken as
|
|
2042
|
+
* `Authorization: Bearer` and the original EmailToken in the body —
|
|
2043
|
+
* the handler decodes body.token as an EmailToken to look up the user
|
|
2044
|
+
* (`crates/router/src/core/user.rs:687`).
|
|
2045
|
+
*
|
|
2046
|
+
* Callers just pass `{ password, token }` (the token from the URL).
|
|
2042
2047
|
*/
|
|
2043
2048
|
async resetPassword(params) {
|
|
2049
|
+
const exchange = await this.request(
|
|
2050
|
+
"POST",
|
|
2051
|
+
"/user/from_email",
|
|
2052
|
+
{ body: { token: params.token } }
|
|
2053
|
+
);
|
|
2044
2054
|
return this.request("POST", "/user/reset_password", {
|
|
2045
|
-
body: params,
|
|
2046
|
-
headers: { Authorization: `Bearer ${
|
|
2055
|
+
body: { token: params.token, password: params.password },
|
|
2056
|
+
headers: { Authorization: `Bearer ${exchange.token}` }
|
|
2047
2057
|
});
|
|
2048
2058
|
}
|
|
2049
2059
|
async verifyEmail(params) {
|