astralyx-tg-bridge 0.1.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/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +181 -0
- package/dist/cli.js.map +1 -0
- package/dist/extract.d.ts +7 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +51 -0
- package/dist/extract.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/session/index.d.ts +3 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +171 -0
- package/dist/session/index.js.map +1 -0
- package/dist/standard.d.ts +34 -0
- package/dist/standard.d.ts.map +1 -0
- package/dist/standard.js +148 -0
- package/dist/standard.js.map +1 -0
- package/dist/stringsession.d.ts +29 -0
- package/dist/stringsession.d.ts.map +1 -0
- package/dist/stringsession.js +120 -0
- package/dist/stringsession.js.map +1 -0
- package/dist/tdata/crypto.d.ts +27 -0
- package/dist/tdata/crypto.d.ts.map +1 -0
- package/dist/tdata/crypto.js +131 -0
- package/dist/tdata/crypto.js.map +1 -0
- package/dist/tdata/index.d.ts +17 -0
- package/dist/tdata/index.d.ts.map +1 -0
- package/dist/tdata/index.js +255 -0
- package/dist/tdata/index.js.map +1 -0
- package/dist/tdata/qstream.d.ts +19 -0
- package/dist/tdata/qstream.d.ts.map +1 -0
- package/dist/tdata/qstream.js +51 -0
- package/dist/tdata/qstream.js.map +1 -0
- package/dist/tdata/reader.d.ts +9 -0
- package/dist/tdata/reader.d.ts.map +1 -0
- package/dist/tdata/reader.js +85 -0
- package/dist/tdata/reader.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Astralyx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# @astralyx/tg-bridge
|
|
2
|
+
|
|
3
|
+
Convert Telegram credentials between the formats different libraries use, through
|
|
4
|
+
**one readable JSON object** as the hub. Read a Telegram Desktop `tdata` folder, a
|
|
5
|
+
Telethon/Pyrogram `.session` file, or a session string (GramJS/Telethon/Pyrogram) —
|
|
6
|
+
and convert back out to a Telethon `.session` or a GramJS-compatible session string.
|
|
7
|
+
|
|
8
|
+
**Pure Node. Zero dependencies. Fully offline.** It does not connect to Telegram,
|
|
9
|
+
does not log in, and does not interact with accounts — it only reads the local
|
|
10
|
+
credential and re-serializes it.
|
|
11
|
+
|
|
12
|
+
The insight: a Telegram session is just a **256-byte MTProto `auth_key` bound to a
|
|
13
|
+
data-center**. Every container (`tdata`, `.session`, a session string) wraps the
|
|
14
|
+
same secret. This library extracts that secret into a canonical record, from which
|
|
15
|
+
any supported form can be rebuilt.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
tdata ─┐ ┌─► account.json (standard object)
|
|
19
|
+
.session ┼─► RawCredential ─► normalize ┼─► session string (GramJS/Telethon)
|
|
20
|
+
session string ┘ (authKey + dc + uid) └─► .session (Telethon, rebuilt)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## The standard object
|
|
24
|
+
|
|
25
|
+
```jsonc
|
|
26
|
+
{
|
|
27
|
+
"version": 1,
|
|
28
|
+
"source": "tdata", // tdata | session | stringSession
|
|
29
|
+
"authKey": "a1b2c3d4…", // 256-byte MTProto key, hex — THE credential
|
|
30
|
+
"dcId": 2, // data-center the key is bound to (1-5)
|
|
31
|
+
"userId": 1234567890,
|
|
32
|
+
"apiId": 2040, // Telegram Desktop pair by default
|
|
33
|
+
"apiHash": "xxxxxxxx…",
|
|
34
|
+
"stringSession": "1BQAN…", // GramJS-compatible string, built in pure Node
|
|
35
|
+
"phone": "+10000000000", // sidecar metadata below; not needed to connect
|
|
36
|
+
"twoFA": "••••••••",
|
|
37
|
+
"proxy": { "type": 3, "host": "…", "port": 10020, "username": "…", "password": "…" },
|
|
38
|
+
"device": { "deviceModel": "…", "systemVersion": "…", "appVersion": "…" },
|
|
39
|
+
"meta": { "…": "source-specific passthrough" },
|
|
40
|
+
"extractedAt": "2026-09-10T…Z"
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Only `authKey` + `dcId` (+ `apiId`/`apiHash`) are required to authorize later.
|
|
45
|
+
Everything else is metadata carried along for convenience.
|
|
46
|
+
|
|
47
|
+
## Library API
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { extractAccount, writeStandard, decodeStringSession } from '@astralyx/tg-bridge';
|
|
51
|
+
|
|
52
|
+
// Extract — synchronous, returns the final object
|
|
53
|
+
const acc = extractAccount({ type: 'tdata', path: '/path/to/tdata' });
|
|
54
|
+
const acc2 = extractAccount({ type: 'session', path: '/path/to/acc.session' });
|
|
55
|
+
const acc3 = extractAccount({ type: 'stringSession', session: '1BQAN…' }); // GramJS/Telethon/Pyrogram
|
|
56
|
+
|
|
57
|
+
// Persist to a folder: <out>/<userId>/account.json (+ optional .session)
|
|
58
|
+
writeStandard(acc, './out', { writeSession: true });
|
|
59
|
+
|
|
60
|
+
// Read a stringSession prop back into raw parts (pure, no SDK)
|
|
61
|
+
const { dcId, authKey } = decodeStringSession(acc.stringSession);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That's it — the object is yours to store or hand to whatever MTProto client you
|
|
65
|
+
use elsewhere. This package never touches the network.
|
|
66
|
+
|
|
67
|
+
## CLI
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# One account → stdout (or a folder with --out)
|
|
71
|
+
tg-bridge extract --type tdata --path ./account/tdata --out ./out
|
|
72
|
+
tg-bridge extract --type session --path ./account.session --out ./out --session
|
|
73
|
+
tg-bridge extract --type stringSession --string "1BQAN…" --out ./out
|
|
74
|
+
|
|
75
|
+
# Every account folder under a directory (auto-detects tdata vs .session)
|
|
76
|
+
tg-bridge batch --type auto --dir ./tg_sessions --out ./out --session
|
|
77
|
+
# → writes ./out/<userId>/account.json for each, plus ./out/_report.json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Examples
|
|
81
|
+
|
|
82
|
+
Runnable, one per situation, in [`examples/`](./examples). Build once, then run —
|
|
83
|
+
each writes its result to the in-project `./out/<userId>/account.json`:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm run build
|
|
87
|
+
node examples/extract-tdata.mts # tdata folder → object
|
|
88
|
+
node examples/extract-session.mts # .session file → object
|
|
89
|
+
node examples/batch-folder.mts # a directory of account folders → one object each
|
|
90
|
+
node examples/decode-string-session.mts # read the stringSession prop back, rebuild a .session
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Each accepts an optional path argument; with none, it uses a sensible default.
|
|
94
|
+
|
|
95
|
+
## How it works
|
|
96
|
+
|
|
97
|
+
**`.session`** — plain SQLite. Read `sessions.auth_key` / `dc_id` directly (via
|
|
98
|
+
Node's built-in `node:sqlite`), merge a `*.json` sidecar if present.
|
|
99
|
+
|
|
100
|
+
**session string** — the compact string produced by a client library. The format
|
|
101
|
+
is auto-detected: GramJS and Telethon (both a `"1"` prefix + base64, differing in
|
|
102
|
+
how the server address is packed) and Pyrogram (urlsafe base64 carrying the api id
|
|
103
|
+
and user id). The 256-byte key and DC are read straight out.
|
|
104
|
+
|
|
105
|
+
**`tdata`** — Telegram Desktop's encrypted store. The chain (verified
|
|
106
|
+
byte-for-byte against real folders):
|
|
107
|
+
|
|
108
|
+
1. `key_datas` → `salt`, encrypted local key. Derive the passcode key as
|
|
109
|
+
`PBKDF2-HMAC-SHA512( SHA512(salt‖passcode‖salt), salt, iter, 256 )`
|
|
110
|
+
(`iter = 1` for an empty passcode) and decrypt the 256-byte local key.
|
|
111
|
+
2. Each account file is decrypted with the local key using the MTProto-v1 KDF
|
|
112
|
+
(`prepareAES_oldmtp`) + AES-256-IGE, integrity-checked via `SHA1(plaintext)[:16]`.
|
|
113
|
+
3. The `dbiMtpAuthorization` (`0x4b`) block yields `userId`, the main DC, and the
|
|
114
|
+
per-DC 256-byte auth keys.
|
|
115
|
+
|
|
116
|
+
**Output** — a GramJS-compatible `stringSession` is built from `(authKey, dcId)` in
|
|
117
|
+
**pure Node** (`encodeStringSession`/`decodeStringSession`, no SDK), so the record
|
|
118
|
+
drops straight into any GramJS-based tool; `.session` files can be rebuilt too.
|
|
119
|
+
|
|
120
|
+
## Security
|
|
121
|
+
|
|
122
|
+
This library handles **live, unlocked account credentials**. The standard object
|
|
123
|
+
(and the folder it writes) is a full login — anyone who reads `authKey` controls
|
|
124
|
+
the account, no phone or code required, and `twoFA` sits right next to it. Treat
|
|
125
|
+
the output as secret material:
|
|
126
|
+
|
|
127
|
+
- Don't commit it, log it, or send it to any service you don't control.
|
|
128
|
+
- For anything beyond local scratch work, encrypt `authKey`/`twoFA` at rest
|
|
129
|
+
(KMS / `pgcrypto` with a key the datastore itself doesn't hold).
|
|
130
|
+
|
|
131
|
+
## Requirements
|
|
132
|
+
|
|
133
|
+
- Node ≥ 22.5 (uses the built-in `node:sqlite`). No other dependencies.
|
|
134
|
+
|
|
135
|
+
## Scope
|
|
136
|
+
|
|
137
|
+
`tg-bridge` is an **offline format bridge** only: `tdata`/`.session`/session string
|
|
138
|
+
→ standard object, plus `.session` and session-string rebuild. It deliberately does
|
|
139
|
+
**not** include phone/QR/bot login or any live account interaction — those require
|
|
140
|
+
an MTProto client, which this package does not bundle. Use the extracted
|
|
141
|
+
`authKey`/`stringSession` with your own client for anything on-network.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
/**
|
|
38
|
+
* tg-bridge CLI. Pure offline extraction — no network, no SDK.
|
|
39
|
+
*
|
|
40
|
+
* tg-bridge extract --type <session|tdata> --path <p> [--json <p>] [--passcode <p>]
|
|
41
|
+
* [--out <dir>] [--session]
|
|
42
|
+
* tg-bridge batch --type <session|tdata|auto> --dir <parent> --out <dir>
|
|
43
|
+
* [--passcode <p>] [--session]
|
|
44
|
+
*/
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const extract_1 = require("./extract");
|
|
48
|
+
const standard_1 = require("./standard");
|
|
49
|
+
function parseArgs(argv) {
|
|
50
|
+
const out = {};
|
|
51
|
+
for (let i = 0; i < argv.length; i++) {
|
|
52
|
+
const a = argv[i];
|
|
53
|
+
if (a.startsWith('--')) {
|
|
54
|
+
const key = a.slice(2);
|
|
55
|
+
const next = argv[i + 1];
|
|
56
|
+
if (next && !next.startsWith('--')) {
|
|
57
|
+
out[key] = next;
|
|
58
|
+
i++;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
out[key] = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
function logAccount(acc, where) {
|
|
68
|
+
const tag = acc.userId ?? acc.phone ?? `dc${acc.dcId}`;
|
|
69
|
+
console.error(` ✓ ${acc.source} → user ${tag} (DC ${acc.dcId}, key ${acc.authKey.length / 2}B)` +
|
|
70
|
+
(where ? ` → ${where}` : ''));
|
|
71
|
+
}
|
|
72
|
+
function cmdExtract(args) {
|
|
73
|
+
const type = String(args.type || '');
|
|
74
|
+
if (type !== 'session' && type !== 'tdata' && type !== 'stringSession') {
|
|
75
|
+
throw new Error('extract --type must be session, tdata, or stringSession');
|
|
76
|
+
}
|
|
77
|
+
const account = (0, extract_1.extractAccount)({
|
|
78
|
+
type,
|
|
79
|
+
path: String(args.path),
|
|
80
|
+
session: args.string ? String(args.string) : String(args.session || ''),
|
|
81
|
+
json: args.json ? String(args.json) : undefined,
|
|
82
|
+
passcode: args.passcode ? String(args.passcode) : undefined,
|
|
83
|
+
apiId: args['api-id'] ? Number(args['api-id']) : undefined,
|
|
84
|
+
apiHash: args['api-hash'] ? String(args['api-hash']) : undefined,
|
|
85
|
+
});
|
|
86
|
+
if (args.out) {
|
|
87
|
+
const res = (0, standard_1.writeStandard)(account, String(args.out), { writeSession: Boolean(args.session) });
|
|
88
|
+
logAccount(account, res.dir);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
process.stdout.write(JSON.stringify(account, null, 2) + '\n');
|
|
92
|
+
logAccount(account);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function cmdBatch(args) {
|
|
96
|
+
const dir = String(args.dir);
|
|
97
|
+
const out = String(args.out || './out');
|
|
98
|
+
const typeArg = String(args.type || 'auto');
|
|
99
|
+
const passcode = args.passcode ? String(args.passcode) : '';
|
|
100
|
+
const writeSession = Boolean(args.session);
|
|
101
|
+
const entries = fs
|
|
102
|
+
.readdirSync(dir)
|
|
103
|
+
.map((e) => path.join(dir, e))
|
|
104
|
+
.filter((p) => {
|
|
105
|
+
try {
|
|
106
|
+
return fs.statSync(p).isDirectory();
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
let ok = 0;
|
|
113
|
+
let fail = 0;
|
|
114
|
+
const failures = [];
|
|
115
|
+
for (const p of entries) {
|
|
116
|
+
const hasTdata = fs.existsSync(path.join(p, 'tdata'));
|
|
117
|
+
const hasSession = fs.readdirSync(p).some((e) => e.endsWith('.session'));
|
|
118
|
+
let type = null;
|
|
119
|
+
if (typeArg === 'tdata')
|
|
120
|
+
type = hasTdata ? 'tdata' : null;
|
|
121
|
+
else if (typeArg === 'session')
|
|
122
|
+
type = hasSession ? 'session' : null;
|
|
123
|
+
else
|
|
124
|
+
type = hasTdata ? 'tdata' : hasSession ? 'session' : null;
|
|
125
|
+
if (!type)
|
|
126
|
+
continue;
|
|
127
|
+
try {
|
|
128
|
+
const account = (0, extract_1.extractAccount)({
|
|
129
|
+
type,
|
|
130
|
+
path: type === 'tdata' ? path.join(p, 'tdata') : p,
|
|
131
|
+
passcode,
|
|
132
|
+
});
|
|
133
|
+
const res = (0, standard_1.writeStandard)(account, out, { writeSession });
|
|
134
|
+
logAccount(account, path.relative(process.cwd(), res.dir));
|
|
135
|
+
ok++;
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
fail++;
|
|
139
|
+
failures.push({ path: p, error: e?.message || String(e) });
|
|
140
|
+
console.error(` ✗ ${path.basename(p)} (${type}): ${e?.message || e}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const report = { total: ok + fail, ok, fail, failures, generatedAt: new Date().toISOString() };
|
|
144
|
+
fs.mkdirSync(out, { recursive: true });
|
|
145
|
+
fs.writeFileSync(path.join(out, '_report.json'), JSON.stringify(report, null, 2));
|
|
146
|
+
console.error(`\nDone: ${ok} ok, ${fail} failed. Report: ${path.join(out, '_report.json')}`);
|
|
147
|
+
}
|
|
148
|
+
const HELP = `tg-bridge — Telegram .session/tdata → standard JSON (offline, no deps)
|
|
149
|
+
|
|
150
|
+
Commands:
|
|
151
|
+
extract Extract one .session or tdata folder to a standard JSON object
|
|
152
|
+
batch Extract every account folder under a directory (auto-detects type)
|
|
153
|
+
|
|
154
|
+
Examples:
|
|
155
|
+
tg-bridge extract --type tdata --path ./acc/tdata --out ./out
|
|
156
|
+
tg-bridge extract --type session --path ./acc.session
|
|
157
|
+
tg-bridge batch --type auto --dir ./accounts --out ./out --session`;
|
|
158
|
+
function main() {
|
|
159
|
+
const [cmd, ...rest] = process.argv.slice(2);
|
|
160
|
+
const args = parseArgs(rest);
|
|
161
|
+
try {
|
|
162
|
+
switch (cmd) {
|
|
163
|
+
case 'extract':
|
|
164
|
+
cmdExtract(args);
|
|
165
|
+
break;
|
|
166
|
+
case 'batch':
|
|
167
|
+
cmdBatch(args);
|
|
168
|
+
break;
|
|
169
|
+
default:
|
|
170
|
+
console.error(HELP);
|
|
171
|
+
process.exit(cmd ? 1 : 0);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
console.error('Error: ' + (e?.message || e));
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
process.exit(0);
|
|
179
|
+
}
|
|
180
|
+
main();
|
|
181
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;;;;;;GAOG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,CAAC,CAAC;gBACf,MAAM;YACR;gBACE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACpB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top-level extractor: one call that takes a `.session` file or a `tdata` folder
|
|
3
|
+
* and returns the final StandardAccount object (key + props). No network, no SDK.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtractProps, StandardAccount } from './types';
|
|
6
|
+
export declare function extractAccount(props: ExtractProps): StandardAccount;
|
|
7
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,YAAY,EAAiB,eAAe,EAAE,MAAM,SAAS,CAAC;AAM5E,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CA0CnE"}
|
package/dist/extract.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractAccount = extractAccount;
|
|
4
|
+
const session_1 = require("./session");
|
|
5
|
+
const tdata_1 = require("./tdata");
|
|
6
|
+
const standard_1 = require("./standard");
|
|
7
|
+
const stringsession_1 = require("./stringsession");
|
|
8
|
+
function extractAccount(props) {
|
|
9
|
+
switch (props.type) {
|
|
10
|
+
case 'session': {
|
|
11
|
+
const raw = (0, session_1.sessionToRawCredential)(props.path, props.json);
|
|
12
|
+
return (0, standard_1.normalizeCredential)(raw, {
|
|
13
|
+
source: 'session',
|
|
14
|
+
apiId: props.apiId,
|
|
15
|
+
apiHash: props.apiHash,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
case 'tdata': {
|
|
19
|
+
const raw = (0, tdata_1.tdataToRawCredential)(props.path, props.passcode ?? '');
|
|
20
|
+
return (0, standard_1.normalizeCredential)(raw, {
|
|
21
|
+
source: 'tdata',
|
|
22
|
+
apiId: props.apiId,
|
|
23
|
+
apiHash: props.apiHash,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
case 'stringSession': {
|
|
27
|
+
const parsed = (0, stringsession_1.decodeAnySessionString)(props.session);
|
|
28
|
+
if (parsed.authKey.length !== 256) {
|
|
29
|
+
throw new Error(`session string auth key is ${parsed.authKey.length} bytes, expected 256`);
|
|
30
|
+
}
|
|
31
|
+
const raw = {
|
|
32
|
+
authKey: parsed.authKey,
|
|
33
|
+
dcId: parsed.dcId,
|
|
34
|
+
userId: parsed.userId ?? null,
|
|
35
|
+
serverAddress: parsed.serverAddress,
|
|
36
|
+
port: parsed.port,
|
|
37
|
+
meta: { sourceLibrary: parsed.library, apiId: parsed.apiId },
|
|
38
|
+
};
|
|
39
|
+
return (0, standard_1.normalizeCredential)(raw, {
|
|
40
|
+
source: 'stringSession',
|
|
41
|
+
apiId: props.apiId,
|
|
42
|
+
apiHash: props.apiHash,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
default: {
|
|
46
|
+
const _exhaustive = props;
|
|
47
|
+
throw new Error(`unknown extract type: ${JSON.stringify(_exhaustive)}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,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AC,IAAI;gBACjB,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,IAAI;gBAC7B,aAAa,EAAE,MAAM,CAAC,aAAa;gBACnC,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;aAC7D,CAAC;YACF,OAAO,IAAA,8BAAmB,EAAC,GAAG,EAAE;gBAC9B,MAAM,EAAE,eAAe;gBACvB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,WAAW,GAAU,KAAK,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @astralyx/tg-bridge
|
|
3
|
+
*
|
|
4
|
+
* Bring any Telegram account — from a `.session` file or a `tdata` folder — into
|
|
5
|
+
* one standard JSON object (auth key + props). Pure Node, zero dependencies, no
|
|
6
|
+
* network, no SDK. Does not interact with accounts.
|
|
7
|
+
*/
|
|
8
|
+
export type { StandardAccount, AccountSource, ProxyConfig, DeviceInfo, ExtractProps, SessionProps, TDataProps, StringSessionProps, RawCredential, } from './types';
|
|
9
|
+
export { extractAccount } from './extract';
|
|
10
|
+
export { normalizeCredential, writeStandard, writeTelethonSession, buildStringSession, dcAddress, DEFAULT_API_ID, DEFAULT_API_HASH, } from './standard';
|
|
11
|
+
export { encodeStringSession, decodeStringSession, decodeAnySessionString, } from './stringsession';
|
|
12
|
+
export type { DecodedStringSession, ParsedSessionString, SessionStringLibrary, } from './stringsession';
|
|
13
|
+
export { sessionToRawCredential } from './session';
|
|
14
|
+
export { extractTData, tdataToRawCredential, resolveTdataDir } from './tdata';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,YAAY,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTdataDir = exports.tdataToRawCredential = exports.extractTData = exports.sessionToRawCredential = exports.decodeAnySessionString = exports.decodeStringSession = exports.encodeStringSession = exports.DEFAULT_API_HASH = exports.DEFAULT_API_ID = exports.dcAddress = exports.buildStringSession = exports.writeTelethonSession = exports.writeStandard = exports.normalizeCredential = exports.extractAccount = void 0;
|
|
4
|
+
// One-call extraction for any input type.
|
|
5
|
+
var extract_1 = require("./extract");
|
|
6
|
+
Object.defineProperty(exports, "extractAccount", { enumerable: true, get: function () { return extract_1.extractAccount; } });
|
|
7
|
+
// Normalization + output.
|
|
8
|
+
var standard_1 = require("./standard");
|
|
9
|
+
Object.defineProperty(exports, "normalizeCredential", { enumerable: true, get: function () { return standard_1.normalizeCredential; } });
|
|
10
|
+
Object.defineProperty(exports, "writeStandard", { enumerable: true, get: function () { return standard_1.writeStandard; } });
|
|
11
|
+
Object.defineProperty(exports, "writeTelethonSession", { enumerable: true, get: function () { return standard_1.writeTelethonSession; } });
|
|
12
|
+
Object.defineProperty(exports, "buildStringSession", { enumerable: true, get: function () { return standard_1.buildStringSession; } });
|
|
13
|
+
Object.defineProperty(exports, "dcAddress", { enumerable: true, get: function () { return standard_1.dcAddress; } });
|
|
14
|
+
Object.defineProperty(exports, "DEFAULT_API_ID", { enumerable: true, get: function () { return standard_1.DEFAULT_API_ID; } });
|
|
15
|
+
Object.defineProperty(exports, "DEFAULT_API_HASH", { enumerable: true, get: function () { return standard_1.DEFAULT_API_HASH; } });
|
|
16
|
+
// Pure StringSession codec.
|
|
17
|
+
var stringsession_1 = require("./stringsession");
|
|
18
|
+
Object.defineProperty(exports, "encodeStringSession", { enumerable: true, get: function () { return stringsession_1.encodeStringSession; } });
|
|
19
|
+
Object.defineProperty(exports, "decodeStringSession", { enumerable: true, get: function () { return stringsession_1.decodeStringSession; } });
|
|
20
|
+
Object.defineProperty(exports, "decodeAnySessionString", { enumerable: true, get: function () { return stringsession_1.decodeAnySessionString; } });
|
|
21
|
+
// Lower-level extractors (use directly for batch/advanced flows).
|
|
22
|
+
var session_1 = require("./session");
|
|
23
|
+
Object.defineProperty(exports, "sessionToRawCredential", { enumerable: true, get: function () { return session_1.sessionToRawCredential; } });
|
|
24
|
+
var tdata_1 = require("./tdata");
|
|
25
|
+
Object.defineProperty(exports, "extractTData", { enumerable: true, get: function () { return tdata_1.extractTData; } });
|
|
26
|
+
Object.defineProperty(exports, "tdataToRawCredential", { enumerable: true, get: function () { return tdata_1.tdataToRawCredential; } });
|
|
27
|
+
Object.defineProperty(exports, "resolveTdataDir", { enumerable: true, get: function () { return tdata_1.resolveTdataDir; } });
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAmBA,0CAA0C;AAC1C,qCAA2C;AAAlC,yGAAA,cAAc,OAAA;AAEvB,0BAA0B;AAC1B,uCAQoB;AAPlB,+GAAA,mBAAmB,OAAA;AACnB,yGAAA,aAAa,OAAA;AACb,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,4GAAA,gBAAgB,OAAA;AAGlB,4BAA4B;AAC5B,iDAIyB;AAHvB,oHAAA,mBAAmB,OAAA;AACnB,oHAAA,mBAAmB,OAAA;AACnB,uHAAA,sBAAsB,OAAA;AAQxB,kEAAkE;AAClE,qCAAmD;AAA1C,iHAAA,sBAAsB,OAAA;AAC/B,iCAA8E;AAArE,qGAAA,YAAY,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAAE,wGAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,UAAU,CAAC;AA8E3D,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CA4Df"}
|