@takeal/cusfront-sdk 0.8.1 → 0.8.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/CHANGELOG.md +37 -0
- package/README.md +25 -0
- package/dist/index.cjs +31 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -3
- package/dist/index.js.map +1 -1
- package/dist/resources/auth.cjs +30 -2
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +46 -3
- package/dist/resources/auth.d.ts +46 -3
- package/dist/resources/auth.js +30 -2
- package/dist/resources/auth.js.map +1 -1
- package/dist/telegram.cjs +31 -3
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.js +31 -3
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
package/dist/telegram.js
CHANGED
|
@@ -774,13 +774,41 @@ var AuthResource = class {
|
|
|
774
774
|
}
|
|
775
775
|
/** Change the signed-in user's password. Every other session of the
|
|
776
776
|
* account is signed out; this one stays valid.
|
|
777
|
-
* Errors: 400 when the new password fails the policy,
|
|
778
|
-
*
|
|
777
|
+
* Errors: 400 `weak_password` when the new password fails the policy,
|
|
778
|
+
* 400 `no_password` when the account has none yet (use
|
|
779
|
+
* {@link requestPasswordSetup}), 401 when the current one is wrong. */
|
|
779
780
|
async changePassword(input) {
|
|
780
781
|
return this.http.post("/auth/password", {
|
|
781
782
|
body: input
|
|
782
783
|
});
|
|
783
784
|
}
|
|
785
|
+
/** Step one of setting the first password of an account that has none
|
|
786
|
+
* (`user.has_password === false`, e.g. made by signing in with an e-mail
|
|
787
|
+
* code): a six-digit code goes to the account's address and works for 5
|
|
788
|
+
* minutes. Nothing changes yet.
|
|
789
|
+
* Errors: 409 `password_exists` (use {@link changePassword}),
|
|
790
|
+
* `email_required` (a Telegram account with no address yet: attach one
|
|
791
|
+
* with {@link requestEmailChange} first), `email_not_proven` (sign in
|
|
792
|
+
* with an e-mail code first); 429 `too_many_requests` (five codes an
|
|
793
|
+
* hour); 503 `delivery_failed`. Platform 0.8.2 and newer. */
|
|
794
|
+
async requestPasswordSetup() {
|
|
795
|
+
return this.http.post("/auth/password/setup", {});
|
|
796
|
+
}
|
|
797
|
+
/** Step two: the code from the e-mail and the new password set the
|
|
798
|
+
* account's first password. Every other session of the account is signed
|
|
799
|
+
* out; this one stays valid, and signing in with a code keeps working.
|
|
800
|
+
* Errors: 400 `weak_password` (the code is not used up, fix the password
|
|
801
|
+
* and send again), 401 `invalid_code` (after five wrong codes ask for a
|
|
802
|
+
* new one), 409 `password_exists`. */
|
|
803
|
+
async confirmPasswordSetup(input) {
|
|
804
|
+
return this.http.post("/auth/password/setup/confirm", {
|
|
805
|
+
body: {
|
|
806
|
+
challenge_id: input.challengeId,
|
|
807
|
+
code: input.code,
|
|
808
|
+
new_password: input.newPassword
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
}
|
|
784
812
|
/** Swap the 2FA method mid-flow. Resolves to `otp_sent` for
|
|
785
813
|
* telegram/email; for TOTP it short-circuits back to the challenge. */
|
|
786
814
|
async switchMethod(input) {
|
|
@@ -1716,7 +1744,7 @@ var FundingOptionsResource = class {
|
|
|
1716
1744
|
};
|
|
1717
1745
|
|
|
1718
1746
|
// src/version.ts
|
|
1719
|
-
var SDK_VERSION = "0.8.
|
|
1747
|
+
var SDK_VERSION = "0.8.3";
|
|
1720
1748
|
|
|
1721
1749
|
// src/client-platform.ts
|
|
1722
1750
|
var CLIENT_HEADER = "X-Takeal-Client";
|