@attocash/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +707 -0
  3. package/dist/application/app.d.ts +138 -0
  4. package/dist/application/app.js +654 -0
  5. package/dist/application/operations.d.ts +9 -0
  6. package/dist/application/operations.js +96 -0
  7. package/dist/cli/cli.d.ts +1 -0
  8. package/dist/cli/cli.js +460 -0
  9. package/dist/cli/help.d.ts +4 -0
  10. package/dist/cli/help.js +49 -0
  11. package/dist/cli/main.d.ts +2 -0
  12. package/dist/cli/main.js +13 -0
  13. package/dist/cli/onboarding.d.ts +14 -0
  14. package/dist/cli/onboarding.js +144 -0
  15. package/dist/cli/output.d.ts +2 -0
  16. package/dist/cli/output.js +231 -0
  17. package/dist/cli/terminal.d.ts +6 -0
  18. package/dist/cli/terminal.js +92 -0
  19. package/dist/cli/update-check.d.ts +1 -0
  20. package/dist/cli/update-check.js +12 -0
  21. package/dist/cli/updates.d.ts +2 -0
  22. package/dist/cli/updates.js +98 -0
  23. package/dist/core.d.ts +14 -0
  24. package/dist/core.js +14 -0
  25. package/dist/doctor/credential-probe.d.ts +7 -0
  26. package/dist/doctor/credential-probe.js +49 -0
  27. package/dist/doctor/doctor.d.ts +4 -0
  28. package/dist/doctor/doctor.js +213 -0
  29. package/dist/doctor/keyring.d.ts +7 -0
  30. package/dist/doctor/keyring.js +150 -0
  31. package/dist/doctor/profile.d.ts +19 -0
  32. package/dist/doctor/profile.js +73 -0
  33. package/dist/doctor/types.d.ts +40 -0
  34. package/dist/doctor/types.js +1 -0
  35. package/dist/domain/amount.d.ts +6 -0
  36. package/dist/domain/amount.js +27 -0
  37. package/dist/domain/errors.d.ts +10 -0
  38. package/dist/domain/errors.js +16 -0
  39. package/dist/labels/directory.d.ts +87 -0
  40. package/dist/labels/directory.js +140 -0
  41. package/dist/labels/personal.d.ts +17 -0
  42. package/dist/labels/personal.js +56 -0
  43. package/dist/labels/presentation.d.ts +154 -0
  44. package/dist/labels/presentation.js +90 -0
  45. package/dist/network/reader.d.ts +31 -0
  46. package/dist/network/reader.js +370 -0
  47. package/dist/network/retry.d.ts +7 -0
  48. package/dist/network/retry.js +53 -0
  49. package/dist/network/work.d.ts +3 -0
  50. package/dist/network/work.js +66 -0
  51. package/dist/pricing/market.d.ts +29 -0
  52. package/dist/pricing/market.js +150 -0
  53. package/dist/pricing/terms.d.ts +6 -0
  54. package/dist/pricing/terms.js +12 -0
  55. package/dist/spending/destination.d.ts +16 -0
  56. package/dist/spending/destination.js +42 -0
  57. package/dist/spending/journal.d.ts +28 -0
  58. package/dist/spending/journal.js +69 -0
  59. package/dist/spending/ledger.d.ts +118 -0
  60. package/dist/spending/ledger.js +444 -0
  61. package/dist/spending/payments.d.ts +67 -0
  62. package/dist/spending/payments.js +424 -0
  63. package/dist/spending/pool.d.ts +13 -0
  64. package/dist/spending/pool.js +38 -0
  65. package/dist/spending/reconcile.d.ts +18 -0
  66. package/dist/spending/reconcile.js +64 -0
  67. package/dist/storage/profiles.d.ts +13 -0
  68. package/dist/storage/profiles.js +86 -0
  69. package/dist/storage/secrets.d.ts +16 -0
  70. package/dist/storage/secrets.js +104 -0
  71. package/dist/storage/state.d.ts +32 -0
  72. package/dist/storage/state.js +255 -0
  73. package/dist/wallet/auto-receive.d.ts +57 -0
  74. package/dist/wallet/auto-receive.js +140 -0
  75. package/dist/wallet/defaults.d.ts +3 -0
  76. package/dist/wallet/defaults.js +26 -0
  77. package/dist/wallet/signing.d.ts +17 -0
  78. package/dist/wallet/signing.js +128 -0
  79. package/dist/wallet/types.d.ts +65 -0
  80. package/dist/wallet/types.js +1 -0
  81. package/dist/wallet/work.d.ts +29 -0
  82. package/dist/wallet/work.js +154 -0
  83. package/dist/watches/manager.d.ts +75 -0
  84. package/dist/watches/manager.js +197 -0
  85. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +6678 -0
  86. package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -0
  87. package/node_modules/@attocash/commons-core/LICENSE +28 -0
  88. package/node_modules/@attocash/commons-core/README.md +118 -0
  89. package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +1036 -0
  90. package/node_modules/@attocash/commons-core/commons-commons-core.mjs +7701 -0
  91. package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -0
  92. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +17681 -0
  93. package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -0
  94. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs +4 -0
  95. package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -0
  96. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +209 -0
  97. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -0
  98. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +2284 -0
  99. package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -0
  100. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +6042 -0
  101. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -0
  102. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  103. package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  104. package/node_modules/@attocash/commons-core/package.json +27 -0
  105. package/node_modules/@attocash/commons-node/LICENSE +28 -0
  106. package/node_modules/@attocash/commons-node/README.md +92 -0
  107. package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +255 -0
  108. package/node_modules/@attocash/commons-node/commons-commons-node.mjs +2977 -0
  109. package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -0
  110. package/node_modules/@attocash/commons-node/kotlin-logging.mjs +432 -0
  111. package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -0
  112. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  113. package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  114. package/node_modules/@attocash/commons-node/package.json +29 -0
  115. package/node_modules/@attocash/commons-node-remote/LICENSE +28 -0
  116. package/node_modules/@attocash/commons-node-remote/README.md +61 -0
  117. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +122 -0
  118. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +1810 -0
  119. package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -0
  120. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +432 -0
  121. package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -0
  122. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs +8 -0
  123. package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -0
  124. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  125. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  126. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  127. package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  128. package/node_modules/@attocash/commons-node-remote/package.json +31 -0
  129. package/node_modules/@attocash/commons-transport/LICENSE +28 -0
  130. package/node_modules/@attocash/commons-transport/README.md +5 -0
  131. package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +64 -0
  132. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +249 -0
  133. package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -0
  134. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +263 -0
  135. package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -0
  136. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs +8 -0
  137. package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -0
  138. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +11604 -0
  139. package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -0
  140. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  141. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  142. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  143. package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  144. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +499 -0
  145. package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -0
  146. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +6456 -0
  147. package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -0
  148. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +83 -0
  149. package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -0
  150. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +1714 -0
  151. package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -0
  152. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +3197 -0
  153. package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -0
  154. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +2290 -0
  155. package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -0
  156. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +46 -0
  157. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -0
  158. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +482 -0
  159. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -0
  160. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +165 -0
  161. package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -0
  162. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs +4 -0
  163. package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -0
  164. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +3222 -0
  165. package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -0
  166. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs +4 -0
  167. package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -0
  168. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +1485 -0
  169. package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -0
  170. package/node_modules/@attocash/commons-transport/package.json +29 -0
  171. package/node_modules/@attocash/commons-worker/LICENSE +28 -0
  172. package/node_modules/@attocash/commons-worker/README.md +48 -0
  173. package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +73 -0
  174. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +702 -0
  175. package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -0
  176. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +432 -0
  177. package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -0
  178. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  179. package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  180. package/node_modules/@attocash/commons-worker/package.json +29 -0
  181. package/node_modules/@attocash/commons-worker-remote/LICENSE +28 -0
  182. package/node_modules/@attocash/commons-worker-remote/README.md +60 -0
  183. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +93 -0
  184. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +289 -0
  185. package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -0
  186. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +432 -0
  187. package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -0
  188. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs +8 -0
  189. package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -0
  190. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  191. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  192. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
  193. package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  194. package/node_modules/@attocash/commons-worker-remote/package.json +31 -0
  195. package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
  196. package/node_modules/@js-joda/core/CheatSheet.md +947 -0
  197. package/node_modules/@js-joda/core/LICENSE +34 -0
  198. package/node_modules/@js-joda/core/README.md +155 -0
  199. package/node_modules/@js-joda/core/bower.json +21 -0
  200. package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
  201. package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
  202. package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
  203. package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
  204. package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
  205. package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
  206. package/node_modules/@js-joda/core/package.json +76 -0
  207. package/node_modules/@js-joda/core/src/Clock.js +330 -0
  208. package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
  209. package/node_modules/@js-joda/core/src/Duration.js +1205 -0
  210. package/node_modules/@js-joda/core/src/Enum.js +30 -0
  211. package/node_modules/@js-joda/core/src/Instant.js +1012 -0
  212. package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
  213. package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
  214. package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
  215. package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
  216. package/node_modules/@js-joda/core/src/Month.js +600 -0
  217. package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
  218. package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
  219. package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
  220. package/node_modules/@js-joda/core/src/Period.js +933 -0
  221. package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
  222. package/node_modules/@js-joda/core/src/Year.js +1015 -0
  223. package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
  224. package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
  225. package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
  226. package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
  227. package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
  228. package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
  229. package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
  230. package/node_modules/@js-joda/core/src/_init.js +68 -0
  231. package/node_modules/@js-joda/core/src/assert.js +33 -0
  232. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
  233. package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
  234. package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
  235. package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
  236. package/node_modules/@js-joda/core/src/convert.js +83 -0
  237. package/node_modules/@js-joda/core/src/errors.js +54 -0
  238. package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
  239. package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
  240. package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
  241. package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
  242. package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
  243. package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
  244. package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
  245. package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
  246. package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
  247. package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
  248. package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
  249. package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
  250. package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
  251. package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
  252. package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
  253. package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
  254. package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
  255. package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
  256. package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
  257. package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
  258. package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
  259. package/node_modules/@js-joda/core/src/js-joda.js +210 -0
  260. package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
  261. package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
  262. package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
  263. package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
  264. package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
  265. package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
  266. package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
  267. package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
  268. package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
  269. package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
  270. package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
  271. package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
  272. package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
  273. package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
  274. package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
  275. package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
  276. package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
  277. package/node_modules/@js-joda/core/src/use.js +20 -0
  278. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
  279. package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
  280. package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
  281. package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
  282. package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
  283. package/node_modules/@noble/hashes/LICENSE +21 -0
  284. package/node_modules/@noble/hashes/README.md +563 -0
  285. package/node_modules/@noble/hashes/_blake.d.ts +21 -0
  286. package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
  287. package/node_modules/@noble/hashes/_blake.js +52 -0
  288. package/node_modules/@noble/hashes/_blake.js.map +1 -0
  289. package/node_modules/@noble/hashes/_md.d.ts +99 -0
  290. package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
  291. package/node_modules/@noble/hashes/_md.js +202 -0
  292. package/node_modules/@noble/hashes/_md.js.map +1 -0
  293. package/node_modules/@noble/hashes/_u64.d.ts +63 -0
  294. package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
  295. package/node_modules/@noble/hashes/_u64.js +84 -0
  296. package/node_modules/@noble/hashes/_u64.js.map +1 -0
  297. package/node_modules/@noble/hashes/argon2.d.ts +112 -0
  298. package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
  299. package/node_modules/@noble/hashes/argon2.js +517 -0
  300. package/node_modules/@noble/hashes/argon2.js.map +1 -0
  301. package/node_modules/@noble/hashes/blake1.d.ts +156 -0
  302. package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
  303. package/node_modules/@noble/hashes/blake1.js +560 -0
  304. package/node_modules/@noble/hashes/blake1.js.map +1 -0
  305. package/node_modules/@noble/hashes/blake2.d.ts +184 -0
  306. package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
  307. package/node_modules/@noble/hashes/blake2.js +501 -0
  308. package/node_modules/@noble/hashes/blake2.js.map +1 -0
  309. package/node_modules/@noble/hashes/blake3.d.ts +68 -0
  310. package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
  311. package/node_modules/@noble/hashes/blake3.js +284 -0
  312. package/node_modules/@noble/hashes/blake3.js.map +1 -0
  313. package/node_modules/@noble/hashes/eskdf.d.ts +92 -0
  314. package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
  315. package/node_modules/@noble/hashes/eskdf.js +218 -0
  316. package/node_modules/@noble/hashes/eskdf.js.map +1 -0
  317. package/node_modules/@noble/hashes/hkdf.d.ts +64 -0
  318. package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
  319. package/node_modules/@noble/hashes/hkdf.js +120 -0
  320. package/node_modules/@noble/hashes/hkdf.js.map +1 -0
  321. package/node_modules/@noble/hashes/hmac.d.ts +47 -0
  322. package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
  323. package/node_modules/@noble/hashes/hmac.js +93 -0
  324. package/node_modules/@noble/hashes/hmac.js.map +1 -0
  325. package/node_modules/@noble/hashes/index.d.ts +2 -0
  326. package/node_modules/@noble/hashes/index.d.ts.map +1 -0
  327. package/node_modules/@noble/hashes/index.js +35 -0
  328. package/node_modules/@noble/hashes/index.js.map +1 -0
  329. package/node_modules/@noble/hashes/legacy.d.ts +102 -0
  330. package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
  331. package/node_modules/@noble/hashes/legacy.js +327 -0
  332. package/node_modules/@noble/hashes/legacy.js.map +1 -0
  333. package/node_modules/@noble/hashes/package.json +97 -0
  334. package/node_modules/@noble/hashes/pbkdf2.d.ts +56 -0
  335. package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
  336. package/node_modules/@noble/hashes/pbkdf2.js +135 -0
  337. package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
  338. package/node_modules/@noble/hashes/scrypt.d.ts +65 -0
  339. package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
  340. package/node_modules/@noble/hashes/scrypt.js +257 -0
  341. package/node_modules/@noble/hashes/scrypt.js.map +1 -0
  342. package/node_modules/@noble/hashes/sha2.d.ts +249 -0
  343. package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
  344. package/node_modules/@noble/hashes/sha2.js +458 -0
  345. package/node_modules/@noble/hashes/sha2.js.map +1 -0
  346. package/node_modules/@noble/hashes/sha3-addons.d.ts +461 -0
  347. package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
  348. package/node_modules/@noble/hashes/sha3-addons.js +783 -0
  349. package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
  350. package/node_modules/@noble/hashes/sha3.d.ts +199 -0
  351. package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
  352. package/node_modules/@noble/hashes/sha3.js +431 -0
  353. package/node_modules/@noble/hashes/sha3.js.map +1 -0
  354. package/node_modules/@noble/hashes/src/_blake.ts +57 -0
  355. package/node_modules/@noble/hashes/src/_md.ts +222 -0
  356. package/node_modules/@noble/hashes/src/_u64.ts +117 -0
  357. package/node_modules/@noble/hashes/src/argon2.ts +667 -0
  358. package/node_modules/@noble/hashes/src/blake1.ts +614 -0
  359. package/node_modules/@noble/hashes/src/blake2.ts +582 -0
  360. package/node_modules/@noble/hashes/src/blake3.ts +317 -0
  361. package/node_modules/@noble/hashes/src/eskdf.ts +259 -0
  362. package/node_modules/@noble/hashes/src/hkdf.ts +133 -0
  363. package/node_modules/@noble/hashes/src/hmac.ts +126 -0
  364. package/node_modules/@noble/hashes/src/index.ts +33 -0
  365. package/node_modules/@noble/hashes/src/legacy.ts +339 -0
  366. package/node_modules/@noble/hashes/src/pbkdf2.ts +175 -0
  367. package/node_modules/@noble/hashes/src/scrypt.ts +315 -0
  368. package/node_modules/@noble/hashes/src/sha2.ts +530 -0
  369. package/node_modules/@noble/hashes/src/sha3-addons.ts +983 -0
  370. package/node_modules/@noble/hashes/src/sha3.ts +485 -0
  371. package/node_modules/@noble/hashes/src/utils.ts +848 -0
  372. package/node_modules/@noble/hashes/src/webcrypto.ts +239 -0
  373. package/node_modules/@noble/hashes/utils.d.ts +519 -0
  374. package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
  375. package/node_modules/@noble/hashes/utils.js +578 -0
  376. package/node_modules/@noble/hashes/utils.js.map +1 -0
  377. package/node_modules/@noble/hashes/webcrypto.d.ts +120 -0
  378. package/node_modules/@noble/hashes/webcrypto.d.ts.map +1 -0
  379. package/node_modules/@noble/hashes/webcrypto.js +165 -0
  380. package/node_modules/@noble/hashes/webcrypto.js.map +1 -0
  381. package/node_modules/ws/LICENSE +20 -0
  382. package/node_modules/ws/README.md +548 -0
  383. package/node_modules/ws/browser.js +8 -0
  384. package/node_modules/ws/index.js +22 -0
  385. package/node_modules/ws/lib/buffer-util.js +131 -0
  386. package/node_modules/ws/lib/constants.js +19 -0
  387. package/node_modules/ws/lib/event-target.js +292 -0
  388. package/node_modules/ws/lib/extension.js +203 -0
  389. package/node_modules/ws/lib/limiter.js +55 -0
  390. package/node_modules/ws/lib/permessage-deflate.js +530 -0
  391. package/node_modules/ws/lib/receiver.js +743 -0
  392. package/node_modules/ws/lib/sender.js +607 -0
  393. package/node_modules/ws/lib/stream.js +161 -0
  394. package/node_modules/ws/lib/subprotocol.js +62 -0
  395. package/node_modules/ws/lib/validation.js +152 -0
  396. package/node_modules/ws/lib/websocket-server.js +562 -0
  397. package/node_modules/ws/lib/websocket.js +1407 -0
  398. package/node_modules/ws/package.json +74 -0
  399. package/node_modules/ws/wrapper.mjs +21 -0
  400. package/package.json +53 -0
@@ -0,0 +1,614 @@
1
+ /**
2
+ * Blake1 legacy hash function, one of SHA3 proposals.
3
+ * Rarely used. Check out blake2 or blake3 instead.
4
+ * {@link https://www.aumasson.jp/blake/blake.pdf}
5
+ *
6
+ * In the best case, there are 0 allocations.
7
+ *
8
+ * Differences from blake2:
9
+ *
10
+ * - BE instead of LE
11
+ * - Paddings, similar to MD5, RIPEMD, SHA1, SHA2, but:
12
+ * - length flag is located before actual length
13
+ * - padding block is compressed differently (no lengths)
14
+ * Instead of msg[sigma[k]], we have `msg[sigma[k]] ^ constants[sigma[k-1]]`
15
+ * (-1 for g1, g2 without -1)
16
+ * - Salt is XOR-ed into constants instead of state
17
+ * - Salt is XOR-ed with output in `compress`
18
+ * - Additional rows (+64 bytes) in SIGMA for new rounds
19
+ * - Different round count:
20
+ * - 14 / 10 rounds in blake256 / blake2s
21
+ * - 16 / 12 rounds in blake512 / blake2b
22
+ * - blake512: G1b: rotr 24 -> 25, G2b: rotr 63 -> 11
23
+ * @module
24
+ */
25
+ import { BSIGMA, G1s, G2s } from './_blake.ts';
26
+ import { SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';
27
+ import * as u64 from './_u64.ts';
28
+ // prettier-ignore
29
+ import {
30
+ abytes, aexists, aoutput,
31
+ clean, createHasher,
32
+ createView,
33
+ type CHash,
34
+ type Hash,
35
+ type TArg,
36
+ type TRet
37
+ } from './utils.ts';
38
+
39
+ /** Blake1 options. Basically just `salt`. */
40
+ export type BlakeOpts = {
41
+ /** Optional salt mixed into initialization. */
42
+ salt?: Uint8Array;
43
+ };
44
+
45
+ // Shared unsalted sentinel, sized for the 64-bit path and reused by the 32-bit path via prefix.
46
+ const EMPTY_SALT = /* @__PURE__ */ new Uint32Array(8);
47
+
48
+ // Base destroy logic only clears salt-derived state; the partial message buffer and length/position
49
+ // bookkeeping remain until the instance or backing buffer is reused.
50
+ abstract class BLAKE1<T extends BLAKE1<T>> implements Hash<T> {
51
+ readonly canXOF = false;
52
+ protected finished = false;
53
+ protected length = 0;
54
+ protected pos = 0;
55
+ protected destroyed = false;
56
+ // For partial updates less than block size
57
+ protected buffer: Uint8Array;
58
+ protected view: DataView;
59
+ protected salt: Uint32Array;
60
+ abstract compress(view: DataView, offset: number, withLength?: boolean): void;
61
+ protected abstract get(): number[];
62
+ protected abstract set(...args: number[]): void;
63
+
64
+ readonly blockLen: number;
65
+ readonly outputLen: number;
66
+ private lengthFlag: number;
67
+ private counterLen: number;
68
+ protected constants: Uint32Array;
69
+
70
+ constructor(
71
+ blockLen: number,
72
+ outputLen: number,
73
+ lengthFlag: number,
74
+ counterLen: number,
75
+ saltLen: number,
76
+ constants: Uint32Array,
77
+ opts: BlakeOpts = {}
78
+ ) {
79
+ const { salt } = opts;
80
+ this.blockLen = blockLen;
81
+ this.outputLen = outputLen;
82
+ this.lengthFlag = lengthFlag;
83
+ this.counterLen = counterLen;
84
+ this.buffer = new Uint8Array(blockLen);
85
+ this.view = createView(this.buffer);
86
+ if (salt !== undefined) {
87
+ let slt = salt;
88
+ abytes(slt, 4 * saltLen, 'salt');
89
+ // if (slt.length !== 4 * saltLen) throw new Error('wrong salt length');
90
+ const salt32 = (this.salt = new Uint32Array(saltLen));
91
+ const sv = createView(slt);
92
+ this.constants = constants.slice();
93
+ for (let i = 0, offset = 0; i < salt32.length; i++, offset += 4) {
94
+ salt32[i] = sv.getUint32(offset, false);
95
+ this.constants[i] ^= salt32[i];
96
+ }
97
+ } else {
98
+ this.salt = EMPTY_SALT;
99
+ this.constants = constants;
100
+ }
101
+ }
102
+ update(data: TArg<Uint8Array>): this {
103
+ aexists(this);
104
+ abytes(data);
105
+ // From _md, but update length before each compress
106
+ const { view, buffer, blockLen } = this;
107
+ const len = data.length;
108
+ let dataView;
109
+ for (let pos = 0; pos < len; ) {
110
+ const take = Math.min(blockLen - this.pos, len - pos);
111
+ // Fast path only when there is no buffered partial block: `take === blockLen` implies
112
+ // `this.pos === 0`, so we can process full blocks directly from the input view.
113
+ if (take === blockLen) {
114
+ if (!dataView) dataView = createView(data);
115
+ for (; blockLen <= len - pos; pos += blockLen) {
116
+ this.length += blockLen;
117
+ this.compress(dataView, pos);
118
+ }
119
+ continue;
120
+ }
121
+ buffer.set(data.subarray(pos, pos + take), this.pos);
122
+ this.pos += take;
123
+ pos += take;
124
+ if (this.pos === blockLen) {
125
+ this.length += blockLen;
126
+ this.compress(view, 0, true);
127
+ this.pos = 0;
128
+ }
129
+ }
130
+ return this;
131
+ }
132
+ destroy(): void {
133
+ this.destroyed = true;
134
+ if (this.salt !== EMPTY_SALT) {
135
+ clean(this.salt, this.constants);
136
+ }
137
+ }
138
+ _cloneInto(to?: T): T {
139
+ to ||= new (this.constructor as any)() as T;
140
+ to.set(...this.get());
141
+ const { buffer, length, finished, destroyed, constants, salt, pos } = this;
142
+ to.buffer.set(buffer);
143
+ // Clone salt-derived arrays by value so destroying the clone cannot wipe the source instance.
144
+ to.constants = constants.slice();
145
+ to.destroyed = destroyed;
146
+ to.finished = finished;
147
+ to.length = length;
148
+ to.pos = pos;
149
+ to.salt = salt.slice();
150
+ return to;
151
+ }
152
+ clone(): T {
153
+ return this._cloneInto();
154
+ }
155
+ digestInto(out: TArg<Uint8Array>): void {
156
+ aexists(this);
157
+ aoutput(out, this);
158
+ this.finished = true;
159
+ // Padding
160
+ const { buffer, blockLen, counterLen, lengthFlag, view } = this;
161
+ clean(buffer.subarray(this.pos)); // clean buf
162
+ const counter = BigInt((this.length + this.pos) * 8);
163
+ const counterPos = blockLen - counterLen - 1;
164
+ buffer[this.pos] |= 0b1000_0000; // End block flag
165
+ this.length += this.pos; // add unwritten length
166
+ // Not enough in buffer for length: write what we have.
167
+ if (this.pos > counterPos) {
168
+ this.compress(view, 0);
169
+ clean(buffer);
170
+ this.pos = 0;
171
+ }
172
+ // Difference with md: here we have lengthFlag!
173
+ buffer[counterPos] |= lengthFlag; // Length flag
174
+ // We always set 8 byte length flag. Because length will overflow significantly sooner.
175
+ view.setBigUint64(blockLen - 8, counter, false);
176
+ // Blake1 omits the counter from the extra all-padding block; only the block that still carries
177
+ // message bytes mixes in the final bit length.
178
+ this.compress(view, 0, this.pos !== 0);
179
+ // Write output
180
+ clean(buffer);
181
+ const v = createView(out);
182
+ const state = this.get();
183
+ for (let i = 0; i < this.outputLen / 4; ++i) v.setUint32(i * 4, state[i]);
184
+ }
185
+ digest(): TRet<Uint8Array> {
186
+ const { buffer, outputLen } = this;
187
+ this.digestInto(buffer);
188
+ // Return a copy so callers do not alias the instance scratch buffer used during finalization.
189
+ const res = buffer.slice(0, outputLen);
190
+ this.destroy();
191
+ return res as TRet<Uint8Array>;
192
+ }
193
+ }
194
+
195
+ // Blake1-512 / Blake1-384 constant table `C512`.
196
+ // Stored as sixteen 64-bit constants split into `[high32, low32]` halves so
197
+ // the Blake1-64 path can reuse one layout for both `v8..v15` initialization
198
+ // and the permuted constant lookups.
199
+ const B64C = /* @__PURE__ */ Uint32Array.from([
200
+ 0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
201
+ 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
202
+ 0x9216d5d9, 0x8979fb1b, 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96,
203
+ 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16, 0x636920d8, 0x71574e69,
204
+ ]);
205
+ // Blake1-256 / Blake1-224 constant table `C256`, derived as the first half of `C512`.
206
+ const B32C = /* @__PURE__ */ B64C.slice(0, 16);
207
+
208
+ // Blake1-256 IV cloned from SHA-256.
209
+ const B256_IV = /* @__PURE__ */ SHA256_IV.slice();
210
+ // Blake1-224 IV cloned from SHA-224.
211
+ const B224_IV = /* @__PURE__ */ SHA224_IV.slice();
212
+ // Blake1-384 IV cloned from the SHA-384 high-then-low 32-bit halves.
213
+ const B384_IV = /* @__PURE__ */ SHA384_IV.slice();
214
+ // Blake1-512 IV cloned from the SHA-512 high-then-low 32-bit halves.
215
+ const B512_IV = /* @__PURE__ */ SHA512_IV.slice();
216
+
217
+ // Precompute the odd/even companion constants used by all 14 Blake1-32 rounds.
218
+ // Each pair stores `u[sigma[2i + 1]]` then `u[sigma[2i]]`, matching the `G1s` / `G2s` xor order.
219
+ function generateTBL256() {
220
+ const TBL = [];
221
+ for (let i = 0, j = 0; i < 14; i++, j += 16) {
222
+ for (let offset = 1; offset < 16; offset += 2) {
223
+ TBL.push(B32C[BSIGMA[j + offset]]);
224
+ TBL.push(B32C[BSIGMA[j + offset - 1]]);
225
+ }
226
+ }
227
+ return new Uint32Array(TBL);
228
+ }
229
+ // Full 14-round companion-constant table for Blake1-32.
230
+ const TBL256 = /* @__PURE__ */ generateTBL256();
231
+
232
+ // Shared synchronous message-word scratch for the 32-bit Blake1 path.
233
+ const BLAKE256_W = /* @__PURE__ */ new Uint32Array(16);
234
+
235
+ class BLAKE1_32B extends BLAKE1<BLAKE1_32B> {
236
+ private v0: number;
237
+ private v1: number;
238
+ private v2: number;
239
+ private v3: number;
240
+ private v4: number;
241
+ private v5: number;
242
+ private v6: number;
243
+ private v7: number;
244
+ constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts: BlakeOpts = {}) {
245
+ super(64, outputLen, lengthFlag, 8, 4, B32C, opts);
246
+ this.v0 = IV[0] | 0;
247
+ this.v1 = IV[1] | 0;
248
+ this.v2 = IV[2] | 0;
249
+ this.v3 = IV[3] | 0;
250
+ this.v4 = IV[4] | 0;
251
+ this.v5 = IV[5] | 0;
252
+ this.v6 = IV[6] | 0;
253
+ this.v7 = IV[7] | 0;
254
+ }
255
+ protected get(): [number, number, number, number, number, number, number, number] {
256
+ const { v0, v1, v2, v3, v4, v5, v6, v7 } = this;
257
+ return [v0, v1, v2, v3, v4, v5, v6, v7];
258
+ }
259
+ // prettier-ignore
260
+ protected set(
261
+ v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number
262
+ ): void {
263
+ this.v0 = v0 | 0;
264
+ this.v1 = v1 | 0;
265
+ this.v2 = v2 | 0;
266
+ this.v3 = v3 | 0;
267
+ this.v4 = v4 | 0;
268
+ this.v5 = v5 | 0;
269
+ this.v6 = v6 | 0;
270
+ this.v7 = v7 | 0;
271
+ }
272
+ destroy(): void {
273
+ super.destroy();
274
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
275
+ }
276
+ compress(view: DataView, offset: number, withLength = true): void {
277
+ for (let i = 0; i < 16; i++, offset += 4) BLAKE256_W[i] = view.getUint32(offset, false);
278
+ // Cannot reuse blake2s compress: Blake1 mixes each message word with the companion constants
279
+ // precomputed in `TBL256`, rather than using the raw schedule words directly.
280
+ let v00 = this.v0 | 0;
281
+ let v01 = this.v1 | 0;
282
+ let v02 = this.v2 | 0;
283
+ let v03 = this.v3 | 0;
284
+ let v04 = this.v4 | 0;
285
+ let v05 = this.v5 | 0;
286
+ let v06 = this.v6 | 0;
287
+ let v07 = this.v7 | 0;
288
+ let v08 = this.constants[0] | 0;
289
+ let v09 = this.constants[1] | 0;
290
+ let v10 = this.constants[2] | 0;
291
+ let v11 = this.constants[3] | 0;
292
+ // Blake1-32 injects the 64-bit bit counter as `[t0, t0, t1, t1]` across `v12..v15`; the
293
+ // final all-padding block passes `withLength = false`, leaving these lanes as raw constants.
294
+ const { h, l } = u64.fromBig(BigInt(withLength ? this.length * 8 : 0));
295
+ let v12 = (this.constants[4] ^ l) >>> 0;
296
+ let v13 = (this.constants[5] ^ l) >>> 0;
297
+ let v14 = (this.constants[6] ^ h) >>> 0;
298
+ let v15 = (this.constants[7] ^ h) >>> 0;
299
+ // prettier-ignore
300
+ for (let i = 0, k = 0, j = 0; i < 14; i++) {
301
+ ({ a: v00, b: v04, c: v08, d: v12 } = G1s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
302
+ ({ a: v00, b: v04, c: v08, d: v12 } = G2s(v00, v04, v08, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
303
+ ({ a: v01, b: v05, c: v09, d: v13 } = G1s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
304
+ ({ a: v01, b: v05, c: v09, d: v13 } = G2s(v01, v05, v09, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
305
+ ({ a: v02, b: v06, c: v10, d: v14 } = G1s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
306
+ ({ a: v02, b: v06, c: v10, d: v14 } = G2s(v02, v06, v10, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
307
+ ({ a: v03, b: v07, c: v11, d: v15 } = G1s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
308
+ ({ a: v03, b: v07, c: v11, d: v15 } = G2s(v03, v07, v11, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
309
+ ({ a: v00, b: v05, c: v10, d: v15 } = G1s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
310
+ ({ a: v00, b: v05, c: v10, d: v15 } = G2s(v00, v05, v10, v15, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
311
+ ({ a: v01, b: v06, c: v11, d: v12 } = G1s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
312
+ ({ a: v01, b: v06, c: v11, d: v12 } = G2s(v01, v06, v11, v12, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
313
+ ({ a: v02, b: v07, c: v08, d: v13 } = G1s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
314
+ ({ a: v02, b: v07, c: v08, d: v13 } = G2s(v02, v07, v08, v13, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
315
+ ({ a: v03, b: v04, c: v09, d: v14 } = G1s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
316
+ ({ a: v03, b: v04, c: v09, d: v14 } = G2s(v03, v04, v09, v14, BLAKE256_W[BSIGMA[k++]] ^ TBL256[j++]));
317
+ }
318
+ this.v0 = (this.v0 ^ v00 ^ v08 ^ this.salt[0]) >>> 0;
319
+ this.v1 = (this.v1 ^ v01 ^ v09 ^ this.salt[1]) >>> 0;
320
+ this.v2 = (this.v2 ^ v02 ^ v10 ^ this.salt[2]) >>> 0;
321
+ this.v3 = (this.v3 ^ v03 ^ v11 ^ this.salt[3]) >>> 0;
322
+ this.v4 = (this.v4 ^ v04 ^ v12 ^ this.salt[0]) >>> 0;
323
+ this.v5 = (this.v5 ^ v05 ^ v13 ^ this.salt[1]) >>> 0;
324
+ this.v6 = (this.v6 ^ v06 ^ v14 ^ this.salt[2]) >>> 0;
325
+ this.v7 = (this.v7 ^ v07 ^ v15 ^ this.salt[3]) >>> 0;
326
+ clean(BLAKE256_W);
327
+ }
328
+ }
329
+
330
+ // Shared Blake1-64 work vector storing 16 working words as adjacent high/low 32-bit halves.
331
+ const BBUF = /* @__PURE__ */ new Uint32Array(32);
332
+ // Shared synchronous message-word scratch for the 64-bit Blake1 path.
333
+ const BLAKE512_W = /* @__PURE__ */ new Uint32Array(32);
334
+
335
+ // Precompute the high/low companion constants used by all 16 Blake1-64 rounds.
336
+ // Each quartet stores `u[sigma[2i + 1]]` high/low halves, then `u[sigma[2i]]` high/low halves.
337
+ function generateTBL512() {
338
+ const TBL = [];
339
+ for (let r = 0, k = 0; r < 16; r++, k += 16) {
340
+ for (let offset = 1; offset < 16; offset += 2) {
341
+ TBL.push(B64C[BSIGMA[k + offset] * 2 + 0]);
342
+ TBL.push(B64C[BSIGMA[k + offset] * 2 + 1]);
343
+ TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 0]);
344
+ TBL.push(B64C[BSIGMA[k + offset - 1] * 2 + 1]);
345
+ }
346
+ }
347
+ return new Uint32Array(TBL);
348
+ }
349
+ // Full 16-round companion-constant table as high/low halves.
350
+ const TBL512 = /* @__PURE__ */ generateTBL512();
351
+
352
+ // Blake1-64 first half-round with rotations `32` and `25`; `k` is the half-call schedule index.
353
+ function G1b(a: number, b: number, c: number, d: number, msg: TArg<Uint32Array>, k: number) {
354
+ const Xpos = 2 * BSIGMA[k];
355
+ const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
356
+ let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
357
+ let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
358
+ let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
359
+ let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
360
+ // v[a] = (v[a] + v[b] + x) | 0;
361
+ let ll = u64.add3L(Al, Bl, Xl);
362
+ Ah = u64.add3H(ll, Ah, Bh, Xh) >>> 0;
363
+ Al = (ll | 0) >>> 0;
364
+ // v[d] = rotr(v[d] ^ v[a], 32)
365
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
366
+ ({ Dh, Dl } = { Dh: u64.rotr32H(Dh, Dl), Dl: u64.rotr32L(Dh, Dl) });
367
+ // v[c] = (v[c] + v[d]) | 0;
368
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
369
+ // v[b] = rotr(v[b] ^ v[c], 25)
370
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
371
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 25), Bl: u64.rotrSL(Bh, Bl, 25) });
372
+ ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah));
373
+ ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh));
374
+ ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch));
375
+ ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh));
376
+ }
377
+
378
+ // Blake1-64 second half-round with rotations `16` and `11`; `k` is the half-call schedule index.
379
+ function G2b(a: number, b: number, c: number, d: number, msg: TArg<Uint32Array>, k: number) {
380
+ const Xpos = 2 * BSIGMA[k];
381
+ const Xl = msg[Xpos + 1] ^ TBL512[k * 2 + 1], Xh = msg[Xpos] ^ TBL512[k * 2]; // prettier-ignore
382
+ let Al = BBUF[2 * a + 1], Ah = BBUF[2 * a]; // prettier-ignore
383
+ let Bl = BBUF[2 * b + 1], Bh = BBUF[2 * b]; // prettier-ignore
384
+ let Cl = BBUF[2 * c + 1], Ch = BBUF[2 * c]; // prettier-ignore
385
+ let Dl = BBUF[2 * d + 1], Dh = BBUF[2 * d]; // prettier-ignore
386
+ // v[a] = (v[a] + v[b] + x) | 0;
387
+ let ll = u64.add3L(Al, Bl, Xl);
388
+ Ah = u64.add3H(ll, Ah, Bh, Xh);
389
+ Al = ll | 0;
390
+ // v[d] = rotr(v[d] ^ v[a], 16)
391
+ ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al });
392
+ ({ Dh, Dl } = { Dh: u64.rotrSH(Dh, Dl, 16), Dl: u64.rotrSL(Dh, Dl, 16) });
393
+ // v[c] = (v[c] + v[d]) | 0;
394
+ ({ h: Ch, l: Cl } = u64.add(Ch, Cl, Dh, Dl));
395
+ // v[b] = rotr(v[b] ^ v[c], 11)
396
+ ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl });
397
+ ({ Bh, Bl } = { Bh: u64.rotrSH(Bh, Bl, 11), Bl: u64.rotrSL(Bh, Bl, 11) });
398
+ ((BBUF[2 * a + 1] = Al), (BBUF[2 * a] = Ah));
399
+ ((BBUF[2 * b + 1] = Bl), (BBUF[2 * b] = Bh));
400
+ ((BBUF[2 * c + 1] = Cl), (BBUF[2 * c] = Ch));
401
+ ((BBUF[2 * d + 1] = Dl), (BBUF[2 * d] = Dh));
402
+ }
403
+
404
+ // Legacy field names keep the local `l/h` spelling, but array/state order stays `[high, low]` to
405
+ // match the IV tables and `BBUF` layout.
406
+ class BLAKE1_64B extends BLAKE1<BLAKE1_64B> {
407
+ private v0l: number;
408
+ private v0h: number;
409
+ private v1l: number;
410
+ private v1h: number;
411
+ private v2l: number;
412
+ private v2h: number;
413
+ private v3l: number;
414
+ private v3h: number;
415
+ private v4l: number;
416
+ private v4h: number;
417
+ private v5l: number;
418
+ private v5h: number;
419
+ private v6l: number;
420
+ private v6h: number;
421
+ private v7l: number;
422
+ private v7h: number;
423
+ constructor(outputLen: number, IV: Uint32Array, lengthFlag: number, opts: BlakeOpts = {}) {
424
+ super(128, outputLen, lengthFlag, 16, 8, B64C, opts);
425
+ this.v0l = IV[0] | 0;
426
+ this.v0h = IV[1] | 0;
427
+ this.v1l = IV[2] | 0;
428
+ this.v1h = IV[3] | 0;
429
+ this.v2l = IV[4] | 0;
430
+ this.v2h = IV[5] | 0;
431
+ this.v3l = IV[6] | 0;
432
+ this.v3h = IV[7] | 0;
433
+ this.v4l = IV[8] | 0;
434
+ this.v4h = IV[9] | 0;
435
+ this.v5l = IV[10] | 0;
436
+ this.v5h = IV[11] | 0;
437
+ this.v6l = IV[12] | 0;
438
+ this.v6h = IV[13] | 0;
439
+ this.v7l = IV[14] | 0;
440
+ this.v7h = IV[15] | 0;
441
+ }
442
+ // prettier-ignore
443
+ protected get(): [
444
+ number, number, number, number, number, number, number, number,
445
+ number, number, number, number, number, number, number, number
446
+ ] {
447
+ let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this;
448
+ return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h];
449
+ }
450
+ // prettier-ignore
451
+ protected set(
452
+ v0l: number, v0h: number, v1l: number, v1h: number,
453
+ v2l: number, v2h: number, v3l: number, v3h: number,
454
+ v4l: number, v4h: number, v5l: number, v5h: number,
455
+ v6l: number, v6h: number, v7l: number, v7h: number
456
+ ): void {
457
+ this.v0l = v0l | 0;
458
+ this.v0h = v0h | 0;
459
+ this.v1l = v1l | 0;
460
+ this.v1h = v1h | 0;
461
+ this.v2l = v2l | 0;
462
+ this.v2h = v2h | 0;
463
+ this.v3l = v3l | 0;
464
+ this.v3h = v3h | 0;
465
+ this.v4l = v4l | 0;
466
+ this.v4h = v4h | 0;
467
+ this.v5l = v5l | 0;
468
+ this.v5h = v5h | 0;
469
+ this.v6l = v6l | 0;
470
+ this.v6h = v6h | 0;
471
+ this.v7l = v7l | 0;
472
+ this.v7h = v7h | 0;
473
+ }
474
+ destroy(): void {
475
+ super.destroy();
476
+ this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
477
+ }
478
+ compress(view: DataView, offset: number, withLength = true): void {
479
+ for (let i = 0; i < 32; i++, offset += 4) BLAKE512_W[i] = view.getUint32(offset, false);
480
+
481
+ this.get().forEach((v, i) => (BBUF[i] = v)); // First half from state.
482
+ BBUF.set(this.constants.subarray(0, 16), 16);
483
+ if (withLength) {
484
+ // Blake1-64 injects the 64-bit bit counter into `v12` and `v13`; the final all-padding
485
+ // block passes `withLength = false`, leaving the trailing constant lanes untouched.
486
+ const { h, l } = u64.fromBig(BigInt(this.length * 8));
487
+ BBUF[24] = (BBUF[24] ^ h) >>> 0;
488
+ BBUF[25] = (BBUF[25] ^ l) >>> 0;
489
+ BBUF[26] = (BBUF[26] ^ h) >>> 0;
490
+ BBUF[27] = (BBUF[27] ^ l) >>> 0;
491
+ }
492
+ for (let i = 0, k = 0; i < 16; i++) {
493
+ G1b(0, 4, 8, 12, BLAKE512_W, k++);
494
+ G2b(0, 4, 8, 12, BLAKE512_W, k++);
495
+ G1b(1, 5, 9, 13, BLAKE512_W, k++);
496
+ G2b(1, 5, 9, 13, BLAKE512_W, k++);
497
+ G1b(2, 6, 10, 14, BLAKE512_W, k++);
498
+ G2b(2, 6, 10, 14, BLAKE512_W, k++);
499
+ G1b(3, 7, 11, 15, BLAKE512_W, k++);
500
+ G2b(3, 7, 11, 15, BLAKE512_W, k++);
501
+
502
+ G1b(0, 5, 10, 15, BLAKE512_W, k++);
503
+ G2b(0, 5, 10, 15, BLAKE512_W, k++);
504
+ G1b(1, 6, 11, 12, BLAKE512_W, k++);
505
+ G2b(1, 6, 11, 12, BLAKE512_W, k++);
506
+ G1b(2, 7, 8, 13, BLAKE512_W, k++);
507
+ G2b(2, 7, 8, 13, BLAKE512_W, k++);
508
+ G1b(3, 4, 9, 14, BLAKE512_W, k++);
509
+ G2b(3, 4, 9, 14, BLAKE512_W, k++);
510
+ }
511
+ this.v0l ^= BBUF[0] ^ BBUF[16] ^ this.salt[0];
512
+ this.v0h ^= BBUF[1] ^ BBUF[17] ^ this.salt[1];
513
+ this.v1l ^= BBUF[2] ^ BBUF[18] ^ this.salt[2];
514
+ this.v1h ^= BBUF[3] ^ BBUF[19] ^ this.salt[3];
515
+ this.v2l ^= BBUF[4] ^ BBUF[20] ^ this.salt[4];
516
+ this.v2h ^= BBUF[5] ^ BBUF[21] ^ this.salt[5];
517
+ this.v3l ^= BBUF[6] ^ BBUF[22] ^ this.salt[6];
518
+ this.v3h ^= BBUF[7] ^ BBUF[23] ^ this.salt[7];
519
+ this.v4l ^= BBUF[8] ^ BBUF[24] ^ this.salt[0];
520
+ this.v4h ^= BBUF[9] ^ BBUF[25] ^ this.salt[1];
521
+ this.v5l ^= BBUF[10] ^ BBUF[26] ^ this.salt[2];
522
+ this.v5h ^= BBUF[11] ^ BBUF[27] ^ this.salt[3];
523
+ this.v6l ^= BBUF[12] ^ BBUF[28] ^ this.salt[4];
524
+ this.v6h ^= BBUF[13] ^ BBUF[29] ^ this.salt[5];
525
+ this.v7l ^= BBUF[14] ^ BBUF[30] ^ this.salt[6];
526
+ this.v7h ^= BBUF[15] ^ BBUF[31] ^ this.salt[7];
527
+ clean(BBUF, BLAKE512_W);
528
+ }
529
+ }
530
+
531
+ /** Internal blake1-224 hash class. */
532
+ export class _BLAKE224 extends BLAKE1_32B {
533
+ constructor(opts: BlakeOpts = {}) {
534
+ super(28, B224_IV, 0b0000_0000, opts);
535
+ }
536
+ }
537
+ /** Internal blake1-256 hash class. */
538
+ export class _BLAKE256 extends BLAKE1_32B {
539
+ constructor(opts: BlakeOpts = {}) {
540
+ super(32, B256_IV, 0b0000_0001, opts);
541
+ }
542
+ }
543
+ /** Internal blake1-384 hash class. */
544
+ export class _BLAKE384 extends BLAKE1_64B {
545
+ constructor(opts: BlakeOpts = {}) {
546
+ super(48, B384_IV, 0b0000_0000, opts);
547
+ }
548
+ }
549
+ /** Internal blake1-512 hash class. */
550
+ export class _BLAKE512 extends BLAKE1_64B {
551
+ constructor(opts: BlakeOpts = {}) {
552
+ super(64, B512_IV, 0b0000_0001, opts);
553
+ }
554
+ }
555
+ /**
556
+ * Blake1-224 hash function.
557
+ * @param msg - message bytes to hash
558
+ * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
559
+ * `opts.salt` must be exactly 16 bytes.
560
+ * @returns Digest bytes.
561
+ * @example
562
+ * Hash a message with Blake1-224.
563
+ * ```ts
564
+ * blake224(new Uint8Array([97, 98, 99]));
565
+ * ```
566
+ */
567
+ export const blake224: TRet<CHash<_BLAKE224, BlakeOpts>> = /* @__PURE__ */ createHasher(
568
+ (opts) => new _BLAKE224(opts)
569
+ );
570
+ /**
571
+ * Blake1-256 hash function.
572
+ * @param msg - message bytes to hash
573
+ * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
574
+ * `opts.salt` must be exactly 16 bytes.
575
+ * @returns Digest bytes.
576
+ * @example
577
+ * Hash a message with Blake1-256.
578
+ * ```ts
579
+ * blake256(new Uint8Array([97, 98, 99]));
580
+ * ```
581
+ */
582
+ export const blake256: TRet<CHash<_BLAKE256, BlakeOpts>> = /* @__PURE__ */ createHasher(
583
+ (opts) => new _BLAKE256(opts)
584
+ );
585
+ /**
586
+ * Blake1-384 hash function.
587
+ * @param msg - message bytes to hash
588
+ * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
589
+ * `opts.salt` must be exactly 32 bytes.
590
+ * @returns Digest bytes.
591
+ * @example
592
+ * Hash a message with Blake1-384.
593
+ * ```ts
594
+ * blake384(new Uint8Array([97, 98, 99]));
595
+ * ```
596
+ */
597
+ export const blake384: TRet<CHash<_BLAKE384, BlakeOpts>> = /* @__PURE__ */ createHasher(
598
+ (opts) => new _BLAKE384(opts)
599
+ );
600
+ /**
601
+ * Blake1-512 hash function.
602
+ * @param msg - message bytes to hash
603
+ * @param opts - Optional Blake1 settings. See {@link BlakeOpts}. If set,
604
+ * `opts.salt` must be exactly 32 bytes.
605
+ * @returns Digest bytes.
606
+ * @example
607
+ * Hash a message with Blake1-512.
608
+ * ```ts
609
+ * blake512(new Uint8Array([97, 98, 99]));
610
+ * ```
611
+ */
612
+ export const blake512: TRet<CHash<_BLAKE512, BlakeOpts>> = /* @__PURE__ */ createHasher(
613
+ (opts) => new _BLAKE512(opts)
614
+ );