@delopay/sdk 0.3.3 → 0.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.cjs +79 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -19
- package/dist/index.d.ts +95 -19
- package/dist/index.js +79 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -136,6 +136,30 @@ var AdminPortal = class {
|
|
|
136
136
|
query: params
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Retrieve a merchant account via the admin portal. Unlike
|
|
141
|
+
* `merchantAccounts.retrieve`, this route accepts an admin JWT (or admin API
|
|
142
|
+
* key) and does not require the JWT to be scoped to the target merchant.
|
|
143
|
+
*/
|
|
144
|
+
async retrieveAccount(merchantId) {
|
|
145
|
+
return this.request("GET", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Update a merchant account via the admin portal. Authenticated via admin JWT
|
|
149
|
+
* or admin API key.
|
|
150
|
+
*/
|
|
151
|
+
async updateAccount(merchantId, params) {
|
|
152
|
+
return this.request("POST", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`, {
|
|
153
|
+
body: params
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Delete a merchant account via the admin portal. Authenticated via admin JWT
|
|
158
|
+
* or admin API key.
|
|
159
|
+
*/
|
|
160
|
+
async deleteAccount(merchantId) {
|
|
161
|
+
return this.request("DELETE", `/admin-portal/accounts/${encodeURIComponent(merchantId)}`);
|
|
162
|
+
}
|
|
139
163
|
};
|
|
140
164
|
|
|
141
165
|
// src/resources/apiKeys.ts
|
|
@@ -2070,31 +2094,29 @@ var Users = class {
|
|
|
2070
2094
|
return this.request("POST", "/user/forgot_password", { body: params });
|
|
2071
2095
|
}
|
|
2072
2096
|
/**
|
|
2073
|
-
*
|
|
2074
|
-
*
|
|
2075
|
-
* The email link delivers an `EmailToken`, but `/user/reset_password` is
|
|
2076
|
-
* gated by `SinglePurposeJWTAuth` which expects a different JWT type
|
|
2077
|
-
* (`SinglePurposeToken`). The SDK hides this two-step dance:
|
|
2097
|
+
* Commit a password reset.
|
|
2078
2098
|
*
|
|
2079
|
-
*
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2083
|
-
*
|
|
2084
|
-
*
|
|
2085
|
-
*
|
|
2086
|
-
*
|
|
2099
|
+
* The caller is responsible for obtaining a `SinglePurposeToken` with
|
|
2100
|
+
* `purpose: reset_password` via the email-token exchange + TOTP flow
|
|
2101
|
+
* (see `fromEmail`, `beginTotp`, `updateTotp`/`verifyTotp`,
|
|
2102
|
+
* `generateRecoveryCodes`, `terminate2fa`) and setting it on the client
|
|
2103
|
+
* via `setJwtToken` before calling this method. `body.token` must still
|
|
2104
|
+
* be the original `EmailToken` from the reset-link URL — the handler
|
|
2105
|
+
* decodes it a second time to find the user
|
|
2106
|
+
* (`delopay-backend/crates/router/src/core/user.rs:687`).
|
|
2087
2107
|
*/
|
|
2088
2108
|
async resetPassword(params) {
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2109
|
+
return this.request("POST", "/user/reset_password", { body: params });
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Exchange an email-link token (`EmailToken`) for a single-purpose JWT
|
|
2113
|
+
* that drives the next step of the flow (TOTP, verify email, accept
|
|
2114
|
+
* invitation, etc.). No authentication required.
|
|
2115
|
+
*
|
|
2116
|
+
* The `token_type` in the response tells you which step to run next.
|
|
2117
|
+
*/
|
|
2118
|
+
async fromEmail(params) {
|
|
2119
|
+
return this.request("POST", "/user/from_email", { body: params });
|
|
2098
2120
|
}
|
|
2099
2121
|
async verifyEmail(params) {
|
|
2100
2122
|
return this.request("POST", "/user/verify_email", { body: params });
|
|
@@ -2123,9 +2145,24 @@ var Users = class {
|
|
|
2123
2145
|
async acceptInvitation(params) {
|
|
2124
2146
|
return this.request("POST", "/user/user/invite/accept", { body: params });
|
|
2125
2147
|
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Start TOTP setup (or no-op if already set).
|
|
2150
|
+
*
|
|
2151
|
+
* Returns the QR-code payload when the user has no TOTP configured yet;
|
|
2152
|
+
* returns `{ secret: null }` when the user is already set up (caller
|
|
2153
|
+
* should then prompt for a 6-digit code and call `verifyTotp`).
|
|
2154
|
+
*
|
|
2155
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2156
|
+
*/
|
|
2126
2157
|
async beginTotp() {
|
|
2127
2158
|
return this.request("GET", "/user/2fa/totp/begin");
|
|
2128
2159
|
}
|
|
2160
|
+
/**
|
|
2161
|
+
* Verify a 6-digit TOTP code for a user whose TOTP is already set up.
|
|
2162
|
+
* Marks the code as used in Redis so subsequent flow steps can advance.
|
|
2163
|
+
*
|
|
2164
|
+
* Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2165
|
+
*/
|
|
2129
2166
|
async verifyTotp(params) {
|
|
2130
2167
|
return this.request("POST", "/user/2fa/totp/verify", { body: params });
|
|
2131
2168
|
}
|
|
@@ -2192,13 +2229,29 @@ var Users = class {
|
|
|
2192
2229
|
async check2faStatusV2() {
|
|
2193
2230
|
return this.request("GET", "/user/2fa/v2");
|
|
2194
2231
|
}
|
|
2195
|
-
/**
|
|
2232
|
+
/**
|
|
2233
|
+
* Finish first-time TOTP setup: commit the secret generated by `beginTotp`
|
|
2234
|
+
* against a 6-digit code from the user's authenticator app.
|
|
2235
|
+
*
|
|
2236
|
+
* `PUT /user/2fa/totp/verify`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2237
|
+
*/
|
|
2196
2238
|
async updateTotp(params) {
|
|
2197
2239
|
return this.request("PUT", "/user/2fa/totp/verify", { body: params });
|
|
2198
2240
|
}
|
|
2199
|
-
/**
|
|
2200
|
-
|
|
2201
|
-
|
|
2241
|
+
/**
|
|
2242
|
+
* Complete the TOTP step and advance to the next flow stage (e.g.
|
|
2243
|
+
* `reset_password`). Returns a fresh single-purpose token with the
|
|
2244
|
+
* next `token_type`.
|
|
2245
|
+
*
|
|
2246
|
+
* `GET /user/2fa/terminate`. Requires `Authorization: Bearer <SPT{purpose:totp}>`.
|
|
2247
|
+
*/
|
|
2248
|
+
async terminate2fa(query) {
|
|
2249
|
+
if (query === void 0) {
|
|
2250
|
+
return this.request("GET", "/user/2fa/terminate");
|
|
2251
|
+
}
|
|
2252
|
+
return this.request("GET", "/user/2fa/terminate", {
|
|
2253
|
+
query
|
|
2254
|
+
});
|
|
2202
2255
|
}
|
|
2203
2256
|
/** Create auth method. `POST /user/auth` */
|
|
2204
2257
|
async createAuthMethod(params) {
|