@yume-chan/adb 0.0.17 → 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.
Files changed (177) hide show
  1. package/CHANGELOG.json +27 -0
  2. package/CHANGELOG.md +16 -1
  3. package/LICENSE +1 -1
  4. package/esm/adb.d.ts +63 -60
  5. package/esm/adb.d.ts.map +1 -1
  6. package/esm/adb.js +257 -229
  7. package/esm/adb.js.map +1 -1
  8. package/esm/auth.d.ts +51 -51
  9. package/esm/auth.d.ts.map +1 -1
  10. package/esm/auth.js +95 -96
  11. package/esm/auth.js.map +1 -1
  12. package/esm/backend.d.ts +8 -8
  13. package/esm/backend.d.ts.map +1 -1
  14. package/esm/backend.js +1 -1
  15. package/esm/commands/base.d.ts +6 -6
  16. package/esm/commands/base.js +8 -8
  17. package/esm/commands/framebuffer.d.ts +53 -53
  18. package/esm/commands/framebuffer.d.ts.map +1 -1
  19. package/esm/commands/framebuffer.js +46 -47
  20. package/esm/commands/framebuffer.js.map +1 -1
  21. package/esm/commands/index.d.ts +7 -8
  22. package/esm/commands/index.d.ts.map +1 -1
  23. package/esm/commands/index.js +7 -8
  24. package/esm/commands/index.js.map +1 -1
  25. package/esm/commands/install.d.ts +9 -3
  26. package/esm/commands/install.d.ts.map +1 -1
  27. package/esm/commands/install.js +27 -21
  28. package/esm/commands/install.js.map +1 -1
  29. package/esm/commands/power.d.ts +22 -22
  30. package/esm/commands/power.d.ts.map +1 -1
  31. package/esm/commands/power.js +48 -44
  32. package/esm/commands/power.js.map +1 -1
  33. package/esm/commands/reverse.d.ts +41 -28
  34. package/esm/commands/reverse.d.ts.map +1 -1
  35. package/esm/commands/reverse.js +125 -98
  36. package/esm/commands/reverse.js.map +1 -1
  37. package/esm/commands/subprocess/command.d.ts +57 -51
  38. package/esm/commands/subprocess/command.d.ts.map +1 -1
  39. package/esm/commands/subprocess/command.js +86 -82
  40. package/esm/commands/subprocess/command.js.map +1 -1
  41. package/esm/commands/subprocess/index.d.ts +3 -3
  42. package/esm/commands/subprocess/index.js +3 -3
  43. package/esm/commands/subprocess/protocols/index.d.ts +3 -3
  44. package/esm/commands/subprocess/protocols/index.js +3 -3
  45. package/esm/commands/subprocess/protocols/none.d.ts +35 -35
  46. package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
  47. package/esm/commands/subprocess/protocols/none.js +65 -55
  48. package/esm/commands/subprocess/protocols/none.js.map +1 -1
  49. package/esm/commands/subprocess/protocols/shell.d.ts +39 -38
  50. package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
  51. package/esm/commands/subprocess/protocols/shell.js +166 -154
  52. package/esm/commands/subprocess/protocols/shell.js.map +1 -1
  53. package/esm/commands/subprocess/protocols/types.d.ts +49 -49
  54. package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
  55. package/esm/commands/subprocess/protocols/types.js +1 -1
  56. package/esm/commands/subprocess/utils.d.ts +1 -1
  57. package/esm/commands/subprocess/utils.js +18 -18
  58. package/esm/commands/sync/index.d.ts +8 -7
  59. package/esm/commands/sync/index.d.ts.map +1 -1
  60. package/esm/commands/sync/index.js +8 -7
  61. package/esm/commands/sync/index.js.map +1 -1
  62. package/esm/commands/sync/list.d.ts +42 -40
  63. package/esm/commands/sync/list.d.ts.map +1 -1
  64. package/esm/commands/sync/list.js +67 -35
  65. package/esm/commands/sync/list.js.map +1 -1
  66. package/esm/commands/sync/pull.d.ts +13 -11
  67. package/esm/commands/sync/pull.d.ts.map +1 -1
  68. package/esm/commands/sync/pull.js +35 -36
  69. package/esm/commands/sync/pull.js.map +1 -1
  70. package/esm/commands/sync/push.d.ts +46 -7
  71. package/esm/commands/sync/push.d.ts.map +1 -1
  72. package/esm/commands/sync/push.js +89 -23
  73. package/esm/commands/sync/push.js.map +1 -1
  74. package/esm/commands/sync/request.d.ts +26 -23
  75. package/esm/commands/sync/request.d.ts.map +1 -1
  76. package/esm/commands/sync/request.js +40 -42
  77. package/esm/commands/sync/request.js.map +1 -1
  78. package/esm/commands/sync/response.d.ts +19 -19
  79. package/esm/commands/sync/response.d.ts.map +1 -1
  80. package/esm/commands/sync/response.js +54 -54
  81. package/esm/commands/sync/response.js.map +1 -1
  82. package/esm/commands/sync/socket.d.ts +27 -0
  83. package/esm/commands/sync/socket.d.ts.map +1 -0
  84. package/esm/commands/sync/socket.js +66 -0
  85. package/esm/commands/sync/socket.js.map +1 -0
  86. package/esm/commands/sync/stat.d.ts +72 -72
  87. package/esm/commands/sync/stat.d.ts.map +1 -1
  88. package/esm/commands/sync/stat.js +116 -94
  89. package/esm/commands/sync/stat.js.map +1 -1
  90. package/esm/commands/sync/sync.d.ts +72 -60
  91. package/esm/commands/sync/sync.d.ts.map +1 -1
  92. package/esm/commands/sync/sync.js +127 -148
  93. package/esm/commands/sync/sync.js.map +1 -1
  94. package/esm/commands/tcpip.d.ts +5 -5
  95. package/esm/commands/tcpip.js +18 -18
  96. package/esm/crypto.d.ts +36 -36
  97. package/esm/crypto.d.ts.map +1 -1
  98. package/esm/crypto.js +248 -238
  99. package/esm/crypto.js.map +1 -1
  100. package/esm/features.d.ts +10 -7
  101. package/esm/features.d.ts.map +1 -1
  102. package/esm/features.js +13 -10
  103. package/esm/features.js.map +1 -1
  104. package/esm/index.d.ts +9 -9
  105. package/esm/index.d.ts.map +1 -1
  106. package/esm/index.js +9 -9
  107. package/esm/index.js.map +1 -1
  108. package/esm/packet.d.ts +45 -46
  109. package/esm/packet.d.ts.map +1 -1
  110. package/esm/packet.js +43 -46
  111. package/esm/packet.js.map +1 -1
  112. package/esm/socket/dispatcher.d.ts +59 -59
  113. package/esm/socket/dispatcher.d.ts.map +1 -1
  114. package/esm/socket/dispatcher.js +223 -231
  115. package/esm/socket/dispatcher.js.map +1 -1
  116. package/esm/socket/index.d.ts +2 -2
  117. package/esm/socket/index.js +2 -2
  118. package/esm/socket/socket.d.ts +59 -59
  119. package/esm/socket/socket.d.ts.map +1 -1
  120. package/esm/socket/socket.js +118 -98
  121. package/esm/socket/socket.js.map +1 -1
  122. package/esm/utils/auto-reset-event.d.ts +9 -9
  123. package/esm/utils/auto-reset-event.d.ts.map +1 -1
  124. package/esm/utils/auto-reset-event.js +33 -33
  125. package/esm/utils/auto-reset-event.js.map +1 -1
  126. package/esm/utils/base64.d.ts +27 -27
  127. package/esm/utils/base64.d.ts.map +1 -1
  128. package/esm/utils/base64.js +246 -245
  129. package/esm/utils/base64.js.map +1 -1
  130. package/esm/utils/conditional-variable.d.ts +9 -0
  131. package/esm/utils/conditional-variable.d.ts.map +1 -0
  132. package/esm/utils/conditional-variable.js +34 -0
  133. package/esm/utils/conditional-variable.js.map +1 -0
  134. package/esm/utils/index.d.ts +4 -3
  135. package/esm/utils/index.d.ts.map +1 -1
  136. package/esm/utils/index.js +4 -3
  137. package/esm/utils/index.js.map +1 -1
  138. package/package.json +17 -13
  139. package/src/adb.ts +160 -101
  140. package/src/auth.ts +31 -22
  141. package/src/backend.ts +6 -4
  142. package/src/commands/base.ts +2 -2
  143. package/src/commands/framebuffer.ts +37 -41
  144. package/src/commands/index.ts +7 -8
  145. package/src/commands/power.ts +15 -11
  146. package/src/commands/reverse.ts +74 -30
  147. package/src/commands/subprocess/command.ts +34 -23
  148. package/src/commands/subprocess/index.ts +3 -3
  149. package/src/commands/subprocess/protocols/index.ts +3 -3
  150. package/src/commands/subprocess/protocols/none.ts +26 -11
  151. package/src/commands/subprocess/protocols/shell.ts +110 -56
  152. package/src/commands/subprocess/protocols/types.ts +10 -6
  153. package/src/commands/subprocess/utils.ts +1 -1
  154. package/src/commands/sync/index.ts +8 -7
  155. package/src/commands/sync/list.ts +74 -28
  156. package/src/commands/sync/pull.ts +49 -37
  157. package/src/commands/sync/push.ts +153 -32
  158. package/src/commands/sync/request.ts +37 -34
  159. package/src/commands/sync/response.ts +34 -27
  160. package/src/commands/sync/socket.ts +97 -0
  161. package/src/commands/sync/stat.ts +98 -70
  162. package/src/commands/sync/sync.ts +78 -97
  163. package/src/commands/tcpip.ts +5 -5
  164. package/src/crypto.ts +60 -32
  165. package/src/features.ts +9 -6
  166. package/src/index.ts +9 -10
  167. package/src/packet.ts +41 -46
  168. package/src/socket/dispatcher.ts +130 -108
  169. package/src/socket/index.ts +2 -2
  170. package/src/socket/socket.ts +84 -34
  171. package/src/utils/auto-reset-event.ts +16 -17
  172. package/src/utils/base64.ts +51 -41
  173. package/src/utils/conditional-variable.ts +45 -0
  174. package/src/utils/index.ts +4 -3
  175. package/tsconfig.build.json +1 -1
  176. package/tsconfig.build.tsbuildinfo +1 -1
  177. package/src/commands/install.ts +0 -32
@@ -1,149 +1,128 @@
1
- import { AutoDisposable } from '@yume-chan/event';
2
- import { BufferedReadableStream, WrapReadableStream, WrapWritableStream } from '@yume-chan/stream-extra';
3
- import { AdbFeatures } from '../../features.js';
4
- import { AutoResetEvent } from '../../utils/index.js';
5
- import { escapeArg } from '../subprocess/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
- }
25
- export class AdbSync extends AutoDisposable {
26
- adb;
27
- stream;
28
- // Getting another writer on a locked WritableStream will throw.
29
- // We don't want this behavior on higher-level APIs.
30
- // So we acquire the writer early and use a blocking lock to guard it.
31
- writer;
32
- sendLock = this.addDisposable(new AutoResetEvent());
33
- get supportsStat() {
34
- return this.adb.features.includes(AdbFeatures.StatV2);
35
- }
36
- get supportsList2() {
37
- return this.adb.features.includes(AdbFeatures.ListV2);
38
- }
39
- get fixedPushMkdir() {
40
- return this.adb.features.includes(AdbFeatures.FixedPushMkdir);
41
- }
42
- get needPushMkdirWorkaround() {
43
- // https://android.googlesource.com/platform/packages/modules/adb/+/91768a57b7138166e0a3d11f79cd55909dda7014/client/file_sync_client.cpp#1361
44
- return this.adb.features.includes(AdbFeatures.ShellV2) && !this.fixedPushMkdir;
45
- }
46
- constructor(adb, socket) {
47
- super();
48
- this.adb = adb;
49
- this.stream = new BufferedReadableStream(socket.readable);
50
- this.writer = socket.writable.getWriter();
51
- }
52
- async lstat(path) {
53
- await this.sendLock.wait();
54
- try {
55
- return adbSyncLstat(this.stream, this.writer, path, this.supportsStat);
56
- }
57
- finally {
58
- this.sendLock.notify();
59
- }
60
- }
61
- async stat(path) {
62
- if (!this.supportsStat) {
63
- throw new Error('Not supported');
64
- }
65
- await this.sendLock.wait();
66
- try {
67
- return adbSyncStat(this.stream, this.writer, path);
68
- }
69
- finally {
70
- this.sendLock.notify();
71
- }
72
- }
73
- async isDirectory(path) {
74
- try {
75
- await this.lstat(path + '/');
76
- return true;
77
- }
78
- catch (e) {
79
- return false;
80
- }
81
- }
82
- async *opendir(path) {
83
- await this.sendLock.wait();
84
- try {
85
- yield* adbSyncOpenDir(this.stream, this.writer, path, this.supportsList2);
86
- }
87
- finally {
88
- this.sendLock.notify();
89
- }
90
- }
91
- async readdir(path) {
92
- const results = [];
93
- for await (const entry of this.opendir(path)) {
94
- results.push(entry);
95
- }
96
- return results;
97
- }
98
- /**
99
- * Read the content of a file on device.
100
- *
101
- * @param filename The full path of the file on device to read.
102
- * @returns A `ReadableStream` that reads from the file.
103
- */
104
- read(filename) {
105
- return new WrapReadableStream({
106
- start: async () => {
107
- await this.sendLock.wait();
108
- return adbSyncPull(this.stream, this.writer, filename);
109
- },
110
- close: async () => {
111
- this.sendLock.notify();
112
- },
113
- });
114
- }
115
- /**
116
- * Write (or overwrite) a file on device.
117
- *
118
- * @param filename The full path of the file on device to write.
119
- * @param mode The unix permissions of the file.
120
- * @param mtime The modified time of the file.
121
- * @returns A `WritableStream` that writes to the file.
122
- */
123
- write(filename, mode, mtime) {
124
- return new WrapWritableStream({
125
- start: async () => {
126
- await this.sendLock.wait();
127
- if (this.needPushMkdirWorkaround) {
128
- // It may fail if the path is already existed.
129
- // Ignore the result.
130
- // TODO: sync: test push mkdir workaround (need an Android 8 device)
131
- await this.adb.subprocess.spawnAndWait([
132
- 'mkdir',
133
- '-p',
134
- escapeArg(dirname(filename)),
135
- ]);
136
- }
137
- return adbSyncPush(this.stream, this.writer, filename, mode, mtime);
138
- },
139
- close: async () => {
140
- this.sendLock.notify();
141
- }
142
- });
143
- }
144
- async dispose() {
145
- super.dispose();
146
- await this.writer.close();
147
- }
148
- }
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
+ }
149
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;AAClD,OAAO,EAAE,sBAAsB,EAAkB,kBAAkB,EAAE,kBAAkB,EAA+C,MAAM,yBAAyB,CAAC;AAGtK,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,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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;IAC/B,CAAC;CACJ"}
@@ -1,6 +1,6 @@
1
- import { AdbCommandBase } from './base.js';
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
@@ -1,19 +1,19 @@
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
- }
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
@@ -1 +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,CAA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