@yume-chan/adb 0.0.10 → 0.0.13
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 +50 -0
- package/CHANGELOG.md +29 -1
- package/LICENSE +1 -1
- package/README.md +71 -51
- package/esm/adb.d.ts +48 -0
- package/esm/adb.d.ts.map +1 -0
- package/esm/adb.js +149 -136
- package/esm/adb.js.map +1 -1
- package/{dts → esm}/auth.d.ts +11 -11
- package/esm/auth.d.ts.map +1 -0
- package/esm/auth.js +72 -110
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +9 -0
- package/esm/backend.d.ts.map +1 -0
- package/{dts → esm}/commands/base.d.ts +1 -1
- package/esm/commands/base.d.ts.map +1 -0
- package/esm/commands/base.js +1 -0
- package/esm/commands/base.js.map +1 -1
- package/{dts → esm}/commands/framebuffer.d.ts +3 -3
- package/esm/commands/framebuffer.d.ts.map +1 -0
- package/esm/commands/framebuffer.js +15 -18
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +9 -0
- package/esm/commands/index.d.ts.map +1 -0
- package/esm/commands/index.js +8 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/install.d.ts +4 -0
- package/esm/commands/install.d.ts.map +1 -0
- package/esm/commands/install.js +19 -13
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/power.d.ts +23 -0
- package/esm/commands/power.d.ts.map +1 -0
- package/esm/commands/power.js +45 -0
- package/esm/commands/power.js.map +1 -0
- package/{dts → esm}/commands/reverse.d.ts +3 -3
- package/esm/commands/reverse.d.ts.map +1 -0
- package/esm/commands/reverse.js +49 -60
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +56 -0
- package/esm/commands/subprocess/index.d.ts.map +1 -0
- package/esm/commands/subprocess/index.js +88 -0
- package/esm/commands/subprocess/index.js.map +1 -0
- package/esm/commands/subprocess/legacy.d.ts +35 -0
- package/esm/commands/subprocess/legacy.d.ts.map +1 -0
- package/esm/commands/subprocess/legacy.js +53 -0
- package/esm/commands/subprocess/legacy.js.map +1 -0
- package/esm/commands/subprocess/protocol.d.ts +39 -0
- package/esm/commands/subprocess/protocol.d.ts.map +1 -0
- package/esm/commands/subprocess/protocol.js +157 -0
- package/esm/commands/subprocess/protocol.js.map +1 -0
- package/esm/commands/subprocess/protocols/index.d.ts +4 -0
- package/esm/commands/subprocess/protocols/index.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/index.js +4 -0
- package/esm/commands/subprocess/protocols/index.js.map +1 -0
- package/esm/commands/subprocess/protocols/none.d.ts +35 -0
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/none.js +53 -0
- package/esm/commands/subprocess/protocols/none.js.map +1 -0
- package/esm/commands/subprocess/protocols/shell.d.ts +39 -0
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -0
- package/esm/commands/subprocess/protocols/shell.js +155 -0
- package/esm/commands/subprocess/protocols/shell.js.map +1 -0
- package/esm/commands/subprocess/protocols/types.d.ts +50 -0
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -0
- package/esm/commands/{shell → subprocess/protocols}/types.js +0 -0
- package/esm/commands/subprocess/protocols/types.js.map +1 -0
- package/esm/commands/subprocess/types.d.ts +50 -0
- package/esm/commands/subprocess/types.d.ts.map +1 -0
- package/esm/commands/subprocess/types.js +2 -0
- package/esm/commands/{shell → subprocess}/types.js.map +1 -1
- package/{dts/commands/shell → esm/commands/subprocess}/utils.d.ts +0 -0
- package/esm/commands/subprocess/utils.d.ts.map +1 -0
- package/esm/commands/{shell → subprocess}/utils.js +0 -0
- package/esm/commands/subprocess/utils.js.map +1 -0
- package/esm/commands/sync/index.d.ts +8 -0
- package/esm/commands/sync/index.d.ts.map +1 -0
- package/esm/commands/sync/index.js +7 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +41 -0
- package/esm/commands/sync/list.d.ts.map +1 -0
- package/esm/commands/sync/list.js +52 -20
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +11 -0
- package/esm/commands/sync/pull.d.ts.map +1 -0
- package/esm/commands/sync/pull.js +17 -11
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +8 -0
- package/esm/commands/sync/push.d.ts.map +1 -0
- package/esm/commands/sync/push.js +19 -37
- package/esm/commands/sync/push.js.map +1 -1
- package/{dts → esm}/commands/sync/request.d.ts +4 -3
- package/esm/commands/sync/request.d.ts.map +1 -0
- package/esm/commands/sync/request.js +25 -27
- package/esm/commands/sync/request.js.map +1 -1
- package/{dts → esm}/commands/sync/response.d.ts +4 -3
- package/esm/commands/sync/response.d.ts.map +1 -0
- package/esm/commands/sync/response.js +17 -20
- package/esm/commands/sync/response.js.map +1 -1
- package/{dts → esm}/commands/sync/stat.d.ts +16 -4
- package/esm/commands/sync/stat.d.ts.map +1 -0
- package/esm/commands/sync/stat.js +38 -30
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +61 -0
- package/esm/commands/sync/sync.d.ts.map +1 -0
- package/esm/commands/sync/sync.js +122 -89
- package/esm/commands/sync/sync.js.map +1 -1
- package/{dts → esm}/commands/tcpip.d.ts +1 -1
- package/{dts → esm}/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +14 -19
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/crypto.d.ts +37 -0
- package/esm/crypto.d.ts.map +1 -0
- package/esm/crypto.js +77 -62
- package/esm/crypto.js.map +1 -1
- package/esm/features.d.ts +8 -0
- package/esm/features.d.ts.map +1 -0
- package/esm/features.js +7 -3
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +11 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +10 -10
- package/esm/index.js.map +1 -1
- package/esm/packet.d.ts +47 -0
- package/esm/packet.d.ts.map +1 -0
- package/esm/packet.js +27 -52
- package/esm/packet.js.map +1 -1
- package/esm/socket/controller.d.ts +37 -0
- package/esm/socket/controller.d.ts.map +1 -0
- package/esm/socket/controller.js +52 -66
- package/esm/socket/controller.js.map +1 -1
- package/esm/socket/dispatcher.d.ts +44 -0
- package/esm/socket/dispatcher.d.ts.map +1 -0
- package/esm/socket/dispatcher.js +146 -165
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/index.d.ts +3 -0
- package/esm/socket/index.d.ts.map +1 -0
- package/esm/socket/index.js +2 -6
- package/esm/socket/index.js.map +1 -1
- package/esm/socket/socket.d.ts +46 -0
- package/esm/socket/socket.d.ts.map +1 -0
- package/esm/socket/socket.js +77 -13
- package/esm/socket/socket.js.map +1 -1
- package/esm/stream/buffered.d.ts +35 -0
- package/esm/stream/buffered.d.ts.map +1 -0
- package/esm/stream/buffered.js +123 -0
- package/esm/stream/buffered.js.map +1 -0
- package/esm/stream/detect.bak.d.ts +240 -0
- package/esm/stream/detect.bak.d.ts.map +1 -0
- package/esm/stream/detect.bak.js +60 -0
- package/esm/stream/detect.bak.js.map +1 -0
- package/esm/stream/detect.d.ts +2 -0
- package/esm/stream/detect.d.ts.map +1 -0
- package/esm/stream/detect.js +5 -0
- package/esm/stream/detect.js.map +1 -0
- package/esm/stream/detect.native.d.ts +240 -0
- package/esm/stream/detect.native.d.ts.map +1 -0
- package/esm/stream/detect.native.js +60 -0
- package/esm/stream/detect.native.js.map +1 -0
- package/esm/stream/detect.polyfill.d.ts +18 -0
- package/esm/stream/detect.polyfill.d.ts.map +1 -0
- package/esm/stream/detect.polyfill.js +9 -0
- package/esm/stream/detect.polyfill.js.map +1 -0
- package/esm/stream/index.d.ts +4 -0
- package/esm/stream/index.d.ts.map +1 -0
- package/esm/stream/index.js +3 -2
- package/esm/stream/index.js.map +1 -1
- package/esm/stream/transform.d.ts +98 -0
- package/esm/stream/transform.d.ts.map +1 -0
- package/esm/stream/transform.js +402 -0
- package/esm/stream/transform.js.map +1 -0
- package/{dts → esm}/utils/auto-reset-event.d.ts +1 -1
- package/esm/utils/auto-reset-event.d.ts.map +1 -0
- package/esm/utils/auto-reset-event.js +2 -1
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +5 -0
- package/esm/utils/base64.d.ts.map +1 -0
- package/esm/utils/base64.js +116 -80
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/encoding.d.ts +3 -0
- package/esm/utils/encoding.d.ts.map +1 -0
- package/esm/utils/encoding.js +1 -1
- package/esm/utils/encoding.js.map +1 -1
- package/esm/utils/index.d.ts +4 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +3 -5
- package/esm/utils/index.js.map +1 -1
- package/package.json +50 -44
- package/src/adb.ts +177 -150
- package/src/auth.ts +37 -30
- package/src/backend.ts +3 -12
- package/src/commands/base.ts +1 -1
- package/src/commands/framebuffer.ts +4 -4
- package/src/commands/index.ts +8 -8
- package/src/commands/install.ts +24 -15
- package/src/commands/power.ts +54 -0
- package/src/commands/reverse.ts +10 -8
- package/src/commands/subprocess/index.ts +139 -0
- package/src/commands/subprocess/protocols/index.ts +3 -0
- package/src/commands/subprocess/protocols/none.ts +68 -0
- package/src/commands/subprocess/protocols/shell.ts +190 -0
- package/src/commands/subprocess/protocols/types.ts +59 -0
- package/src/commands/{shell → subprocess}/utils.ts +0 -0
- package/src/commands/sync/index.ts +7 -7
- package/src/commands/sync/list.ts +56 -9
- package/src/commands/sync/pull.ts +27 -18
- package/src/commands/sync/push.ts +25 -30
- package/src/commands/sync/request.ts +8 -7
- package/src/commands/sync/response.ts +12 -6
- package/src/commands/sync/stat.ts +43 -14
- package/src/commands/sync/sync.ts +102 -34
- package/src/commands/tcpip.ts +3 -3
- package/src/crypto.ts +95 -84
- package/src/features.ts +6 -2
- package/src/index.ts +11 -10
- package/src/packet.ts +49 -53
- package/src/socket/dispatcher.ts +110 -109
- package/src/socket/index.ts +2 -6
- package/src/socket/socket.ts +125 -17
- package/src/stream/buffered.ts +147 -0
- package/src/stream/detect.native.ts +362 -0
- package/src/stream/detect.polyfill.ts +28 -0
- package/src/stream/detect.ts +5 -0
- package/src/stream/index.ts +3 -2
- package/src/stream/transform.ts +483 -0
- package/src/utils/auto-reset-event.ts +1 -1
- package/src/utils/base64.ts +161 -129
- package/src/utils/index.ts +3 -5
- package/tsconfig.build.json +3 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.test.json +10 -0
- package/dts/adb.d.ts +0 -46
- package/dts/adb.d.ts.map +0 -1
- package/dts/auth.d.ts.map +0 -1
- package/dts/backend.d.ts +0 -13
- package/dts/backend.d.ts.map +0 -1
- package/dts/commands/base.d.ts.map +0 -1
- package/dts/commands/demo-mode.d.ts +0 -41
- package/dts/commands/demo-mode.d.ts.map +0 -1
- package/dts/commands/framebuffer.d.ts.map +0 -1
- package/dts/commands/index.d.ts +0 -9
- package/dts/commands/index.d.ts.map +0 -1
- package/dts/commands/install.d.ts +0 -3
- package/dts/commands/install.d.ts.map +0 -1
- package/dts/commands/reverse.d.ts.map +0 -1
- package/dts/commands/shell/index.d.ts +0 -46
- package/dts/commands/shell/index.d.ts.map +0 -1
- package/dts/commands/shell/legacy.d.ts +0 -38
- package/dts/commands/shell/legacy.d.ts.map +0 -1
- package/dts/commands/shell/protocol.d.ts +0 -45
- package/dts/commands/shell/protocol.d.ts.map +0 -1
- package/dts/commands/shell/types.d.ts +0 -47
- package/dts/commands/shell/types.d.ts.map +0 -1
- package/dts/commands/shell/utils.d.ts.map +0 -1
- package/dts/commands/sync/index.d.ts +0 -8
- package/dts/commands/sync/index.d.ts.map +0 -1
- package/dts/commands/sync/list.d.ts +0 -17
- package/dts/commands/sync/list.d.ts.map +0 -1
- package/dts/commands/sync/pull.d.ts +0 -11
- package/dts/commands/sync/pull.d.ts.map +0 -1
- package/dts/commands/sync/push.d.ts +0 -8
- package/dts/commands/sync/push.d.ts.map +0 -1
- package/dts/commands/sync/request.d.ts.map +0 -1
- package/dts/commands/sync/response.d.ts.map +0 -1
- package/dts/commands/sync/stat.d.ts.map +0 -1
- package/dts/commands/sync/sync.d.ts +0 -68
- package/dts/commands/sync/sync.d.ts.map +0 -1
- package/dts/crypto.d.ts +0 -24
- package/dts/crypto.d.ts.map +0 -1
- package/dts/features.d.ts +0 -6
- package/dts/features.d.ts.map +0 -1
- package/dts/index.d.ts +0 -11
- package/dts/index.d.ts.map +0 -1
- package/dts/packet.d.ts +0 -27
- package/dts/packet.d.ts.map +0 -1
- package/dts/socket/close-event-emitter.d.ts +0 -8
- package/dts/socket/close-event-emitter.d.ts.map +0 -1
- package/dts/socket/controller.d.ts +0 -43
- package/dts/socket/controller.d.ts.map +0 -1
- package/dts/socket/data-event-emitter.d.ts +0 -10
- package/dts/socket/data-event-emitter.d.ts.map +0 -1
- package/dts/socket/dispatcher.d.ts +0 -53
- package/dts/socket/dispatcher.d.ts.map +0 -1
- package/dts/socket/index.d.ts +0 -7
- package/dts/socket/index.d.ts.map +0 -1
- package/dts/socket/logger.d.ts +0 -9
- package/dts/socket/logger.d.ts.map +0 -1
- package/dts/socket/socket.d.ts +0 -22
- package/dts/socket/socket.d.ts.map +0 -1
- package/dts/stream/buffered-stream.d.ts +0 -28
- package/dts/stream/buffered-stream.d.ts.map +0 -1
- package/dts/stream/index.d.ts +0 -3
- package/dts/stream/index.d.ts.map +0 -1
- package/dts/stream/stream.d.ts +0 -15
- package/dts/stream/stream.d.ts.map +0 -1
- package/dts/utils/auto-reset-event.d.ts.map +0 -1
- package/dts/utils/base64.d.ts +0 -7
- package/dts/utils/base64.d.ts.map +0 -1
- package/dts/utils/chunk.d.ts +0 -3
- package/dts/utils/chunk.d.ts.map +0 -1
- package/dts/utils/encoding.d.ts +0 -3
- package/dts/utils/encoding.d.ts.map +0 -1
- package/dts/utils/event-queue.d.ts +0 -35
- package/dts/utils/event-queue.d.ts.map +0 -1
- package/dts/utils/index.d.ts +0 -6
- package/dts/utils/index.d.ts.map +0 -1
- package/esm/commands/demo-mode.js +0 -170
- package/esm/commands/demo-mode.js.map +0 -1
- package/esm/commands/shell/index.js +0 -62
- package/esm/commands/shell/index.js.map +0 -1
- package/esm/commands/shell/legacy.js +0 -49
- package/esm/commands/shell/legacy.js.map +0 -1
- package/esm/commands/shell/protocol.js +0 -106
- package/esm/commands/shell/protocol.js.map +0 -1
- package/esm/commands/shell/utils.js.map +0 -1
- package/esm/socket/close-event-emitter.js +0 -28
- package/esm/socket/close-event-emitter.js.map +0 -1
- package/esm/socket/data-event-emitter.js +0 -25
- package/esm/socket/data-event-emitter.js.map +0 -1
- package/esm/socket/logger.js +0 -2
- package/esm/socket/logger.js.map +0 -1
- package/esm/stream/buffered-stream.js +0 -67
- package/esm/stream/buffered-stream.js.map +0 -1
- package/esm/stream/stream.js +0 -41
- package/esm/stream/stream.js.map +0 -1
- package/esm/utils/chunk.js +0 -70
- package/esm/utils/chunk.js.map +0 -1
- package/esm/utils/event-queue.js +0 -104
- package/esm/utils/event-queue.js.map +0 -1
- package/src/commands/demo-mode.ts +0 -160
- package/src/commands/shell/index.ts +0 -87
- package/src/commands/shell/legacy.ts +0 -59
- package/src/commands/shell/protocol.ts +0 -121
- package/src/commands/shell/types.ts +0 -55
- package/src/socket/close-event-emitter.ts +0 -28
- package/src/socket/controller.ts +0 -105
- package/src/socket/data-event-emitter.ts +0 -27
- package/src/socket/logger.ts +0 -12
- package/src/stream/buffered-stream.ts +0 -92
- package/src/stream/stream.ts +0 -50
- package/src/utils/chunk.ts +0 -70
- package/src/utils/encoding.ts +0 -13
- package/src/utils/event-queue.ts +0 -145
|
@@ -1,114 +1,147 @@
|
|
|
1
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter } from "tslib";
|
|
2
1
|
import { AutoDisposable } from '@yume-chan/event';
|
|
3
|
-
import { AdbFeatures } from '../../features';
|
|
4
|
-
import { AdbBufferedStream } from '../../stream';
|
|
5
|
-
import { AutoResetEvent } from '../../utils';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { AdbFeatures } from '../../features.js';
|
|
3
|
+
import { AdbBufferedStream, WrapReadableStream, WrapWritableStream } from '../../stream/index.js';
|
|
4
|
+
import { AutoResetEvent } from '../../utils/index.js';
|
|
5
|
+
import { escapeArg } from "../index.js";
|
|
6
|
+
import { adbSyncOpenDir } from './list.js';
|
|
7
|
+
import { adbSyncPull } from './pull.js';
|
|
8
|
+
import { adbSyncPush } from './push.js';
|
|
9
|
+
import { adbSyncLstat, adbSyncStat } from './stat.js';
|
|
10
|
+
/**
|
|
11
|
+
* A simplified `dirname` function that only handles absolute unix paths.
|
|
12
|
+
* @param path an absolute unix path
|
|
13
|
+
* @returns the directory name of the input path
|
|
14
|
+
*/
|
|
15
|
+
export function dirname(path) {
|
|
16
|
+
const end = path.lastIndexOf('/');
|
|
17
|
+
if (end === -1) {
|
|
18
|
+
throw new Error(`Invalid path`);
|
|
19
|
+
}
|
|
20
|
+
if (end === 0) {
|
|
21
|
+
return '/';
|
|
22
|
+
}
|
|
23
|
+
return path.substring(0, end);
|
|
24
|
+
}
|
|
10
25
|
export class AdbSync extends AutoDisposable {
|
|
26
|
+
adb;
|
|
27
|
+
stream;
|
|
28
|
+
writer;
|
|
29
|
+
sendLock = this.addDisposable(new AutoResetEvent());
|
|
30
|
+
get supportsStat() {
|
|
31
|
+
return this.adb.features.includes(AdbFeatures.StatV2);
|
|
32
|
+
}
|
|
33
|
+
get supportsList2() {
|
|
34
|
+
return this.adb.features.includes(AdbFeatures.ListV2);
|
|
35
|
+
}
|
|
36
|
+
get fixedPushMkdir() {
|
|
37
|
+
return this.adb.features.includes(AdbFeatures.FixedPushMkdir);
|
|
38
|
+
}
|
|
39
|
+
get needPushMkdirWorkaround() {
|
|
40
|
+
// https://android.googlesource.com/platform/packages/modules/adb/+/91768a57b7138166e0a3d11f79cd55909dda7014/client/file_sync_client.cpp#1361
|
|
41
|
+
return this.adb.features.includes(AdbFeatures.ShellV2) && !this.fixedPushMkdir;
|
|
42
|
+
}
|
|
11
43
|
constructor(adb, socket) {
|
|
12
44
|
super();
|
|
13
|
-
this.sendLock = this.addDisposable(new AutoResetEvent());
|
|
14
45
|
this.adb = adb;
|
|
15
46
|
this.stream = new AdbBufferedStream(socket);
|
|
47
|
+
this.writer = socket.writable.getWriter();
|
|
16
48
|
}
|
|
17
|
-
|
|
18
|
-
|
|
49
|
+
async lstat(path) {
|
|
50
|
+
await this.sendLock.wait();
|
|
51
|
+
try {
|
|
52
|
+
return adbSyncLstat(this.stream, this.writer, path, this.supportsStat);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
this.sendLock.notify();
|
|
56
|
+
}
|
|
19
57
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
58
|
+
async stat(path) {
|
|
59
|
+
if (!this.supportsStat) {
|
|
60
|
+
throw new Error('Not supported');
|
|
61
|
+
}
|
|
62
|
+
await this.sendLock.wait();
|
|
63
|
+
try {
|
|
64
|
+
return adbSyncStat(this.stream, this.writer, path);
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
this.sendLock.notify();
|
|
68
|
+
}
|
|
30
69
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
this.sendLock.notify();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
isDirectory(path) {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
try {
|
|
48
|
-
yield this.lstat(path + '/');
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
70
|
+
async isDirectory(path) {
|
|
71
|
+
try {
|
|
72
|
+
await this.lstat(path + '/');
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
55
78
|
}
|
|
56
|
-
opendir(path) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
});
|
|
79
|
+
async *opendir(path) {
|
|
80
|
+
await this.sendLock.wait();
|
|
81
|
+
try {
|
|
82
|
+
yield* adbSyncOpenDir(this.stream, this.writer, path, this.supportsList2);
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
this.sendLock.notify();
|
|
86
|
+
}
|
|
66
87
|
}
|
|
67
|
-
readdir(path) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const entry = _c.value;
|
|
74
|
-
results.push(entry);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
78
|
-
finally {
|
|
79
|
-
try {
|
|
80
|
-
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
81
|
-
}
|
|
82
|
-
finally { if (e_1) throw e_1.error; }
|
|
83
|
-
}
|
|
84
|
-
return results;
|
|
85
|
-
});
|
|
88
|
+
async readdir(path) {
|
|
89
|
+
const results = [];
|
|
90
|
+
for await (const entry of this.opendir(path)) {
|
|
91
|
+
results.push(entry);
|
|
92
|
+
}
|
|
93
|
+
return results;
|
|
86
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Read the content of a file on device.
|
|
97
|
+
*
|
|
98
|
+
* @param filename The full path of the file on device to read.
|
|
99
|
+
* @returns A `ReadableStream` that reads from the file.
|
|
100
|
+
*/
|
|
87
101
|
read(filename) {
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
102
|
+
return new WrapReadableStream({
|
|
103
|
+
start: async () => {
|
|
104
|
+
await this.sendLock.wait();
|
|
105
|
+
return adbSyncPull(this.stream, this.writer, filename);
|
|
106
|
+
},
|
|
107
|
+
close: async () => {
|
|
94
108
|
this.sendLock.notify();
|
|
95
|
-
}
|
|
109
|
+
},
|
|
96
110
|
});
|
|
97
111
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Write (or overwrite) a file on device.
|
|
114
|
+
*
|
|
115
|
+
* @param filename The full path of the file on device to write.
|
|
116
|
+
* @param mode The unix permissions of the file.
|
|
117
|
+
* @param mtime The modified time of the file.
|
|
118
|
+
* @returns A `WritableStream` that writes to the file.
|
|
119
|
+
*/
|
|
120
|
+
write(filename, mode, mtime) {
|
|
121
|
+
return new WrapWritableStream({
|
|
122
|
+
start: async () => {
|
|
123
|
+
await this.sendLock.wait();
|
|
124
|
+
if (this.needPushMkdirWorkaround) {
|
|
125
|
+
// It may fail if the path is already existed.
|
|
126
|
+
// Ignore the result.
|
|
127
|
+
// TODO: sync: test this
|
|
128
|
+
await this.adb.subprocess.spawnAndWait([
|
|
129
|
+
'mkdir',
|
|
130
|
+
'-p',
|
|
131
|
+
escapeArg(dirname(filename)),
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
return adbSyncPush(this.stream, this.writer, filename, mode, mtime);
|
|
135
|
+
},
|
|
136
|
+
close: async () => {
|
|
105
137
|
this.sendLock.notify();
|
|
106
138
|
}
|
|
107
139
|
});
|
|
108
140
|
}
|
|
109
|
-
dispose() {
|
|
141
|
+
async dispose() {
|
|
110
142
|
super.dispose();
|
|
111
143
|
this.stream.close();
|
|
144
|
+
await this.writer.close();
|
|
112
145
|
}
|
|
113
146
|
}
|
|
114
147
|
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAkB,kBAAkB,EAAE,kBAAkB,EAA+C,MAAM,uBAAuB,CAAC;AAC/J,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAqB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,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;AAED,MAAM,OAAO,OAAQ,SAAQ,cAAc;IAC7B,GAAG,CAAM;IAET,MAAM,CAAoB;IAE1B,MAAM,CAA0C;IAEhD,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;IAE9D,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAS,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,IAAI,EAAE;gBACd,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CACR,QAAgB,EAChB,IAAa,EACb,KAAc;QAEd,OAAO,IAAI,kBAAkB,CAAC;YAC1B,KAAK,EAAE,KAAK,IAAI,EAAE;gBACd,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAE3B,IAAI,IAAI,CAAC,uBAAuB,EAAE;oBAC9B,8CAA8C;oBAC9C,qBAAqB;oBACrB,wBAAwB;oBACxB,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,CAAC;wBACnC,OAAO;wBACP,IAAI;wBACJ,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;qBAC/B,CAAC,CAAC;iBACN;gBAED,OAAO,WAAW,CACd,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,QAAQ,EACR,IAAI,EACJ,KAAK,CACR,CAAC;YACN,CAAC;YACD,KAAK,EAAE,KAAK,IAAI,EAAE;gBACd,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,OAAO;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcpip.d.ts","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tcpip.d.ts","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,qBAAa,eAAgB,SAAQ,cAAc;IAClC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMxC"}
|
package/esm/commands/tcpip.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AdbCommandBase } from './base';
|
|
1
|
+
import { AdbCommandBase } from './base.js';
|
|
3
2
|
export class AdbTcpIpCommand extends AdbCommandBase {
|
|
4
|
-
setPort(port) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
});
|
|
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
|
+
}
|
|
14
11
|
}
|
|
15
|
-
disable() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
});
|
|
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
|
+
}
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
//# sourceMappingURL=tcpip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcpip.js","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tcpip.js","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACxC,KAAK,CAAC,OAAO,CAAC,IAAY;QAC7B,IAAI,IAAI,IAAI,CAAC,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;SAC3C;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,KAAK,gCAAgC,IAAI,IAAI,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACvC;IACL,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,MAAM,KAAK,0BAA0B,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACvC;IACL,CAAC;CACJ"}
|
package/esm/crypto.d.ts
ADDED
|
@@ -0,0 +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;
|
|
37
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAazF;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,UAyBvG;AA4BD,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAKvE;AAKD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAsB9C;AAED,wBAAgB,wBAAwB,WAEvC;AAED,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,UAAU,GACvB,UAAU,CAAC;AACd,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU,GACnB,MAAM,CAAC;AAuEV;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAkB9E;AAED,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,aAAa,KAAO,CAAC;AAClC,eAAO,MAAM,iBAAiB,IAAO,CAAC;AACtC,eAAO,MAAM,SAAS,IAAO,CAAC;AAC9B,eAAO,MAAM,QAAQ,IAAO,CAAC;AAG7B,eAAO,MAAM,gBAAgB,YAO3B,CAAC;AAQH,wBAAgB,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,CAyCzE"}
|
package/esm/crypto.js
CHANGED
|
@@ -1,38 +1,56 @@
|
|
|
1
|
+
import { getBigUint64, setBigUint64 } from '@yume-chan/dataview-bigint-polyfill/esm/fallback.js';
|
|
1
2
|
const BigInt0 = BigInt(0);
|
|
2
3
|
const BigInt1 = BigInt(1);
|
|
3
4
|
const BigInt2 = BigInt(2);
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const BigInt64 = BigInt(64);
|
|
6
|
+
/**
|
|
7
|
+
* Gets the `BigInt` value at the specified byte offset and length from the start of the view. There is
|
|
8
|
+
* no alignment constraint; multi-byte values may be fetched from any offset.
|
|
9
|
+
*
|
|
10
|
+
* Only supports Big-Endian, because that's what ADB uses.
|
|
11
|
+
* @param byteOffset The place in the buffer at which the value should be retrieved.
|
|
12
|
+
*/
|
|
13
|
+
export function getBigUint(dataView, byteOffset, length) {
|
|
7
14
|
let result = BigInt0;
|
|
8
|
-
//
|
|
15
|
+
// Currently `length` must be a multiplication of 8
|
|
9
16
|
// Support for arbitrary length can be easily added
|
|
10
|
-
for (let i =
|
|
11
|
-
result
|
|
12
|
-
const value =
|
|
17
|
+
for (let i = byteOffset; i < byteOffset + length; i += 8) {
|
|
18
|
+
result <<= BigInt64;
|
|
19
|
+
const value = getBigUint64(dataView, i, false);
|
|
13
20
|
result += value;
|
|
14
21
|
}
|
|
15
22
|
return result;
|
|
16
23
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Stores an arbitrary-precision positive `BigInt` value at the specified byte offset from the start of the view.
|
|
26
|
+
* @param byteOffset The place in the buffer at which the value should be set.
|
|
27
|
+
* @param value The value to set.
|
|
28
|
+
* @param littleEndian If `false` or `undefined`, a big-endian value should be written,
|
|
29
|
+
* otherwise a little-endian value should be written.
|
|
30
|
+
*/
|
|
31
|
+
export function setBigUint(dataView, byteOffset, value, littleEndian) {
|
|
32
|
+
const start = byteOffset;
|
|
33
|
+
if (littleEndian) {
|
|
34
|
+
while (value > BigInt0) {
|
|
35
|
+
setBigUint64(dataView, byteOffset, value, true);
|
|
36
|
+
byteOffset += 8;
|
|
37
|
+
value >>= BigInt64;
|
|
38
|
+
}
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
else {
|
|
41
|
+
// Because we don't know how long (in bits) the `value` is,
|
|
42
|
+
// Convert it to an array of `uint64` first.
|
|
43
|
+
const uint64Array = [];
|
|
44
|
+
while (value > BigInt0) {
|
|
45
|
+
uint64Array.push(BigInt.asUintN(64, value));
|
|
46
|
+
value >>= BigInt64;
|
|
47
|
+
}
|
|
48
|
+
for (let i = uint64Array.length - 1; i >= 0; i -= 1) {
|
|
49
|
+
setBigUint64(dataView, byteOffset, uint64Array[i], false);
|
|
50
|
+
byteOffset += 8;
|
|
51
|
+
}
|
|
35
52
|
}
|
|
53
|
+
return byteOffset - start;
|
|
36
54
|
}
|
|
37
55
|
// These values are correct only if
|
|
38
56
|
// modulus length is 2048 and
|
|
@@ -57,19 +75,15 @@ const RsaPrivateKeyNLength = 2048 / 8;
|
|
|
57
75
|
const RsaPrivateKeyDOffset = 303;
|
|
58
76
|
const RsaPrivateKeyDLength = 2048 / 8;
|
|
59
77
|
export function parsePrivateKey(key) {
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
const view = new DataView(key.buffer, key.byteOffset, key.byteLength);
|
|
79
|
+
const n = getBigUint(view, RsaPrivateKeyNOffset, RsaPrivateKeyNLength);
|
|
80
|
+
const d = getBigUint(view, RsaPrivateKeyDOffset, RsaPrivateKeyDLength);
|
|
62
81
|
return [n, d];
|
|
63
82
|
}
|
|
64
83
|
// Taken from https://stackoverflow.com/a/51562038
|
|
65
84
|
// I can't understand, but it does work
|
|
66
85
|
// Only used with numbers less than 2^32 so doesn't need BigInt
|
|
67
86
|
export function modInverse(a, m) {
|
|
68
|
-
// validate inputs
|
|
69
|
-
[a, m] = [Number(a), Number(m)];
|
|
70
|
-
if (Number.isNaN(a) || Number.isNaN(m)) {
|
|
71
|
-
return NaN; // invalid input
|
|
72
|
-
}
|
|
73
87
|
a = (a % m + m) % m;
|
|
74
88
|
if (!a || m < 2) {
|
|
75
89
|
return NaN; // invalid input
|
|
@@ -95,7 +109,7 @@ export function modInverse(a, m) {
|
|
|
95
109
|
export function calculatePublicKeyLength() {
|
|
96
110
|
return 4 + 4 + 2048 / 8 + 2048 / 8 + 4;
|
|
97
111
|
}
|
|
98
|
-
export function calculatePublicKey(privateKey, output
|
|
112
|
+
export function calculatePublicKey(privateKey, output) {
|
|
99
113
|
// Android has its own public key generation algorithm
|
|
100
114
|
// See https://android.googlesource.com/platform/system/core.git/+/91784040db2b9273687f88d8b95f729d4a61ecc2/libcrypto_utils/android_pubkey.cpp#111
|
|
101
115
|
// The public key is an array of
|
|
@@ -103,7 +117,7 @@ export function calculatePublicKey(privateKey, output, outputOffset = 0) {
|
|
|
103
117
|
// [
|
|
104
118
|
// modulusLengthInWords, // 32-bit integer, a "word" is 32-bit so it must be 2048 / 8 / 4
|
|
105
119
|
// // Actually the comment in Android source code was wrong
|
|
106
|
-
// n0inv, // 32-bit integer, the modular inverse of (
|
|
120
|
+
// n0inv, // 32-bit integer, the modular inverse of (low 32 bits of n)
|
|
107
121
|
// modulus, // n
|
|
108
122
|
// rr, // Montgomery parameter R^2
|
|
109
123
|
// exponent, // 32-bit integer, must be 65537
|
|
@@ -116,16 +130,17 @@ export function calculatePublicKey(privateKey, output, outputOffset = 0) {
|
|
|
116
130
|
let outputType;
|
|
117
131
|
const outputLength = calculatePublicKeyLength();
|
|
118
132
|
if (!output) {
|
|
119
|
-
output = new
|
|
120
|
-
outputType = '
|
|
133
|
+
output = new Uint8Array(outputLength);
|
|
134
|
+
outputType = 'Uint8Array';
|
|
121
135
|
}
|
|
122
136
|
else {
|
|
123
|
-
if (output.byteLength
|
|
137
|
+
if (output.byteLength < outputLength) {
|
|
124
138
|
throw new Error('output buffer is too small');
|
|
125
139
|
}
|
|
126
140
|
outputType = 'number';
|
|
127
141
|
}
|
|
128
|
-
const outputView = new DataView(output);
|
|
142
|
+
const outputView = new DataView(output.buffer, output.byteOffset, output.byteLength);
|
|
143
|
+
let outputOffset = 0;
|
|
129
144
|
// modulusLengthInWords
|
|
130
145
|
outputView.setUint32(outputOffset, 2048 / 8 / 4, true);
|
|
131
146
|
outputOffset += 4;
|
|
@@ -136,16 +151,15 @@ export function calculatePublicKey(privateKey, output, outputOffset = 0) {
|
|
|
136
151
|
outputView.setUint32(outputOffset, n0inv, true);
|
|
137
152
|
outputOffset += 4;
|
|
138
153
|
// Write n
|
|
139
|
-
|
|
154
|
+
setBigUint(outputView, outputOffset, n, true);
|
|
140
155
|
outputOffset += 256;
|
|
141
156
|
// Calculate rr = (2^(rsa_size)) ^ 2 mod n
|
|
142
157
|
let rr = BigInt(2) ** BigInt(4096) % n;
|
|
143
|
-
|
|
144
|
-
outputOffset += 256;
|
|
158
|
+
outputOffset += setBigUint(outputView, outputOffset, rr, true);
|
|
145
159
|
// exponent
|
|
146
160
|
outputView.setUint32(outputOffset, 65537, true);
|
|
147
161
|
outputOffset += 4;
|
|
148
|
-
if (outputType === '
|
|
162
|
+
if (outputType === 'Uint8Array') {
|
|
149
163
|
return output;
|
|
150
164
|
}
|
|
151
165
|
else {
|
|
@@ -174,20 +188,20 @@ export function powMod(base, exponent, modulus) {
|
|
|
174
188
|
}
|
|
175
189
|
return r;
|
|
176
190
|
}
|
|
177
|
-
export const
|
|
178
|
-
export const
|
|
179
|
-
export const
|
|
180
|
-
export const
|
|
181
|
-
export const
|
|
191
|
+
export const SHA1_DIGEST_LENGTH = 20;
|
|
192
|
+
export const ASN1_SEQUENCE = 0x30;
|
|
193
|
+
export const ASN1_OCTET_STRING = 0x04;
|
|
194
|
+
export const ASN1_NULL = 0x05;
|
|
195
|
+
export const ASN1_OID = 0x06;
|
|
182
196
|
// PKCS#1 SHA-1 hash digest info
|
|
183
|
-
export const
|
|
184
|
-
|
|
185
|
-
|
|
197
|
+
export const SHA1_DIGEST_INFO = new Uint8Array([
|
|
198
|
+
ASN1_SEQUENCE, 0x0d + SHA1_DIGEST_LENGTH,
|
|
199
|
+
ASN1_SEQUENCE, 0x09,
|
|
186
200
|
// SHA-1 (1 3 14 3 2 26)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
];
|
|
201
|
+
ASN1_OID, 0x05, 1 * 40 + 3, 14, 3, 2, 26,
|
|
202
|
+
ASN1_NULL, 0x00,
|
|
203
|
+
ASN1_OCTET_STRING, SHA1_DIGEST_LENGTH
|
|
204
|
+
]);
|
|
191
205
|
// SubtleCrypto.sign() will hash the given data and sign the hash
|
|
192
206
|
// But we don't need the hashing step
|
|
193
207
|
// (In another word, ADB just requires the client to
|
|
@@ -203,22 +217,23 @@ export function sign(privateKey, data) {
|
|
|
203
217
|
index += 1;
|
|
204
218
|
padded[index] = 1;
|
|
205
219
|
index += 1;
|
|
206
|
-
const fillLength = padded.length -
|
|
220
|
+
const fillLength = padded.length - SHA1_DIGEST_INFO.length - data.length - 1;
|
|
207
221
|
while (index < fillLength) {
|
|
208
222
|
padded[index] = 0xff;
|
|
209
223
|
index += 1;
|
|
210
224
|
}
|
|
211
225
|
padded[index] = 0;
|
|
212
226
|
index += 1;
|
|
213
|
-
padded.set(
|
|
214
|
-
index +=
|
|
215
|
-
padded.set(
|
|
227
|
+
padded.set(SHA1_DIGEST_INFO, index);
|
|
228
|
+
index += SHA1_DIGEST_INFO.length;
|
|
229
|
+
padded.set(data, index);
|
|
216
230
|
// Encryption
|
|
217
231
|
// signature = padded ** d % n
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
232
|
+
const view = new DataView(padded.buffer);
|
|
233
|
+
const signature = powMod(getBigUint(view, 0, view.byteLength), d, n);
|
|
234
|
+
// `padded` is not used anymore,
|
|
235
|
+
// re-use the buffer to store the result
|
|
236
|
+
setBigUint(view, 0, signature, false);
|
|
237
|
+
return padded;
|
|
223
238
|
}
|
|
224
239
|
//# sourceMappingURL=crypto.js.map
|
package/esm/crypto.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAA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