@mtcute/core 0.19.2 → 0.19.5
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.
|
@@ -10,6 +10,7 @@ const errors = require("../../../types/errors.cjs");
|
|
|
10
10
|
const miscUtils = require("../../utils/misc-utils.cjs");
|
|
11
11
|
const getMe = require("../users/get-me.cjs");
|
|
12
12
|
const checkPassword = require("./check-password.cjs");
|
|
13
|
+
const logOut = require("./log-out.cjs");
|
|
13
14
|
const resendCode = require("./resend-code.cjs");
|
|
14
15
|
const sendCode = require("./send-code.cjs");
|
|
15
16
|
const signInBot = require("./sign-in-bot.cjs");
|
|
@@ -30,8 +31,15 @@ async function start(client, params) {
|
|
|
30
31
|
return me;
|
|
31
32
|
} catch (e) {
|
|
32
33
|
if (tl.tl.RpcError.is(e)) {
|
|
33
|
-
if (e.text === "SESSION_PASSWORD_NEEDED")
|
|
34
|
-
|
|
34
|
+
if (e.text === "SESSION_PASSWORD_NEEDED") {
|
|
35
|
+
has2fa = true;
|
|
36
|
+
} else if (e.text === "SESSION_REVOKED" || e.text === "USER_DEACTIVATED" || e.text === "USER_DEACTIVATED_BAN") {
|
|
37
|
+
await logOut.logOut(client).catch((err) => {
|
|
38
|
+
client.log.warn("failed to log out: %e", err);
|
|
39
|
+
});
|
|
40
|
+
} else if (e.text !== "AUTH_KEY_UNREGISTERED") {
|
|
41
|
+
throw e;
|
|
42
|
+
}
|
|
35
43
|
} else {
|
|
36
44
|
throw e;
|
|
37
45
|
}
|
|
@@ -3,6 +3,7 @@ import { MtArgumentError, MtcuteError } from "../../../types/errors.js";
|
|
|
3
3
|
import { resolveMaybeDynamic, normalizePhoneNumber } from "../../utils/misc-utils.js";
|
|
4
4
|
import { getMe } from "../users/get-me.js";
|
|
5
5
|
import { checkPassword } from "./check-password.js";
|
|
6
|
+
import { logOut } from "./log-out.js";
|
|
6
7
|
import { resendCode } from "./resend-code.js";
|
|
7
8
|
import { sendCode } from "./send-code.js";
|
|
8
9
|
import { signInBot } from "./sign-in-bot.js";
|
|
@@ -23,8 +24,15 @@ async function start(client, params) {
|
|
|
23
24
|
return me;
|
|
24
25
|
} catch (e) {
|
|
25
26
|
if (tl.RpcError.is(e)) {
|
|
26
|
-
if (e.text === "SESSION_PASSWORD_NEEDED")
|
|
27
|
-
|
|
27
|
+
if (e.text === "SESSION_PASSWORD_NEEDED") {
|
|
28
|
+
has2fa = true;
|
|
29
|
+
} else if (e.text === "SESSION_REVOKED" || e.text === "USER_DEACTIVATED" || e.text === "USER_DEACTIVATED_BAN") {
|
|
30
|
+
await logOut(client).catch((err) => {
|
|
31
|
+
client.log.warn("failed to log out: %e", err);
|
|
32
|
+
});
|
|
33
|
+
} else if (e.text !== "AUTH_KEY_UNREGISTERED") {
|
|
34
|
+
throw e;
|
|
35
|
+
}
|
|
28
36
|
} else {
|
|
29
37
|
throw e;
|
|
30
38
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.19.
|
|
4
|
+
"version": "0.19.5",
|
|
5
5
|
"description": "Type-safe library for MTProto (Telegram API)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@fuman/io": "0.0.8",
|
|
10
|
-
"@fuman/net": "0.0.
|
|
10
|
+
"@fuman/net": "0.0.9",
|
|
11
11
|
"@fuman/utils": "0.0.4",
|
|
12
12
|
"@mtcute/file-id": "^0.19.0",
|
|
13
13
|
"@mtcute/tl": "^196.0.0",
|