@yume-chan/adb 2.6.2 → 3.0.0-beta.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.
Files changed (451) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/esm/adb.d.ts +18 -15
  4. package/esm/adb.d.ts.map +1 -1
  5. package/esm/adb.js +18 -11
  6. package/esm/adb.js.map +1 -1
  7. package/esm/banner.d.ts +1 -1
  8. package/esm/banner.d.ts.map +1 -1
  9. package/esm/banner.js.map +1 -1
  10. package/esm/daemon/auth/authenticator.d.ts +28 -0
  11. package/esm/daemon/auth/authenticator.d.ts.map +1 -0
  12. package/esm/daemon/auth/authenticator.js +108 -0
  13. package/esm/daemon/auth/authenticator.js.map +1 -0
  14. package/esm/daemon/auth/index.d.ts +5 -0
  15. package/esm/daemon/auth/index.d.ts.map +1 -0
  16. package/esm/daemon/auth/index.js +5 -0
  17. package/esm/daemon/auth/index.js.map +1 -0
  18. package/esm/daemon/auth/packet-processor.d.ts +42 -0
  19. package/esm/daemon/auth/packet-processor.d.ts.map +1 -0
  20. package/esm/daemon/auth/packet-processor.js +129 -0
  21. package/esm/daemon/auth/packet-processor.js.map +1 -0
  22. package/esm/daemon/auth/public-key.d.ts +8 -0
  23. package/esm/daemon/auth/public-key.d.ts.map +1 -0
  24. package/esm/daemon/auth/public-key.js +74 -0
  25. package/esm/daemon/auth/public-key.js.map +1 -0
  26. package/esm/daemon/auth/type.d.ts +5 -0
  27. package/esm/daemon/auth/type.d.ts.map +1 -0
  28. package/esm/daemon/auth/type.js +2 -0
  29. package/esm/daemon/auth/type.js.map +1 -0
  30. package/esm/daemon/crypto.d.ts +6 -5
  31. package/esm/daemon/crypto.d.ts.map +1 -1
  32. package/esm/daemon/crypto.js +23 -72
  33. package/esm/daemon/crypto.js.map +1 -1
  34. package/esm/daemon/dispatcher.d.ts +3 -3
  35. package/esm/daemon/dispatcher.d.ts.map +1 -1
  36. package/esm/daemon/dispatcher.js +11 -4
  37. package/esm/daemon/dispatcher.js.map +1 -1
  38. package/esm/daemon/index.d.ts +1 -1
  39. package/esm/daemon/index.d.ts.map +1 -1
  40. package/esm/daemon/index.js +1 -1
  41. package/esm/daemon/index.js.map +1 -1
  42. package/esm/daemon/socket.d.ts +3 -3
  43. package/esm/daemon/socket.d.ts.map +1 -1
  44. package/esm/daemon/transport.d.ts +13 -65
  45. package/esm/daemon/transport.d.ts.map +1 -1
  46. package/esm/daemon/transport.js +18 -140
  47. package/esm/daemon/transport.js.map +1 -1
  48. package/esm/device-observer.d.ts +2 -3
  49. package/esm/device-observer.d.ts.map +1 -1
  50. package/esm/features-value.d.ts +40 -0
  51. package/esm/features-value.d.ts.map +1 -0
  52. package/esm/features-value.js +46 -0
  53. package/esm/features-value.js.map +1 -0
  54. package/esm/features.d.ts +4 -12
  55. package/esm/features.d.ts.map +1 -1
  56. package/esm/features.js +27 -13
  57. package/esm/features.js.map +1 -1
  58. package/esm/index.d.ts +1 -1
  59. package/esm/index.d.ts.map +1 -1
  60. package/esm/index.js +1 -1
  61. package/esm/index.js.map +1 -1
  62. package/esm/server/client.d.ts +7 -7
  63. package/esm/server/client.d.ts.map +1 -1
  64. package/esm/server/client.js +69 -86
  65. package/esm/server/client.js.map +1 -1
  66. package/esm/server/commands/wireless.js +1 -1
  67. package/esm/server/commands/wireless.js.map +1 -1
  68. package/esm/server/{stream.d.ts → data-connection.d.ts} +5 -5
  69. package/esm/server/data-connection.d.ts.map +1 -0
  70. package/esm/server/{stream.js → data-connection.js} +4 -4
  71. package/esm/server/data-connection.js.map +1 -0
  72. package/esm/server/index.d.ts +1 -1
  73. package/esm/server/index.d.ts.map +1 -1
  74. package/esm/server/index.js +1 -1
  75. package/esm/server/index.js.map +1 -1
  76. package/esm/server/observer.d.ts.map +1 -1
  77. package/esm/server/observer.js +14 -13
  78. package/esm/server/observer.js.map +1 -1
  79. package/esm/server/transport.d.ts +4 -6
  80. package/esm/server/transport.d.ts.map +1 -1
  81. package/esm/server/transport.js +9 -24
  82. package/esm/server/transport.js.map +1 -1
  83. package/esm/service/framebuffer.d.ts.map +1 -0
  84. package/esm/service/framebuffer.js.map +1 -0
  85. package/esm/{commands → service}/index.d.ts +1 -2
  86. package/esm/service/index.d.ts.map +1 -0
  87. package/esm/{commands → service}/index.js +1 -2
  88. package/esm/service/index.js.map +1 -0
  89. package/esm/{commands → service}/power.d.ts +4 -2
  90. package/esm/service/power.d.ts.map +1 -0
  91. package/esm/{commands → service}/power.js +11 -5
  92. package/esm/service/power.js.map +1 -0
  93. package/esm/service/reverse/error.d.ts +14 -0
  94. package/esm/service/reverse/error.d.ts.map +1 -0
  95. package/esm/service/reverse/error.js +21 -0
  96. package/esm/service/reverse/error.js.map +1 -0
  97. package/esm/service/reverse/index.d.ts +3 -0
  98. package/esm/service/reverse/index.d.ts.map +1 -0
  99. package/esm/service/reverse/index.js +4 -0
  100. package/esm/service/reverse/index.js.map +1 -0
  101. package/esm/service/reverse/response.d.ts +2 -0
  102. package/esm/service/reverse/response.d.ts.map +1 -0
  103. package/esm/service/reverse/response.js +30 -0
  104. package/esm/service/reverse/response.js.map +1 -0
  105. package/esm/service/reverse/service.d.ts +59 -0
  106. package/esm/service/reverse/service.d.ts.map +1 -0
  107. package/esm/{commands/reverse.js → service/reverse/service.js} +16 -45
  108. package/esm/service/reverse/service.js.map +1 -0
  109. package/esm/{commands → service}/subprocess/index.d.ts +1 -0
  110. package/esm/service/subprocess/index.d.ts.map +1 -0
  111. package/esm/{commands → service}/subprocess/index.js +1 -0
  112. package/esm/service/subprocess/index.js.map +1 -0
  113. package/esm/service/subprocess/none/index.d.ts.map +1 -0
  114. package/esm/service/subprocess/none/index.js.map +1 -0
  115. package/esm/{commands → service}/subprocess/none/process.d.ts +2 -2
  116. package/esm/service/subprocess/none/process.d.ts.map +1 -0
  117. package/esm/service/subprocess/none/process.js.map +1 -0
  118. package/esm/{commands → service}/subprocess/none/pty.d.ts +4 -4
  119. package/esm/service/subprocess/none/pty.d.ts.map +1 -0
  120. package/esm/{commands → service}/subprocess/none/pty.js +1 -1
  121. package/esm/service/subprocess/none/pty.js.map +1 -0
  122. package/esm/service/subprocess/none/service.d.ts +10 -0
  123. package/esm/service/subprocess/none/service.d.ts.map +1 -0
  124. package/esm/service/subprocess/none/service.js +44 -0
  125. package/esm/service/subprocess/none/service.js.map +1 -0
  126. package/esm/service/subprocess/none/spawner.d.ts +15 -0
  127. package/esm/service/subprocess/none/spawner.d.ts.map +1 -0
  128. package/esm/service/subprocess/none/spawner.js +31 -0
  129. package/esm/service/subprocess/none/spawner.js.map +1 -0
  130. package/esm/{commands → service}/subprocess/pty.d.ts +1 -1
  131. package/esm/service/subprocess/pty.d.ts.map +1 -0
  132. package/esm/{commands → service}/subprocess/pty.js.map +1 -1
  133. package/esm/service/subprocess/service.d.ts.map +1 -0
  134. package/esm/{commands → service}/subprocess/service.js +1 -1
  135. package/esm/service/subprocess/service.js.map +1 -0
  136. package/esm/service/subprocess/shell/index.d.ts +5 -0
  137. package/esm/{commands/subprocess/none → service/subprocess/shell}/index.d.ts.map +1 -1
  138. package/esm/service/subprocess/shell/index.js +6 -0
  139. package/esm/{commands/subprocess/none → service/subprocess/shell}/index.js.map +1 -1
  140. package/esm/{commands → service}/subprocess/shell/process.d.ts +2 -2
  141. package/esm/service/subprocess/shell/process.d.ts.map +1 -0
  142. package/esm/{commands → service}/subprocess/shell/process.js +4 -6
  143. package/esm/service/subprocess/shell/process.js.map +1 -0
  144. package/esm/{commands → service}/subprocess/shell/pty.d.ts +4 -4
  145. package/esm/service/subprocess/shell/pty.d.ts.map +1 -0
  146. package/esm/{commands → service}/subprocess/shell/pty.js +11 -9
  147. package/esm/service/subprocess/shell/pty.js.map +1 -0
  148. package/esm/service/subprocess/shell/service.d.ts +34 -0
  149. package/esm/service/subprocess/shell/service.d.ts.map +1 -0
  150. package/esm/service/subprocess/shell/service.js +52 -0
  151. package/esm/service/subprocess/shell/service.js.map +1 -0
  152. package/esm/service/subprocess/shell/shared.d.ts +2 -0
  153. package/esm/service/subprocess/shell/shared.d.ts.map +1 -0
  154. package/esm/{commands → service}/subprocess/shell/shared.js +2 -0
  155. package/esm/service/subprocess/shell/shared.js.map +1 -0
  156. package/esm/{commands → service}/subprocess/shell/spawner.d.ts +3 -7
  157. package/esm/service/subprocess/shell/spawner.d.ts.map +1 -0
  158. package/esm/service/subprocess/shell/spawner.js +45 -0
  159. package/esm/service/subprocess/shell/spawner.js.map +1 -0
  160. package/esm/service/subprocess/types.d.ts +14 -0
  161. package/esm/service/subprocess/types.d.ts.map +1 -0
  162. package/esm/service/subprocess/types.js +2 -0
  163. package/esm/service/subprocess/types.js.map +1 -0
  164. package/esm/service/subprocess/utils.d.ts +39 -0
  165. package/esm/service/subprocess/utils.d.ts.map +1 -0
  166. package/esm/service/subprocess/utils.js +142 -0
  167. package/esm/service/subprocess/utils.js.map +1 -0
  168. package/esm/service/sync/android.d.ts +34 -0
  169. package/esm/service/sync/android.d.ts.map +1 -0
  170. package/esm/service/sync/android.js +34 -0
  171. package/esm/service/sync/android.js.map +1 -0
  172. package/esm/service/sync/compression/compression.d.ts +17 -0
  173. package/esm/service/sync/compression/compression.d.ts.map +1 -0
  174. package/esm/service/sync/compression/compression.js +92 -0
  175. package/esm/service/sync/compression/compression.js.map +1 -0
  176. package/esm/service/sync/compression/format-ns.d.ts +5 -0
  177. package/esm/service/sync/compression/format-ns.d.ts.map +1 -0
  178. package/esm/service/sync/compression/format-ns.js +5 -0
  179. package/esm/service/sync/compression/format-ns.js.map +1 -0
  180. package/esm/service/sync/compression/format.d.ts +4 -0
  181. package/esm/service/sync/compression/format.d.ts.map +1 -0
  182. package/esm/service/sync/compression/format.js +3 -0
  183. package/esm/service/sync/compression/format.js.map +1 -0
  184. package/esm/service/sync/compression/index.d.ts +2 -0
  185. package/esm/service/sync/compression/index.d.ts.map +1 -0
  186. package/esm/service/sync/compression/index.js +2 -0
  187. package/esm/service/sync/compression/index.js.map +1 -0
  188. package/esm/service/sync/id/common.d.ts +17 -0
  189. package/esm/service/sync/id/common.d.ts.map +1 -0
  190. package/esm/service/sync/id/common.js +29 -0
  191. package/esm/service/sync/id/common.js.map +1 -0
  192. package/esm/service/sync/id/index.d.ts +4 -0
  193. package/esm/service/sync/id/index.d.ts.map +1 -0
  194. package/esm/service/sync/id/index.js +6 -0
  195. package/esm/service/sync/id/index.js.map +1 -0
  196. package/esm/service/sync/id/request.d.ts +7 -0
  197. package/esm/service/sync/id/request.d.ts.map +1 -0
  198. package/esm/service/sync/id/request.js +9 -0
  199. package/esm/service/sync/id/request.js.map +1 -0
  200. package/esm/service/sync/id/response.d.ts +6 -0
  201. package/esm/service/sync/id/response.d.ts.map +1 -0
  202. package/esm/service/sync/id/response.js +8 -0
  203. package/esm/service/sync/id/response.js.map +1 -0
  204. package/esm/service/sync/index-ns.d.ts +7 -0
  205. package/esm/service/sync/index-ns.d.ts.map +1 -0
  206. package/esm/service/sync/index-ns.js +7 -0
  207. package/esm/service/sync/index-ns.js.map +1 -0
  208. package/esm/service/sync/index.d.ts +3 -0
  209. package/esm/service/sync/index.d.ts.map +1 -0
  210. package/esm/service/sync/index.js +3 -0
  211. package/esm/service/sync/index.js.map +1 -0
  212. package/esm/service/sync/request/index.d.ts +5 -0
  213. package/esm/service/sync/request/index.d.ts.map +1 -0
  214. package/esm/service/sync/request/index.js +5 -0
  215. package/esm/service/sync/request/index.js.map +1 -0
  216. package/esm/{commands/sync → service/sync/request}/list.d.ts +21 -19
  217. package/esm/service/sync/request/list.d.ts.map +1 -0
  218. package/esm/service/sync/request/list.js +77 -0
  219. package/esm/service/sync/request/list.js.map +1 -0
  220. package/esm/service/sync/request/pull.d.ts +12 -0
  221. package/esm/service/sync/request/pull.d.ts.map +1 -0
  222. package/esm/service/sync/request/pull.js +28 -0
  223. package/esm/service/sync/request/pull.js.map +1 -0
  224. package/esm/service/sync/request/push.d.ts +54 -0
  225. package/esm/service/sync/request/push.d.ts.map +1 -0
  226. package/esm/service/sync/request/push.js +95 -0
  227. package/esm/service/sync/request/push.js.map +1 -0
  228. package/esm/{commands/sync → service/sync/request}/stat.d.ts +40 -50
  229. package/esm/service/sync/request/stat.d.ts.map +1 -0
  230. package/esm/service/sync/request/stat.js +89 -0
  231. package/esm/service/sync/request/stat.js.map +1 -0
  232. package/esm/service/sync/service.d.ts +123 -0
  233. package/esm/service/sync/service.d.ts.map +1 -0
  234. package/esm/service/sync/service.js +170 -0
  235. package/esm/service/sync/service.js.map +1 -0
  236. package/esm/service/sync/socket-pool.d.ts +11 -0
  237. package/esm/service/sync/socket-pool.d.ts.map +1 -0
  238. package/esm/service/sync/socket-pool.js +80 -0
  239. package/esm/service/sync/socket-pool.js.map +1 -0
  240. package/esm/service/sync/socket.d.ts +40 -0
  241. package/esm/service/sync/socket.d.ts.map +1 -0
  242. package/esm/service/sync/socket.js +153 -0
  243. package/esm/service/sync/socket.js.map +1 -0
  244. package/esm/{commands → service}/tcpip.d.ts +4 -2
  245. package/esm/service/tcpip.d.ts.map +1 -0
  246. package/esm/{commands → service}/tcpip.js +10 -7
  247. package/esm/service/tcpip.js.map +1 -0
  248. package/esm/utils/array-buffer.d.ts.map +1 -1
  249. package/esm/utils/array-buffer.js +2 -3
  250. package/esm/utils/array-buffer.js.map +1 -1
  251. package/esm/utils/base64.d.ts.map +1 -1
  252. package/esm/utils/base64.js +22 -10
  253. package/esm/utils/base64.js.map +1 -1
  254. package/esm/utils/index.d.ts +1 -0
  255. package/esm/utils/index.d.ts.map +1 -1
  256. package/esm/utils/index.js +1 -0
  257. package/esm/utils/index.js.map +1 -1
  258. package/esm/utils/md5.d.ts +8 -0
  259. package/esm/utils/md5.d.ts.map +1 -0
  260. package/esm/utils/md5.js +149 -0
  261. package/esm/utils/md5.js.map +1 -0
  262. package/package.json +9 -9
  263. package/src/adb.ts +44 -35
  264. package/src/banner.ts +2 -1
  265. package/src/daemon/auth/authenticator.ts +186 -0
  266. package/src/daemon/auth/index.ts +4 -0
  267. package/src/daemon/auth/packet-processor.ts +212 -0
  268. package/src/daemon/auth/public-key.ts +112 -0
  269. package/src/daemon/auth/type.ts +5 -0
  270. package/src/daemon/crypto.ts +36 -101
  271. package/src/daemon/dispatcher.ts +15 -8
  272. package/src/daemon/index.ts +1 -1
  273. package/src/daemon/socket.ts +3 -3
  274. package/src/daemon/transport.ts +35 -253
  275. package/src/device-observer.ts +3 -3
  276. package/src/features-value.ts +47 -0
  277. package/src/features.ts +31 -14
  278. package/src/index.ts +1 -1
  279. package/src/server/client.ts +94 -93
  280. package/src/server/commands/wireless.ts +1 -1
  281. package/src/server/{stream.ts → data-connection.ts} +4 -4
  282. package/src/server/index.ts +1 -1
  283. package/src/server/observer.ts +21 -19
  284. package/src/server/transport.ts +13 -34
  285. package/src/{commands → service}/index.ts +1 -2
  286. package/src/{commands → service}/power.ts +14 -5
  287. package/src/service/reverse/error.ts +35 -0
  288. package/src/service/reverse/index.ts +3 -0
  289. package/src/service/reverse/response.ts +38 -0
  290. package/src/{commands/reverse.ts → service/reverse/service.ts} +32 -72
  291. package/src/{commands → service}/subprocess/index.ts +1 -0
  292. package/src/{commands → service}/subprocess/none/process.ts +3 -3
  293. package/src/{commands → service}/subprocess/none/pty.ts +5 -5
  294. package/src/service/subprocess/none/service.ts +57 -0
  295. package/src/service/subprocess/none/spawner.ts +81 -0
  296. package/src/{commands → service}/subprocess/pty.ts +1 -1
  297. package/src/{commands → service}/subprocess/service.ts +1 -1
  298. package/src/{commands → service}/subprocess/shell/index.ts +1 -1
  299. package/src/{commands → service}/subprocess/shell/process.ts +6 -7
  300. package/src/{commands → service}/subprocess/shell/pty.ts +15 -13
  301. package/src/service/subprocess/shell/service.ts +75 -0
  302. package/src/{commands → service}/subprocess/shell/shared.ts +5 -0
  303. package/src/service/subprocess/shell/spawner.ts +109 -0
  304. package/src/service/subprocess/types.ts +19 -0
  305. package/src/service/subprocess/utils.ts +166 -0
  306. package/src/service/sync/android.ts +43 -0
  307. package/src/service/sync/compression/compression.ts +126 -0
  308. package/src/service/sync/compression/format-ns.ts +4 -0
  309. package/src/service/sync/compression/format.ts +5 -0
  310. package/src/service/sync/compression/index.ts +1 -0
  311. package/src/service/sync/id/common.ts +33 -0
  312. package/src/service/sync/id/index.ts +7 -0
  313. package/src/service/sync/id/request.ts +12 -0
  314. package/src/service/sync/id/response.ts +11 -0
  315. package/src/service/sync/index-ns.ts +6 -0
  316. package/src/service/sync/index.ts +2 -0
  317. package/src/service/sync/request/index.ts +4 -0
  318. package/src/service/sync/request/list.ts +110 -0
  319. package/src/service/sync/request/pull.ts +49 -0
  320. package/src/service/sync/request/push.ts +184 -0
  321. package/src/service/sync/request/stat.ts +127 -0
  322. package/src/service/sync/service.ts +255 -0
  323. package/src/service/sync/socket-pool.ts +97 -0
  324. package/src/service/sync/socket.ts +201 -0
  325. package/src/{commands → service}/tcpip.ts +13 -7
  326. package/src/utils/array-buffer.ts +2 -3
  327. package/src/utils/base64.ts +24 -10
  328. package/src/utils/index.ts +1 -0
  329. package/src/utils/md5.ts +185 -0
  330. package/yume-chan-adb-3.0.0-beta.0.tgz +0 -0
  331. package/CHANGELOG.md +0 -257
  332. package/esm/commands/base.d.ts +0 -8
  333. package/esm/commands/base.d.ts.map +0 -1
  334. package/esm/commands/base.js +0 -12
  335. package/esm/commands/base.js.map +0 -1
  336. package/esm/commands/framebuffer.d.ts.map +0 -1
  337. package/esm/commands/framebuffer.js.map +0 -1
  338. package/esm/commands/index.d.ts.map +0 -1
  339. package/esm/commands/index.js.map +0 -1
  340. package/esm/commands/power.d.ts.map +0 -1
  341. package/esm/commands/power.js.map +0 -1
  342. package/esm/commands/reverse.d.ts +0 -48
  343. package/esm/commands/reverse.d.ts.map +0 -1
  344. package/esm/commands/reverse.js.map +0 -1
  345. package/esm/commands/subprocess/index.d.ts.map +0 -1
  346. package/esm/commands/subprocess/index.js.map +0 -1
  347. package/esm/commands/subprocess/none/process.d.ts.map +0 -1
  348. package/esm/commands/subprocess/none/process.js.map +0 -1
  349. package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
  350. package/esm/commands/subprocess/none/pty.js.map +0 -1
  351. package/esm/commands/subprocess/none/service.d.ts +0 -10
  352. package/esm/commands/subprocess/none/service.d.ts.map +0 -1
  353. package/esm/commands/subprocess/none/service.js +0 -34
  354. package/esm/commands/subprocess/none/service.js.map +0 -1
  355. package/esm/commands/subprocess/none/spawner.d.ts +0 -19
  356. package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
  357. package/esm/commands/subprocess/none/spawner.js +0 -26
  358. package/esm/commands/subprocess/none/spawner.js.map +0 -1
  359. package/esm/commands/subprocess/pty.d.ts.map +0 -1
  360. package/esm/commands/subprocess/service.d.ts.map +0 -1
  361. package/esm/commands/subprocess/service.js.map +0 -1
  362. package/esm/commands/subprocess/shell/index.d.ts +0 -6
  363. package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
  364. package/esm/commands/subprocess/shell/index.js +0 -6
  365. package/esm/commands/subprocess/shell/index.js.map +0 -1
  366. package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
  367. package/esm/commands/subprocess/shell/process.js.map +0 -1
  368. package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
  369. package/esm/commands/subprocess/shell/pty.js.map +0 -1
  370. package/esm/commands/subprocess/shell/service.d.ts +0 -14
  371. package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
  372. package/esm/commands/subprocess/shell/service.js +0 -41
  373. package/esm/commands/subprocess/shell/service.js.map +0 -1
  374. package/esm/commands/subprocess/shell/shared.d.ts +0 -19
  375. package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
  376. package/esm/commands/subprocess/shell/shared.js.map +0 -1
  377. package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
  378. package/esm/commands/subprocess/shell/spawner.js +0 -38
  379. package/esm/commands/subprocess/shell/spawner.js.map +0 -1
  380. package/esm/commands/subprocess/utils.d.ts +0 -3
  381. package/esm/commands/subprocess/utils.d.ts.map +0 -1
  382. package/esm/commands/subprocess/utils.js +0 -56
  383. package/esm/commands/subprocess/utils.js.map +0 -1
  384. package/esm/commands/sync/index.d.ts +0 -9
  385. package/esm/commands/sync/index.d.ts.map +0 -1
  386. package/esm/commands/sync/index.js +0 -9
  387. package/esm/commands/sync/index.js.map +0 -1
  388. package/esm/commands/sync/list.d.ts.map +0 -1
  389. package/esm/commands/sync/list.js +0 -64
  390. package/esm/commands/sync/list.js.map +0 -1
  391. package/esm/commands/sync/pull.d.ts +0 -12
  392. package/esm/commands/sync/pull.d.ts.map +0 -1
  393. package/esm/commands/sync/pull.js +0 -33
  394. package/esm/commands/sync/pull.js.map +0 -1
  395. package/esm/commands/sync/push.d.ts +0 -61
  396. package/esm/commands/sync/push.d.ts.map +0 -1
  397. package/esm/commands/sync/push.js +0 -83
  398. package/esm/commands/sync/push.js.map +0 -1
  399. package/esm/commands/sync/request.d.ts +0 -24
  400. package/esm/commands/sync/request.d.ts.map +0 -1
  401. package/esm/commands/sync/request.js +0 -32
  402. package/esm/commands/sync/request.js.map +0 -1
  403. package/esm/commands/sync/response.d.ts +0 -28
  404. package/esm/commands/sync/response.d.ts.map +0 -1
  405. package/esm/commands/sync/response.js +0 -81
  406. package/esm/commands/sync/response.js.map +0 -1
  407. package/esm/commands/sync/socket.d.ts +0 -22
  408. package/esm/commands/sync/socket.d.ts.map +0 -1
  409. package/esm/commands/sync/socket.js +0 -78
  410. package/esm/commands/sync/socket.js.map +0 -1
  411. package/esm/commands/sync/stat.d.ts.map +0 -1
  412. package/esm/commands/sync/stat.js +0 -121
  413. package/esm/commands/sync/stat.js.map +0 -1
  414. package/esm/commands/sync/sync.d.ts +0 -82
  415. package/esm/commands/sync/sync.d.ts.map +0 -1
  416. package/esm/commands/sync/sync.js +0 -138
  417. package/esm/commands/sync/sync.js.map +0 -1
  418. package/esm/commands/tcpip.d.ts.map +0 -1
  419. package/esm/commands/tcpip.js.map +0 -1
  420. package/esm/daemon/auth.d.ts +0 -54
  421. package/esm/daemon/auth.d.ts.map +0 -1
  422. package/esm/daemon/auth.js +0 -104
  423. package/esm/daemon/auth.js.map +0 -1
  424. package/esm/server/stream.d.ts.map +0 -1
  425. package/esm/server/stream.js.map +0 -1
  426. package/src/commands/base.ts +0 -15
  427. package/src/commands/subprocess/none/service.ts +0 -45
  428. package/src/commands/subprocess/none/spawner.ts +0 -68
  429. package/src/commands/subprocess/shell/service.ts +0 -58
  430. package/src/commands/subprocess/shell/spawner.ts +0 -90
  431. package/src/commands/subprocess/utils.ts +0 -61
  432. package/src/commands/sync/index.ts +0 -8
  433. package/src/commands/sync/list.ts +0 -99
  434. package/src/commands/sync/pull.ts +0 -55
  435. package/src/commands/sync/push.ts +0 -172
  436. package/src/commands/sync/request.ts +0 -53
  437. package/src/commands/sync/response.ts +0 -105
  438. package/src/commands/sync/socket.ts +0 -109
  439. package/src/commands/sync/stat.ts +0 -177
  440. package/src/commands/sync/sync.ts +0 -175
  441. package/src/daemon/auth.ts +0 -203
  442. package/tsconfig.build.tsbuildinfo +0 -1
  443. /package/esm/{commands → service}/framebuffer.d.ts +0 -0
  444. /package/esm/{commands → service}/framebuffer.js +0 -0
  445. /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
  446. /package/esm/{commands → service}/subprocess/none/index.js +0 -0
  447. /package/esm/{commands → service}/subprocess/none/process.js +0 -0
  448. /package/esm/{commands → service}/subprocess/pty.js +0 -0
  449. /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
  450. /package/src/{commands → service}/framebuffer.ts +0 -0
  451. /package/src/{commands → service}/subprocess/none/index.ts +0 -0
@@ -0,0 +1,201 @@
1
+ import { getUint32LittleEndian } from "@yume-chan/no-data-view";
2
+ import type {
3
+ MaybeConsumable,
4
+ WritableStreamDefaultWriter,
5
+ } from "@yume-chan/stream-extra";
6
+ import {
7
+ BufferCombiner,
8
+ BufferedReadableStream,
9
+ clearTimeout,
10
+ Consumable,
11
+ setTimeout,
12
+ tryCancel,
13
+ } from "@yume-chan/stream-extra";
14
+ import type { AsyncExactReadable, StructDeserializer } from "@yume-chan/struct";
15
+ import { decodeUtf8, string, struct, u32 } from "@yume-chan/struct";
16
+
17
+ import type { Adb } from "../../adb.js";
18
+ import { AutoResetEvent, encodeUtf8, unreachable } from "../../utils/index.js";
19
+
20
+ import { ResponseId } from "./id/index.js";
21
+
22
+ const NumberRequest = struct({ id: u32, arg: u32 }, { littleEndian: true });
23
+
24
+ class AdbSyncError extends Error {}
25
+ export { AdbSyncError as Error };
26
+
27
+ const FailResponse = struct(
28
+ { message: string(u32) },
29
+ {
30
+ littleEndian: true,
31
+ postDeserialize(value) {
32
+ throw new AdbSyncError(value.message);
33
+ },
34
+ },
35
+ );
36
+
37
+ function i32ToHex(i: number) {
38
+ return "0x" + i.toString(16).padStart(8, "0");
39
+ }
40
+
41
+ export class Socket implements AsyncExactReadable {
42
+ static readonly NumberRequest = NumberRequest;
43
+ static readonly FailResponse = FailResponse;
44
+
45
+ readonly #socket: Adb.Socket;
46
+ readonly #writer: WritableStreamDefaultWriter<MaybeConsumable<Uint8Array>>;
47
+ readonly #readable: BufferedReadableStream;
48
+ readonly #writeLock = new AutoResetEvent();
49
+ readonly #combiner: BufferCombiner;
50
+ #idleTimeoutId: ReturnType<typeof setTimeout> | null = null;
51
+
52
+ get position() {
53
+ return this.#readable.position;
54
+ }
55
+
56
+ get closed(): Promise<undefined> {
57
+ return this.#socket.closed;
58
+ }
59
+
60
+ constructor(socket: Adb.Socket, bufferSize: number) {
61
+ this.#socket = socket;
62
+ this.#writer = socket.writable.getWriter();
63
+ this.#readable = new BufferedReadableStream(socket.readable);
64
+ this.#combiner = new BufferCombiner(bufferSize);
65
+ }
66
+
67
+ /**
68
+ * Start an idle timer that will close the socket after the specified duration.
69
+ * The timer is automatically cancelled when the socket is used.
70
+ * @param timeout The timeout in milliseconds
71
+ * @param callback The callback to invoke when the timeout expires
72
+ */
73
+ startIdleTimer(timeout: number, callback: () => void) {
74
+ this.clearIdleTimer();
75
+ this.#idleTimeoutId = setTimeout(callback, timeout);
76
+ }
77
+
78
+ /**
79
+ * Clear the idle timer.
80
+ */
81
+ clearIdleTimer() {
82
+ if (this.#idleTimeoutId !== null) {
83
+ clearTimeout(this.#idleTimeoutId);
84
+ this.#idleTimeoutId = null;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Write a packet to the socket.
90
+ * @param packet The packet to write. Must be smaller than the buffer size.
91
+ */
92
+ #writeOne(packet: Uint8Array) {
93
+ // `#combiner` will reuse the buffer, so we need to use the Consumable pattern
94
+ return Consumable.WritableStream.write(this.#writer, packet);
95
+ }
96
+
97
+ async #withWriteLock(callback: () => Promise<void>) {
98
+ try {
99
+ await this.#writeLock.wait();
100
+ await callback();
101
+ } finally {
102
+ this.#writeLock.notifyOne();
103
+ }
104
+ }
105
+
106
+ async flush() {
107
+ const buffer = this.#combiner.flush();
108
+ if (buffer) {
109
+ await this.#withWriteLock(() => this.#writeOne(buffer));
110
+ }
111
+ }
112
+
113
+ async #write(data: Uint8Array) {
114
+ for (const buffer of this.#combiner.push(data)) {
115
+ await this.#writeOne(buffer);
116
+ }
117
+ }
118
+
119
+ write(data: Uint8Array) {
120
+ return this.#withWriteLock(() => this.#write(data));
121
+ }
122
+
123
+ async writeRequest(id: number, value: number | string | Uint8Array) {
124
+ return this.#withWriteLock(async () => {
125
+ if (typeof value === "number") {
126
+ await this.#write(NumberRequest.serialize({ id, arg: value }));
127
+ return;
128
+ }
129
+
130
+ if (typeof value === "string") {
131
+ value = encodeUtf8(value);
132
+ }
133
+
134
+ await this.#write(
135
+ NumberRequest.serialize({ id, arg: value.length }),
136
+ );
137
+ await this.#write(value);
138
+ });
139
+ }
140
+
141
+ async readExactly(length: number) {
142
+ // The request may still be in the internal buffer.
143
+ // Call `flush` to send it before starting reading
144
+ await this.flush();
145
+ return await this.#readable.readExactly(length);
146
+ }
147
+
148
+ async readResponse<T>(id: number, type: StructDeserializer<T>) {
149
+ const buffer = await this.readExactly(4);
150
+ switch (getUint32LittleEndian(buffer, 0)) {
151
+ case ResponseId.Fail:
152
+ await FailResponse.deserialize(this.#readable);
153
+ unreachable();
154
+ case id:
155
+ return await type.deserialize(this.#readable);
156
+ default:
157
+ // non-recoverable
158
+ throw new Error(
159
+ `Expected '${id}', but got '${decodeUtf8(buffer)}'`,
160
+ );
161
+ }
162
+ }
163
+
164
+ async *readResponses<T>(
165
+ expectedId: number,
166
+ type: StructDeserializer<T>,
167
+ ): AsyncGenerator<T, void, void> {
168
+ await this.flush();
169
+
170
+ while (true) {
171
+ const buffer = await this.#readable.readExactly(4);
172
+ const actualId = getUint32LittleEndian(buffer, 0);
173
+ switch (actualId) {
174
+ case ResponseId.Fail:
175
+ await FailResponse.deserialize(this.#readable);
176
+ unreachable();
177
+ case ResponseId.Done:
178
+ // `DONE` responses' size are always same as the request's normal response.
179
+ //
180
+ // For example, `DONE` responses for `LIST` requests are 16 bytes (same as `DENT` responses),
181
+ // but `DONE` responses for `STAT` requests are 12 bytes (same as `STAT` responses).
182
+ await this.#readable.readExactly(type.size);
183
+ return;
184
+ case expectedId:
185
+ yield await type.deserialize(this.#readable);
186
+ break;
187
+ default:
188
+ // non-recoverable
189
+ throw new Error(
190
+ `Expected ${i32ToHex(expectedId)} or ${i32ToHex(ResponseId.Done)}, but got ${i32ToHex(actualId)}`,
191
+ );
192
+ }
193
+ }
194
+ }
195
+
196
+ async close() {
197
+ this.clearIdleTimer();
198
+ await tryCancel(this.#readable);
199
+ await this.#socket.close();
200
+ }
201
+ }
@@ -1,4 +1,4 @@
1
- import { AdbServiceBase } from "./base.js";
1
+ import type { Adb } from "../adb.js";
2
2
 
3
3
  /**
4
4
  * ADB daemon checks for the following properties in the order of
@@ -27,13 +27,19 @@ function parsePort(value: string): number | undefined {
27
27
  return Number.parseInt(value, 10);
28
28
  }
29
29
 
30
- export class AdbTcpIpService extends AdbServiceBase {
30
+ export class AdbTcpIpService {
31
+ readonly #adb: Adb;
32
+
33
+ constructor(adb: Adb) {
34
+ this.#adb = adb;
35
+ }
36
+
31
37
  async getListenAddresses(): Promise<AdbTcpIpListenAddresses> {
32
- const serviceListenAddresses = await this.adb.getProp(
38
+ const serviceListenAddresses = await this.#adb.getProp(
33
39
  "service.adb.listen_addrs",
34
40
  );
35
- const servicePort = await this.adb.getProp("service.adb.tcp.port");
36
- const persistPort = await this.adb.getProp("persist.adb.tcp.port");
41
+ const servicePort = await this.#adb.getProp("service.adb.tcp.port");
42
+ const persistPort = await this.#adb.getProp("persist.adb.tcp.port");
37
43
 
38
44
  return {
39
45
  serviceListenAddresses:
@@ -50,7 +56,7 @@ export class AdbTcpIpService extends AdbServiceBase {
50
56
  throw new TypeError(`Invalid port ${port}`);
51
57
  }
52
58
 
53
- const output = await this.adb.createSocketAndWait(`tcpip:${port}`);
59
+ const output = await this.#adb.createSocketAndWait(`tcpip:${port}`);
54
60
  if (output !== `restarting in TCP mode port: ${port}\n`) {
55
61
  throw new Error(output);
56
62
  }
@@ -58,7 +64,7 @@ export class AdbTcpIpService extends AdbServiceBase {
58
64
  }
59
65
 
60
66
  async disable(): Promise<string> {
61
- const output = await this.adb.createSocketAndWait("usb:");
67
+ const output = await this.#adb.createSocketAndWait("usb:");
62
68
  if (output !== "restarting in USB mode\n") {
63
69
  throw new Error(output);
64
70
  }
@@ -3,7 +3,6 @@ export function toLocalUint8Array(value: Uint8Array): Uint8Array<ArrayBuffer> {
3
3
  return value as Uint8Array<ArrayBuffer>;
4
4
  }
5
5
 
6
- const copy = new Uint8Array(value.length);
7
- copy.set(value);
8
- return copy;
6
+ // This invokes the `constructor(Iterable<number>)` overload and copies the data
7
+ return new Uint8Array(value);
9
8
  }
@@ -293,7 +293,20 @@ function encodeBackward(
293
293
  }
294
294
  }
295
295
 
296
+ function getCharIndex(input: string, offset: number) {
297
+ const charCode = input.charCodeAt(offset);
298
+ const index = charToIndex[charCode];
299
+ if (index === undefined) {
300
+ throw new Error("Invalid Base64 character: " + input[offset]);
301
+ }
302
+ return index;
303
+ }
304
+
296
305
  export function decodeBase64(input: string): Uint8Array<ArrayBuffer> {
306
+ if (input.length % 4 !== 0) {
307
+ throw new Error("Invalid Base64 length: " + input.length);
308
+ }
309
+
297
310
  let padding: number;
298
311
  if (input[input.length - 2] === "=") {
299
312
  padding = 2;
@@ -307,17 +320,18 @@ export function decodeBase64(input: string): Uint8Array<ArrayBuffer> {
307
320
  let sIndex = 0;
308
321
  let dIndex = 0;
309
322
 
310
- while (sIndex < input.length - (padding !== 0 ? 4 : 0)) {
311
- const a = charToIndex[input.charCodeAt(sIndex)]!;
323
+ const loopEnd = input.length - (padding !== 0 ? 4 : 0);
324
+ while (sIndex < loopEnd) {
325
+ const a = getCharIndex(input, sIndex);
312
326
  sIndex += 1;
313
327
 
314
- const b = charToIndex[input.charCodeAt(sIndex)]!;
328
+ const b = getCharIndex(input, sIndex);
315
329
  sIndex += 1;
316
330
 
317
- const c = charToIndex[input.charCodeAt(sIndex)]!;
331
+ const c = getCharIndex(input, sIndex);
318
332
  sIndex += 1;
319
333
 
320
- const d = charToIndex[input.charCodeAt(sIndex)]!;
334
+ const d = getCharIndex(input, sIndex);
321
335
  sIndex += 1;
322
336
 
323
337
  result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
@@ -331,23 +345,23 @@ export function decodeBase64(input: string): Uint8Array<ArrayBuffer> {
331
345
  }
332
346
 
333
347
  if (padding === 1) {
334
- const a = charToIndex[input.charCodeAt(sIndex)]!;
348
+ const a = getCharIndex(input, sIndex);
335
349
  sIndex += 1;
336
350
 
337
- const b = charToIndex[input.charCodeAt(sIndex)]!;
351
+ const b = getCharIndex(input, sIndex);
338
352
  sIndex += 1;
339
353
 
340
- const c = charToIndex[input.charCodeAt(sIndex)]!;
354
+ const c = getCharIndex(input, sIndex);
341
355
 
342
356
  result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
343
357
  dIndex += 1;
344
358
 
345
359
  result[dIndex] = ((b & 0b1111) << 4) | ((c & 0b11_1100) >> 2);
346
360
  } else if (padding === 2) {
347
- const a = charToIndex[input.charCodeAt(sIndex)]!;
361
+ const a = getCharIndex(input, sIndex);
348
362
  sIndex += 1;
349
363
 
350
- const b = charToIndex[input.charCodeAt(sIndex)]!;
364
+ const b = getCharIndex(input, sIndex);
351
365
 
352
366
  result[dIndex] = (a << 2) | ((b & 0b11_0000) >> 4);
353
367
  }
@@ -3,6 +3,7 @@ export * from "./array-buffer.js";
3
3
  export * from "./auto-reset-event.js";
4
4
  export * from "./base64.js";
5
5
  export * from "./hex.js";
6
+ export * from "./md5.js";
6
7
  export * from "./no-op.js";
7
8
  export * from "./ref.js";
8
9
  export * from "./sequence-equal.js";
@@ -0,0 +1,185 @@
1
+ import {
2
+ getUint32LittleEndian,
3
+ setUint32LittleEndian,
4
+ setUint64LittleEndian,
5
+ } from "@yume-chan/no-data-view";
6
+
7
+ // Taken from https://github.com/digitalbazaar/forge/blob/e3c68e9695607702587583cda291d74e5369f21c/tests/unit/md5.js#L103
8
+ // LICENSE: https://github.com/digitalbazaar/forge/blob/2c37d0bd2864199409edbb520f674d1c93652b23/LICENSE
9
+
10
+ // g values
11
+ // prettier-ignore
12
+ const gs = [
13
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
14
+ 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12,
15
+ 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2,
16
+ 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9];
17
+
18
+ // rounds table
19
+ // prettier-ignore
20
+ const rs = [
21
+ 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
22
+ 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
23
+ 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
24
+ 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21];
25
+
26
+ const k = /* @__PURE__ */ (() => {
27
+ const k = new Uint32Array(64);
28
+ for (let i = 0; i < 64; i += 1) {
29
+ // get the result of abs(sin(i + 1)) as a 32-bit integer
30
+ k[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 0x100000000);
31
+ }
32
+ return k;
33
+ })();
34
+
35
+ export class Md5 {
36
+ #state = new Uint32Array([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);
37
+ #length = 0n;
38
+
39
+ #buffer = new Uint8Array(64);
40
+ #bufferLength = 0;
41
+
42
+ #w = new Uint32Array(16);
43
+
44
+ update(input: Uint8Array) {
45
+ this.#length += BigInt(input.length);
46
+
47
+ let offset = 0;
48
+
49
+ if (this.#bufferLength) {
50
+ const remaining = 64 - this.#bufferLength;
51
+ this.#buffer.set(input.subarray(0, remaining), this.#bufferLength);
52
+
53
+ if (input.length < remaining) {
54
+ this.#bufferLength += input.length;
55
+ return this;
56
+ }
57
+
58
+ this.#update(this.#buffer);
59
+ this.#bufferLength = 0;
60
+ offset = remaining;
61
+ }
62
+
63
+ const end = input.length - 64;
64
+ for (; offset <= end; offset += 64) {
65
+ this.#update(input, offset);
66
+ }
67
+
68
+ if (offset < input.length) {
69
+ this.#buffer.set(input.subarray(offset));
70
+ this.#bufferLength = input.length - offset;
71
+ }
72
+
73
+ return this;
74
+ }
75
+
76
+ #update(input: Uint8Array, offset = 0) {
77
+ let a = this.#state[0]!;
78
+ let b = this.#state[1]!;
79
+ let c = this.#state[2]!;
80
+ let d = this.#state[3]!;
81
+
82
+ let t: number;
83
+ let f: number;
84
+ let r: number;
85
+ let i = 0;
86
+
87
+ // round 1
88
+ for (; i < 16; i += 1) {
89
+ this.#w[i] = getUint32LittleEndian(input, offset + i * 4);
90
+ f = d ^ (b & (c ^ d));
91
+ t = a + f + k[i]! + this.#w[i]!;
92
+ r = rs[i]!;
93
+ a = d;
94
+ d = c;
95
+ c = b;
96
+ b += (t << r) | (t >>> (32 - r));
97
+ }
98
+
99
+ // round 2
100
+ for (; i < 32; i += 1) {
101
+ f = c ^ (d & (b ^ c));
102
+ t = a + f + k[i]! + this.#w[gs[i]!]!;
103
+ r = rs[i]!;
104
+ a = d;
105
+ d = c;
106
+ c = b;
107
+ b += (t << r) | (t >>> (32 - r));
108
+ }
109
+
110
+ // round 3
111
+ for (; i < 48; i += 1) {
112
+ f = b ^ c ^ d;
113
+ t = a + f + k[i]! + this.#w[gs[i]!]!;
114
+ r = rs[i]!;
115
+ a = d;
116
+ d = c;
117
+ c = b;
118
+ b += (t << r) | (t >>> (32 - r));
119
+ }
120
+
121
+ // round 4
122
+ for (; i < 64; i += 1) {
123
+ f = c ^ (b | ~d);
124
+ t = a + f + k[i]! + this.#w[gs[i]!]!;
125
+ r = rs[i]!;
126
+ a = d;
127
+ d = c;
128
+ c = b;
129
+ b += (t << r) | (t >>> (32 - r));
130
+ }
131
+
132
+ this.#state[0]! += a;
133
+ this.#state[1]! += b;
134
+ this.#state[2]! += c;
135
+ this.#state[3]! += d;
136
+ }
137
+
138
+ digest() {
139
+ this.#buffer[this.#bufferLength] = 0x80;
140
+ this.#buffer.subarray(this.#bufferLength + 1).fill(0);
141
+
142
+ if (64 - this.#bufferLength < 8) {
143
+ this.#update(this.#buffer);
144
+
145
+ this.#buffer.fill(0);
146
+ this.#bufferLength = 0;
147
+ }
148
+
149
+ setUint64LittleEndian(
150
+ this.#buffer,
151
+ this.#buffer.length - 8,
152
+ this.#length << 3n,
153
+ );
154
+ this.#update(this.#buffer);
155
+
156
+ const result = new Uint8Array(16);
157
+ setUint32LittleEndian(result, 0, this.#state[0]!);
158
+ setUint32LittleEndian(result, 4, this.#state[1]!);
159
+ setUint32LittleEndian(result, 8, this.#state[2]!);
160
+ setUint32LittleEndian(result, 12, this.#state[3]!);
161
+ return result;
162
+ }
163
+
164
+ reset() {
165
+ this.#state[0] = 0x67452301;
166
+ this.#state[1] = 0xefcdab89;
167
+ this.#state[2] = 0x98badcfe;
168
+ this.#state[3] = 0x10325476;
169
+ this.#bufferLength = 0;
170
+ this.#length = 0n;
171
+ return this;
172
+ }
173
+ }
174
+
175
+ let instance: Md5 | undefined;
176
+
177
+ export function md5Digest(input: Uint8Array) {
178
+ if (!instance) {
179
+ instance = new Md5();
180
+ }
181
+
182
+ const result = instance.update(input).digest();
183
+ instance.reset();
184
+ return result;
185
+ }
Binary file