@yume-chan/adb 0.0.18 → 0.0.19
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.json +21 -0
- package/CHANGELOG.md +11 -1
- package/esm/adb.d.ts +63 -60
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +257 -249
- package/esm/adb.js.map +1 -1
- package/esm/auth.d.ts +51 -51
- package/esm/auth.d.ts.map +1 -1
- package/esm/auth.js +95 -96
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +8 -8
- package/esm/backend.d.ts.map +1 -1
- package/esm/backend.js +1 -1
- package/esm/commands/base.d.ts +6 -6
- package/esm/commands/base.d.ts.map +1 -1
- package/esm/commands/base.js +8 -8
- package/esm/commands/framebuffer.d.ts +53 -53
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +46 -46
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +7 -8
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +7 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/install.d.ts +9 -3
- package/esm/commands/install.d.ts.map +1 -1
- package/esm/commands/install.js +26 -26
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/power.d.ts +22 -22
- package/esm/commands/power.js +48 -48
- package/esm/commands/reverse.d.ts +41 -28
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +125 -100
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +57 -51
- package/esm/commands/subprocess/command.d.ts.map +1 -1
- package/esm/commands/subprocess/command.js +86 -80
- package/esm/commands/subprocess/command.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +3 -3
- package/esm/commands/subprocess/index.js +3 -3
- package/esm/commands/subprocess/protocols/index.d.ts +3 -3
- package/esm/commands/subprocess/protocols/index.js +3 -3
- package/esm/commands/subprocess/protocols/none.d.ts +35 -35
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +65 -55
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +39 -38
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +166 -162
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +49 -49
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/types.js +1 -1
- package/esm/commands/subprocess/utils.d.ts +1 -1
- package/esm/commands/subprocess/utils.js +18 -18
- package/esm/commands/sync/index.d.ts +8 -7
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +8 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +42 -40
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +67 -47
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +13 -11
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +35 -37
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +46 -7
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +89 -22
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +26 -23
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +40 -42
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +19 -19
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +54 -54
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/socket.d.ts +27 -0
- package/esm/commands/sync/socket.d.ts.map +1 -0
- package/esm/commands/sync/socket.js +66 -0
- package/esm/commands/sync/socket.js.map +1 -0
- package/esm/commands/sync/stat.d.ts +72 -72
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +116 -104
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +72 -60
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +127 -149
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/commands/tcpip.d.ts +5 -5
- package/esm/commands/tcpip.js +18 -18
- package/esm/crypto.d.ts +36 -36
- package/esm/crypto.js +248 -248
- package/esm/features.d.ts +10 -7
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +13 -10
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +9 -9
- package/esm/index.js +9 -9
- package/esm/packet.d.ts +45 -46
- package/esm/packet.d.ts.map +1 -1
- package/esm/packet.js +43 -48
- package/esm/packet.js.map +1 -1
- package/esm/socket/dispatcher.d.ts +59 -59
- package/esm/socket/dispatcher.d.ts.map +1 -1
- package/esm/socket/dispatcher.js +223 -234
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/index.d.ts +2 -2
- package/esm/socket/index.js +2 -2
- package/esm/socket/socket.d.ts +59 -59
- package/esm/socket/socket.d.ts.map +1 -1
- package/esm/socket/socket.js +118 -118
- package/esm/socket/socket.js.map +1 -1
- package/esm/utils/auto-reset-event.d.ts +9 -9
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +33 -33
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +27 -27
- package/esm/utils/base64.js +246 -246
- package/esm/utils/conditional-variable.d.ts +9 -0
- package/esm/utils/conditional-variable.d.ts.map +1 -0
- package/esm/utils/conditional-variable.js +34 -0
- package/esm/utils/conditional-variable.js.map +1 -0
- package/esm/utils/index.d.ts +4 -3
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +4 -3
- package/esm/utils/index.js.map +1 -1
- package/package.json +11 -10
- package/src/adb.ts +47 -37
- package/src/auth.ts +7 -6
- package/src/backend.ts +4 -4
- package/src/commands/base.ts +1 -1
- package/src/commands/framebuffer.ts +4 -4
- package/src/commands/index.ts +7 -8
- package/src/commands/reverse.ts +35 -10
- package/src/commands/subprocess/command.ts +12 -4
- package/src/commands/subprocess/index.ts +3 -3
- package/src/commands/subprocess/protocols/index.ts +3 -3
- package/src/commands/subprocess/protocols/none.ts +25 -11
- package/src/commands/subprocess/protocols/shell.ts +50 -28
- package/src/commands/subprocess/protocols/types.ts +8 -7
- package/src/commands/subprocess/utils.ts +1 -1
- package/src/commands/sync/index.ts +8 -7
- package/src/commands/sync/list.ts +42 -23
- package/src/commands/sync/pull.ts +40 -45
- package/src/commands/sync/push.ts +146 -39
- package/src/commands/sync/request.ts +20 -15
- package/src/commands/sync/response.ts +7 -6
- package/src/commands/sync/socket.ts +97 -0
- package/src/commands/sync/stat.ts +47 -42
- package/src/commands/sync/sync.ts +68 -108
- package/src/commands/tcpip.ts +5 -5
- package/src/features.ts +9 -6
- package/src/packet.ts +19 -34
- package/src/socket/dispatcher.ts +32 -47
- package/src/socket/index.ts +2 -2
- package/src/socket/socket.ts +26 -17
- package/src/utils/auto-reset-event.ts +14 -15
- package/src/utils/conditional-variable.ts +45 -0
- package/src/utils/index.ts +4 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/commands/install.ts +0 -40
|
@@ -1,150 +1,128 @@
|
|
|
1
|
-
import { AutoDisposable } from "@yume-chan/event";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
constructor(adb, socket) {
|
|
48
|
-
super();
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* @param
|
|
103
|
-
* @
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (this.needPushMkdirWorkaround) {
|
|
129
|
-
// It may fail if the path is already existed.
|
|
130
|
-
// Ignore the result.
|
|
131
|
-
// TODO: sync: test push mkdir workaround (need an Android 8 device)
|
|
132
|
-
await this.adb.subprocess.spawnAndWait([
|
|
133
|
-
"mkdir",
|
|
134
|
-
"-p",
|
|
135
|
-
escapeArg(dirname(filename)),
|
|
136
|
-
]);
|
|
137
|
-
}
|
|
138
|
-
return adbSyncPush(this.stream, this.writer, filename, mode, mtime);
|
|
139
|
-
},
|
|
140
|
-
close: () => {
|
|
141
|
-
this.sendLock.notify();
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
async dispose() {
|
|
146
|
-
super.dispose();
|
|
147
|
-
await this.writer.close();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
1
|
+
import { AutoDisposable } from "@yume-chan/event";
|
|
2
|
+
import { AdbFeature } from "../../features.js";
|
|
3
|
+
import { escapeArg } from "../subprocess/index.js";
|
|
4
|
+
import { adbSyncOpenDir } from "./list.js";
|
|
5
|
+
import { adbSyncPull } from "./pull.js";
|
|
6
|
+
import { adbSyncPush } from "./push.js";
|
|
7
|
+
import { AdbSyncSocket } from "./socket.js";
|
|
8
|
+
import { adbSyncLstat, adbSyncStat } from "./stat.js";
|
|
9
|
+
/**
|
|
10
|
+
* A simplified `dirname` function that only handles absolute unix paths.
|
|
11
|
+
* @param path an absolute unix path
|
|
12
|
+
* @returns the directory name of the input path
|
|
13
|
+
*/
|
|
14
|
+
export function dirname(path) {
|
|
15
|
+
const end = path.lastIndexOf("/");
|
|
16
|
+
if (end === -1) {
|
|
17
|
+
throw new Error(`Invalid path`);
|
|
18
|
+
}
|
|
19
|
+
if (end === 0) {
|
|
20
|
+
return "/";
|
|
21
|
+
}
|
|
22
|
+
return path.substring(0, end);
|
|
23
|
+
}
|
|
24
|
+
export class AdbSync extends AutoDisposable {
|
|
25
|
+
_adb;
|
|
26
|
+
_socket;
|
|
27
|
+
_supportsStat;
|
|
28
|
+
_supportsListV2;
|
|
29
|
+
_fixedPushMkdir;
|
|
30
|
+
_supportsSendReceiveV2;
|
|
31
|
+
_needPushMkdirWorkaround;
|
|
32
|
+
get supportsStat() {
|
|
33
|
+
return this._supportsStat;
|
|
34
|
+
}
|
|
35
|
+
get supportsListV2() {
|
|
36
|
+
return this._supportsListV2;
|
|
37
|
+
}
|
|
38
|
+
get fixedPushMkdir() {
|
|
39
|
+
return this._fixedPushMkdir;
|
|
40
|
+
}
|
|
41
|
+
get supportsSendReceiveV2() {
|
|
42
|
+
return this._supportsSendReceiveV2;
|
|
43
|
+
}
|
|
44
|
+
get needPushMkdirWorkaround() {
|
|
45
|
+
return this._needPushMkdirWorkaround;
|
|
46
|
+
}
|
|
47
|
+
constructor(adb, socket) {
|
|
48
|
+
super();
|
|
49
|
+
this._adb = adb;
|
|
50
|
+
this._socket = new AdbSyncSocket(socket, adb.maxPayloadSize);
|
|
51
|
+
this._supportsStat = adb.supportsFeature(AdbFeature.StatV2);
|
|
52
|
+
this._supportsListV2 = adb.supportsFeature(AdbFeature.ListV2);
|
|
53
|
+
this._fixedPushMkdir = adb.supportsFeature(AdbFeature.FixedPushMkdir);
|
|
54
|
+
this._supportsSendReceiveV2 = adb.supportsFeature(AdbFeature.SendReceiveV2);
|
|
55
|
+
// https://android.googlesource.com/platform/packages/modules/adb/+/91768a57b7138166e0a3d11f79cd55909dda7014/client/file_sync_client.cpp#1361
|
|
56
|
+
this._needPushMkdirWorkaround =
|
|
57
|
+
this._adb.supportsFeature(AdbFeature.ShellV2) &&
|
|
58
|
+
!this.fixedPushMkdir;
|
|
59
|
+
}
|
|
60
|
+
async lstat(path) {
|
|
61
|
+
return await adbSyncLstat(this._socket, path, this.supportsStat);
|
|
62
|
+
}
|
|
63
|
+
async stat(path) {
|
|
64
|
+
if (!this.supportsStat) {
|
|
65
|
+
throw new Error("Not supported");
|
|
66
|
+
}
|
|
67
|
+
return await adbSyncStat(this._socket, path);
|
|
68
|
+
}
|
|
69
|
+
async isDirectory(path) {
|
|
70
|
+
try {
|
|
71
|
+
await this.lstat(path + "/");
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
opendir(path) {
|
|
79
|
+
return adbSyncOpenDir(this._socket, path, this.supportsListV2);
|
|
80
|
+
}
|
|
81
|
+
async readdir(path) {
|
|
82
|
+
const results = [];
|
|
83
|
+
for await (const entry of this.opendir(path)) {
|
|
84
|
+
results.push(entry);
|
|
85
|
+
}
|
|
86
|
+
return results;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Read the content of a file on device.
|
|
90
|
+
*
|
|
91
|
+
* @param filename The full path of the file on device to read.
|
|
92
|
+
* @returns A `ReadableStream` that reads from the file.
|
|
93
|
+
*/
|
|
94
|
+
read(filename) {
|
|
95
|
+
return adbSyncPull(this._socket, filename);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Write (or overwrite) a file on device.
|
|
99
|
+
*
|
|
100
|
+
* @param filename The full path of the file on device to write.
|
|
101
|
+
* @param file The content to write.
|
|
102
|
+
* @param mode The unix permissions of the file.
|
|
103
|
+
* @param mtime The modified time of the file.
|
|
104
|
+
* @returns A `WritableStream` that writes to the file.
|
|
105
|
+
*/
|
|
106
|
+
async write(options) {
|
|
107
|
+
if (this.needPushMkdirWorkaround) {
|
|
108
|
+
// It may fail if the path is already existed.
|
|
109
|
+
// Ignore the result.
|
|
110
|
+
// TODO: sync: test push mkdir workaround (need an Android 8 device)
|
|
111
|
+
await this._adb.subprocess.spawnAndWait([
|
|
112
|
+
"mkdir",
|
|
113
|
+
"-p",
|
|
114
|
+
escapeArg(dirname(options.filename)),
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
await adbSyncPush({
|
|
118
|
+
v2: this.supportsSendReceiveV2,
|
|
119
|
+
socket: this._socket,
|
|
120
|
+
...options,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async dispose() {
|
|
124
|
+
super.dispose();
|
|
125
|
+
await this._socket.close();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
150
128
|
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;KACnC;IACD,IAAI,GAAG,KAAK,CAAC,EAAE;QACX,OAAO,GAAG,CAAC;KACd;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAUD,MAAM,OAAO,OAAQ,SAAQ,cA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ACJ,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;aACvC,CAAC,CAAC;SACN;QAED,MAAM,WAAW,CAAC;YACd,EAAE,EAAE,IAAI,CAAC,qBAAqB;YAC9B,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,GAAG,OAAO;SACb,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,OAAO;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACJ"}
|
package/esm/commands/tcpip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AdbCommandBase } from
|
|
2
|
-
export declare class AdbTcpIpCommand extends AdbCommandBase {
|
|
3
|
-
setPort(port: number): Promise<void>;
|
|
4
|
-
disable(): Promise<void>;
|
|
5
|
-
}
|
|
1
|
+
import { AdbCommandBase } from "./base.js";
|
|
2
|
+
export declare class AdbTcpIpCommand extends AdbCommandBase {
|
|
3
|
+
setPort(port: number): Promise<void>;
|
|
4
|
+
disable(): Promise<void>;
|
|
5
|
+
}
|
|
6
6
|
//# sourceMappingURL=tcpip.d.ts.map
|
package/esm/commands/tcpip.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { AdbCommandBase } from
|
|
2
|
-
export class AdbTcpIpCommand extends AdbCommandBase {
|
|
3
|
-
async setPort(port) {
|
|
4
|
-
if (port <= 0) {
|
|
5
|
-
throw new Error(`Invalid port ${port}`);
|
|
6
|
-
}
|
|
7
|
-
const output = await this.adb.createSocketAndWait(`tcpip:${port}`);
|
|
8
|
-
if (output !== `restarting in TCP mode port: ${port}\n`) {
|
|
9
|
-
throw new Error(
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
async disable() {
|
|
13
|
-
const output = await this.adb.createSocketAndWait(
|
|
14
|
-
if (output !==
|
|
15
|
-
throw new Error(
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
1
|
+
import { AdbCommandBase } from "./base.js";
|
|
2
|
+
export class AdbTcpIpCommand extends AdbCommandBase {
|
|
3
|
+
async setPort(port) {
|
|
4
|
+
if (port <= 0) {
|
|
5
|
+
throw new Error(`Invalid port ${port}`);
|
|
6
|
+
}
|
|
7
|
+
const output = await this.adb.createSocketAndWait(`tcpip:${port}`);
|
|
8
|
+
if (output !== `restarting in TCP mode port: ${port}\n`) {
|
|
9
|
+
throw new Error("Invalid response");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async disable() {
|
|
13
|
+
const output = await this.adb.createSocketAndWait("usb:");
|
|
14
|
+
if (output !== "restarting in USB mode\n") {
|
|
15
|
+
throw new Error("Invalid response");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
19
|
//# sourceMappingURL=tcpip.js.map
|
package/esm/crypto.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the `BigInt` value at the specified byte offset and length from the start of the view. There is
|
|
3
|
-
* no alignment constraint; multi-byte values may be fetched from any offset.
|
|
4
|
-
*
|
|
5
|
-
* Only supports Big-Endian, because that's what ADB uses.
|
|
6
|
-
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getBigUint(dataView: DataView, byteOffset: number, length: number): bigint;
|
|
9
|
-
/**
|
|
10
|
-
* Stores an arbitrary-precision positive `BigInt` value at the specified byte offset from the start of the view.
|
|
11
|
-
* @param byteOffset The place in the buffer at which the value should be set.
|
|
12
|
-
* @param value The value to set.
|
|
13
|
-
* @param littleEndian If `false` or `undefined`, a big-endian value should be written,
|
|
14
|
-
* otherwise a little-endian value should be written.
|
|
15
|
-
*/
|
|
16
|
-
export declare function setBigUint(dataView: DataView, byteOffset: number, value: bigint, littleEndian?: boolean): number;
|
|
17
|
-
export declare function parsePrivateKey(key: Uint8Array): [n: bigint, d: bigint];
|
|
18
|
-
export declare function modInverse(a: number, m: number): number;
|
|
19
|
-
export declare function calculatePublicKeyLength(): number;
|
|
20
|
-
export declare function calculatePublicKey(privateKey: Uint8Array): Uint8Array;
|
|
21
|
-
export declare function calculatePublicKey(privateKey: Uint8Array, output: Uint8Array): number;
|
|
22
|
-
/**
|
|
23
|
-
* Modular exponentiation.
|
|
24
|
-
*
|
|
25
|
-
* Calculate `(base ** exponent) % modulus` without actually calculating `(base ** exponent)`.
|
|
26
|
-
*
|
|
27
|
-
* See https://en.wikipedia.org/wiki/Modular_exponentiation#Implementation_in_Lua
|
|
28
|
-
*/
|
|
29
|
-
export declare function powMod(base: bigint, exponent: bigint, modulus: bigint): bigint;
|
|
30
|
-
export declare const SHA1_DIGEST_LENGTH = 20;
|
|
31
|
-
export declare const ASN1_SEQUENCE = 48;
|
|
32
|
-
export declare const ASN1_OCTET_STRING = 4;
|
|
33
|
-
export declare const ASN1_NULL = 5;
|
|
34
|
-
export declare const ASN1_OID = 6;
|
|
35
|
-
export declare const SHA1_DIGEST_INFO: Uint8Array;
|
|
36
|
-
export declare function sign(privateKey: Uint8Array, data: Uint8Array): Uint8Array;
|
|
1
|
+
/**
|
|
2
|
+
* Gets the `BigInt` value at the specified byte offset and length from the start of the view. There is
|
|
3
|
+
* no alignment constraint; multi-byte values may be fetched from any offset.
|
|
4
|
+
*
|
|
5
|
+
* Only supports Big-Endian, because that's what ADB uses.
|
|
6
|
+
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getBigUint(dataView: DataView, byteOffset: number, length: number): bigint;
|
|
9
|
+
/**
|
|
10
|
+
* Stores an arbitrary-precision positive `BigInt` value at the specified byte offset from the start of the view.
|
|
11
|
+
* @param byteOffset The place in the buffer at which the value should be set.
|
|
12
|
+
* @param value The value to set.
|
|
13
|
+
* @param littleEndian If `false` or `undefined`, a big-endian value should be written,
|
|
14
|
+
* otherwise a little-endian value should be written.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setBigUint(dataView: DataView, byteOffset: number, value: bigint, littleEndian?: boolean): number;
|
|
17
|
+
export declare function parsePrivateKey(key: Uint8Array): [n: bigint, d: bigint];
|
|
18
|
+
export declare function modInverse(a: number, m: number): number;
|
|
19
|
+
export declare function calculatePublicKeyLength(): number;
|
|
20
|
+
export declare function calculatePublicKey(privateKey: Uint8Array): Uint8Array;
|
|
21
|
+
export declare function calculatePublicKey(privateKey: Uint8Array, output: Uint8Array): number;
|
|
22
|
+
/**
|
|
23
|
+
* Modular exponentiation.
|
|
24
|
+
*
|
|
25
|
+
* Calculate `(base ** exponent) % modulus` without actually calculating `(base ** exponent)`.
|
|
26
|
+
*
|
|
27
|
+
* See https://en.wikipedia.org/wiki/Modular_exponentiation#Implementation_in_Lua
|
|
28
|
+
*/
|
|
29
|
+
export declare function powMod(base: bigint, exponent: bigint, modulus: bigint): bigint;
|
|
30
|
+
export declare const SHA1_DIGEST_LENGTH = 20;
|
|
31
|
+
export declare const ASN1_SEQUENCE = 48;
|
|
32
|
+
export declare const ASN1_OCTET_STRING = 4;
|
|
33
|
+
export declare const ASN1_NULL = 5;
|
|
34
|
+
export declare const ASN1_OID = 6;
|
|
35
|
+
export declare const SHA1_DIGEST_INFO: Uint8Array;
|
|
36
|
+
export declare function sign(privateKey: Uint8Array, data: Uint8Array): Uint8Array;
|
|
37
37
|
//# sourceMappingURL=crypto.d.ts.map
|