@takeal/cusfront-sdk 0.6.3 → 0.6.4
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/CHANGELOG.md +15 -0
- package/README.md +46 -9
- package/dist/index.cjs +41 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +41 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/auth.cjs +39 -0
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +75 -2
- package/dist/resources/auth.d.ts +75 -2
- package/dist/resources/auth.js +39 -0
- package/dist/resources/auth.js.map +1 -1
- package/dist/telegram.cjs +41 -2
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.js +41 -2
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
package/dist/telegram.js
CHANGED
|
@@ -475,6 +475,45 @@ var AuthResource = class {
|
|
|
475
475
|
await this.keep(resp);
|
|
476
476
|
return resp;
|
|
477
477
|
}
|
|
478
|
+
/** Step one of signing in without a password: a six-digit code goes to
|
|
479
|
+
* the address. It works for an address with an account and for a new one
|
|
480
|
+
* alike, and the answer doesn't say which. The code works for 10 minutes;
|
|
481
|
+
* another can be asked for after `resend_at` and replaces it.
|
|
482
|
+
* Errors: 400 `validation` (not an address), 429 `resend_too_soon` /
|
|
483
|
+
* `too_many_requests` (the message says when to try again), 503
|
|
484
|
+
* `delivery_failed`. */
|
|
485
|
+
async requestEmailCode(input) {
|
|
486
|
+
const body = { email: input.email };
|
|
487
|
+
if (input.locale !== void 0) body["locale"] = input.locale;
|
|
488
|
+
return this.http.post("/auth/email-code", { body, skipAuth: true });
|
|
489
|
+
}
|
|
490
|
+
/** Step two: the code signs in to the account with that address, or
|
|
491
|
+
* creates one (no password) when there is none; `account_created` says
|
|
492
|
+
* which. The JWT is stored. With `cardOrder`, the card is ordered for
|
|
493
|
+
* that account in the same call.
|
|
494
|
+
* Errors: 401 `invalid_code` (wrong, expired or used; after five checks a
|
|
495
|
+
* new code is needed), 400 `consents_required` for a new account, 403
|
|
496
|
+
* `user_disabled` / `second_factor_required` (operator accounts sign in
|
|
497
|
+
* with a password and their authenticator). */
|
|
498
|
+
async verifyEmailCode(input) {
|
|
499
|
+
const body = {
|
|
500
|
+
challenge_id: input.challengeId,
|
|
501
|
+
code: input.code
|
|
502
|
+
};
|
|
503
|
+
if (input.remember) body["remember_me"] = true;
|
|
504
|
+
if (input.walletCurrency !== void 0) body["wallet_currency"] = input.walletCurrency;
|
|
505
|
+
if (input.attribution !== void 0) body["attribution"] = input.attribution;
|
|
506
|
+
if (input.promoCode !== void 0) body["promo_code"] = input.promoCode;
|
|
507
|
+
if (input.consents !== void 0) body["consents"] = input.consents;
|
|
508
|
+
if (input.consentChannel !== void 0) body["consent_channel"] = input.consentChannel;
|
|
509
|
+
if (input.cardOrder !== void 0) body["card_order"] = cardOrderBody(input.cardOrder);
|
|
510
|
+
const resp = await this.http.post("/auth/email-code/verify", {
|
|
511
|
+
body,
|
|
512
|
+
skipAuth: true
|
|
513
|
+
});
|
|
514
|
+
await this.keep(resp);
|
|
515
|
+
return resp;
|
|
516
|
+
}
|
|
478
517
|
/** Finish a `totp_setup_required` login: send the first code from the
|
|
479
518
|
* authenticator app. The JWT is stored. The response carries ten
|
|
480
519
|
* one-time `backup_codes` that are never returned again, so show them to
|
|
@@ -1274,7 +1313,7 @@ var FundingOptionsResource = class {
|
|
|
1274
1313
|
};
|
|
1275
1314
|
|
|
1276
1315
|
// src/version.ts
|
|
1277
|
-
var SDK_VERSION = "0.6.
|
|
1316
|
+
var SDK_VERSION = "0.6.4";
|
|
1278
1317
|
|
|
1279
1318
|
// src/client-platform.ts
|
|
1280
1319
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1349,7 +1388,7 @@ function isAbsolute(url) {
|
|
|
1349
1388
|
}
|
|
1350
1389
|
|
|
1351
1390
|
// src/compat.ts
|
|
1352
|
-
var SUPPORTED_MEISTER = ">=0.6.
|
|
1391
|
+
var SUPPORTED_MEISTER = ">=0.6.9, <0.7.0";
|
|
1353
1392
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1354
1393
|
function parse(v) {
|
|
1355
1394
|
const m = SEMVER.exec(v.trim());
|