@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.
- package/LICENSE +28 -0
- package/README.md +707 -0
- package/dist/application/app.d.ts +138 -0
- package/dist/application/app.js +654 -0
- package/dist/application/operations.d.ts +9 -0
- package/dist/application/operations.js +96 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +460 -0
- package/dist/cli/help.d.ts +4 -0
- package/dist/cli/help.js +49 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +13 -0
- package/dist/cli/onboarding.d.ts +14 -0
- package/dist/cli/onboarding.js +144 -0
- package/dist/cli/output.d.ts +2 -0
- package/dist/cli/output.js +231 -0
- package/dist/cli/terminal.d.ts +6 -0
- package/dist/cli/terminal.js +92 -0
- package/dist/cli/update-check.d.ts +1 -0
- package/dist/cli/update-check.js +12 -0
- package/dist/cli/updates.d.ts +2 -0
- package/dist/cli/updates.js +98 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.js +14 -0
- package/dist/doctor/credential-probe.d.ts +7 -0
- package/dist/doctor/credential-probe.js +49 -0
- package/dist/doctor/doctor.d.ts +4 -0
- package/dist/doctor/doctor.js +213 -0
- package/dist/doctor/keyring.d.ts +7 -0
- package/dist/doctor/keyring.js +150 -0
- package/dist/doctor/profile.d.ts +19 -0
- package/dist/doctor/profile.js +73 -0
- package/dist/doctor/types.d.ts +40 -0
- package/dist/doctor/types.js +1 -0
- package/dist/domain/amount.d.ts +6 -0
- package/dist/domain/amount.js +27 -0
- package/dist/domain/errors.d.ts +10 -0
- package/dist/domain/errors.js +16 -0
- package/dist/labels/directory.d.ts +87 -0
- package/dist/labels/directory.js +140 -0
- package/dist/labels/personal.d.ts +17 -0
- package/dist/labels/personal.js +56 -0
- package/dist/labels/presentation.d.ts +154 -0
- package/dist/labels/presentation.js +90 -0
- package/dist/network/reader.d.ts +31 -0
- package/dist/network/reader.js +370 -0
- package/dist/network/retry.d.ts +7 -0
- package/dist/network/retry.js +53 -0
- package/dist/network/work.d.ts +3 -0
- package/dist/network/work.js +66 -0
- package/dist/pricing/market.d.ts +29 -0
- package/dist/pricing/market.js +150 -0
- package/dist/pricing/terms.d.ts +6 -0
- package/dist/pricing/terms.js +12 -0
- package/dist/spending/destination.d.ts +16 -0
- package/dist/spending/destination.js +42 -0
- package/dist/spending/journal.d.ts +28 -0
- package/dist/spending/journal.js +69 -0
- package/dist/spending/ledger.d.ts +118 -0
- package/dist/spending/ledger.js +444 -0
- package/dist/spending/payments.d.ts +67 -0
- package/dist/spending/payments.js +424 -0
- package/dist/spending/pool.d.ts +13 -0
- package/dist/spending/pool.js +38 -0
- package/dist/spending/reconcile.d.ts +18 -0
- package/dist/spending/reconcile.js +64 -0
- package/dist/storage/profiles.d.ts +13 -0
- package/dist/storage/profiles.js +86 -0
- package/dist/storage/secrets.d.ts +16 -0
- package/dist/storage/secrets.js +104 -0
- package/dist/storage/state.d.ts +32 -0
- package/dist/storage/state.js +255 -0
- package/dist/wallet/auto-receive.d.ts +57 -0
- package/dist/wallet/auto-receive.js +140 -0
- package/dist/wallet/defaults.d.ts +3 -0
- package/dist/wallet/defaults.js +26 -0
- package/dist/wallet/signing.d.ts +17 -0
- package/dist/wallet/signing.js +128 -0
- package/dist/wallet/types.d.ts +65 -0
- package/dist/wallet/types.js +1 -0
- package/dist/wallet/work.d.ts +29 -0
- package/dist/wallet/work.js +154 -0
- package/dist/watches/manager.d.ts +75 -0
- package/dist/watches/manager.js +197 -0
- package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs +6678 -0
- package/node_modules/@attocash/commons-core/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/LICENSE +28 -0
- package/node_modules/@attocash/commons-core/README.md +118 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.d.mts +1036 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.mjs +7701 -0
- package/node_modules/@attocash/commons-core/commons-commons-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs +17681 -0
- package/node_modules/@attocash/commons-core/kotlin-kotlin-stdlib.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs +4 -0
- package/node_modules/@attocash/commons-core/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs +209 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs +2284 -0
- package/node_modules/@attocash/commons-core/kotlinx-io-kotlinx-io-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs +6042 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-core/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-core/package.json +27 -0
- package/node_modules/@attocash/commons-node/LICENSE +28 -0
- package/node_modules/@attocash/commons-node/README.md +92 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.d.mts +255 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.mjs +2977 -0
- package/node_modules/@attocash/commons-node/commons-commons-node.mjs.map +1 -0
- package/node_modules/@attocash/commons-node/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-node/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-node/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-node/package.json +29 -0
- package/node_modules/@attocash/commons-node-remote/LICENSE +28 -0
- package/node_modules/@attocash/commons-node-remote/README.md +61 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.d.mts +122 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs +1810 -0
- package/node_modules/@attocash/commons-node-remote/commons-commons-node-remote.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-node-remote/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs +8 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-browser.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-node-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-node-remote/package.json +31 -0
- package/node_modules/@attocash/commons-transport/LICENSE +28 -0
- package/node_modules/@attocash/commons-transport/README.md +5 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.d.mts +64 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs +249 -0
- package/node_modules/@attocash/commons-transport/commons-commons-transport.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs +263 -0
- package/node_modules/@attocash/commons-transport/kotlinx-atomicfu.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs +8 -0
- package/node_modules/@attocash/commons-transport/kotlinx-browser.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs +11604 -0
- package/node_modules/@attocash/commons-transport/kotlinx-coroutines-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-transport/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs +499 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-content-negotiation.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs +6456 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-client-core.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs +83 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-events.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs +1714 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http-cio.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs +3197 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-http.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs +2290 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs +46 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs +482 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization-kotlinx.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs +165 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-serialization.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs +4 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-sse.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs +3222 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-utils.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs +4 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websocket-serialization.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs +1485 -0
- package/node_modules/@attocash/commons-transport/ktor-ktor-websockets.mjs.map +1 -0
- package/node_modules/@attocash/commons-transport/package.json +29 -0
- package/node_modules/@attocash/commons-worker/LICENSE +28 -0
- package/node_modules/@attocash/commons-worker/README.md +48 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.d.mts +73 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs +702 -0
- package/node_modules/@attocash/commons-worker/commons-commons-worker.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-worker/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-worker/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker/package.json +29 -0
- package/node_modules/@attocash/commons-worker-remote/LICENSE +28 -0
- package/node_modules/@attocash/commons-worker-remote/README.md +60 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.d.mts +93 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs +289 -0
- package/node_modules/@attocash/commons-worker-remote/commons-commons-worker-remote.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs +432 -0
- package/node_modules/@attocash/commons-worker-remote/kotlin-logging.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs +8 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-browser.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs +5294 -0
- package/node_modules/@attocash/commons-worker-remote/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
- package/node_modules/@attocash/commons-worker-remote/package.json +31 -0
- package/node_modules/@js-joda/core/CHANGELOG.md +363 -0
- package/node_modules/@js-joda/core/CheatSheet.md +947 -0
- package/node_modules/@js-joda/core/LICENSE +34 -0
- package/node_modules/@js-joda/core/README.md +155 -0
- package/node_modules/@js-joda/core/bower.json +21 -0
- package/node_modules/@js-joda/core/dist/js-joda.d.ts +2452 -0
- package/node_modules/@js-joda/core/dist/js-joda.esm.js +13564 -0
- package/node_modules/@js-joda/core/dist/js-joda.flow.js +949 -0
- package/node_modules/@js-joda/core/dist/js-joda.js +13630 -0
- package/node_modules/@js-joda/core/dist/js-joda.js.map +1 -0
- package/node_modules/@js-joda/core/dist/js-joda.min.js +5 -0
- package/node_modules/@js-joda/core/package.json +76 -0
- package/node_modules/@js-joda/core/src/Clock.js +330 -0
- package/node_modules/@js-joda/core/src/DayOfWeek.js +451 -0
- package/node_modules/@js-joda/core/src/Duration.js +1205 -0
- package/node_modules/@js-joda/core/src/Enum.js +30 -0
- package/node_modules/@js-joda/core/src/Instant.js +1012 -0
- package/node_modules/@js-joda/core/src/LocalDate.js +1703 -0
- package/node_modules/@js-joda/core/src/LocalDateTime.js +1686 -0
- package/node_modules/@js-joda/core/src/LocalTime.js +1415 -0
- package/node_modules/@js-joda/core/src/MathUtil.js +236 -0
- package/node_modules/@js-joda/core/src/Month.js +600 -0
- package/node_modules/@js-joda/core/src/MonthDay.js +730 -0
- package/node_modules/@js-joda/core/src/OffsetDateTime.js +757 -0
- package/node_modules/@js-joda/core/src/OffsetTime.js +621 -0
- package/node_modules/@js-joda/core/src/Period.js +933 -0
- package/node_modules/@js-joda/core/src/StringUtil.js +43 -0
- package/node_modules/@js-joda/core/src/Year.js +1015 -0
- package/node_modules/@js-joda/core/src/YearConstants.js +21 -0
- package/node_modules/@js-joda/core/src/YearMonth.js +1096 -0
- package/node_modules/@js-joda/core/src/ZoneId.js +236 -0
- package/node_modules/@js-joda/core/src/ZoneIdFactory.js +201 -0
- package/node_modules/@js-joda/core/src/ZoneOffset.js +486 -0
- package/node_modules/@js-joda/core/src/ZoneRegion.js +72 -0
- package/node_modules/@js-joda/core/src/ZonedDateTime.js +2007 -0
- package/node_modules/@js-joda/core/src/_init.js +68 -0
- package/node_modules/@js-joda/core/src/assert.js +33 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoLocalDate.js +230 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoLocalDateTime.js +130 -0
- package/node_modules/@js-joda/core/src/chrono/ChronoZonedDateTime.js +194 -0
- package/node_modules/@js-joda/core/src/chrono/IsoChronology.js +235 -0
- package/node_modules/@js-joda/core/src/convert.js +83 -0
- package/node_modules/@js-joda/core/src/errors.js +54 -0
- package/node_modules/@js-joda/core/src/format/DateTimeBuilder.js +535 -0
- package/node_modules/@js-joda/core/src/format/DateTimeFormatter.js +728 -0
- package/node_modules/@js-joda/core/src/format/DateTimeFormatterBuilder.js +1545 -0
- package/node_modules/@js-joda/core/src/format/DateTimeParseContext.js +297 -0
- package/node_modules/@js-joda/core/src/format/DateTimePrintContext.js +138 -0
- package/node_modules/@js-joda/core/src/format/DecimalStyle.js +113 -0
- package/node_modules/@js-joda/core/src/format/EnumMap.js +70 -0
- package/node_modules/@js-joda/core/src/format/ParsePosition.js +31 -0
- package/node_modules/@js-joda/core/src/format/ResolverStyle.js +93 -0
- package/node_modules/@js-joda/core/src/format/SignStyle.js +38 -0
- package/node_modules/@js-joda/core/src/format/StringBuilder.js +47 -0
- package/node_modules/@js-joda/core/src/format/TextStyle.js +114 -0
- package/node_modules/@js-joda/core/src/format/parser/CharLiteralPrinterParser.js +46 -0
- package/node_modules/@js-joda/core/src/format/parser/CompositePrinterParser.js +89 -0
- package/node_modules/@js-joda/core/src/format/parser/FractionPrinterParser.js +162 -0
- package/node_modules/@js-joda/core/src/format/parser/NumberPrinterParser.js +367 -0
- package/node_modules/@js-joda/core/src/format/parser/OffsetIdPrinterParser.js +177 -0
- package/node_modules/@js-joda/core/src/format/parser/PadPrinterParserDecorator.js +81 -0
- package/node_modules/@js-joda/core/src/format/parser/SettingsParser.js +44 -0
- package/node_modules/@js-joda/core/src/format/parser/StringLiteralPrinterParser.js +39 -0
- package/node_modules/@js-joda/core/src/format/parser/ZoneIdPrinterParser.js +218 -0
- package/node_modules/@js-joda/core/src/js-joda.js +210 -0
- package/node_modules/@js-joda/core/src/license-preamble.js +3 -0
- package/node_modules/@js-joda/core/src/temporal/ChronoField.js +470 -0
- package/node_modules/@js-joda/core/src/temporal/ChronoUnit.js +310 -0
- package/node_modules/@js-joda/core/src/temporal/DefaultInterfaceTemporal.js +118 -0
- package/node_modules/@js-joda/core/src/temporal/IsoFields.js +859 -0
- package/node_modules/@js-joda/core/src/temporal/NativeJsTemporal.js +105 -0
- package/node_modules/@js-joda/core/src/temporal/Temporal.js +346 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAccessor.js +125 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAdjuster.js +92 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAdjusters.js +464 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalAmount.js +166 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalField.js +248 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQueries.js +223 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQueriesFactory.js +77 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalQuery.js +107 -0
- package/node_modules/@js-joda/core/src/temporal/TemporalUnit.js +179 -0
- package/node_modules/@js-joda/core/src/temporal/ValueRange.js +257 -0
- package/node_modules/@js-joda/core/src/use.js +20 -0
- package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneId.js +31 -0
- package/node_modules/@js-joda/core/src/zone/SystemDefaultZoneRules.js +162 -0
- package/node_modules/@js-joda/core/src/zone/ZoneOffsetTransition.js +289 -0
- package/node_modules/@js-joda/core/src/zone/ZoneRules.js +464 -0
- package/node_modules/@js-joda/core/src/zone/ZoneRulesProvider.js +36 -0
- package/node_modules/@noble/hashes/LICENSE +21 -0
- package/node_modules/@noble/hashes/README.md +563 -0
- package/node_modules/@noble/hashes/_blake.d.ts +21 -0
- package/node_modules/@noble/hashes/_blake.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_blake.js +52 -0
- package/node_modules/@noble/hashes/_blake.js.map +1 -0
- package/node_modules/@noble/hashes/_md.d.ts +99 -0
- package/node_modules/@noble/hashes/_md.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_md.js +202 -0
- package/node_modules/@noble/hashes/_md.js.map +1 -0
- package/node_modules/@noble/hashes/_u64.d.ts +63 -0
- package/node_modules/@noble/hashes/_u64.d.ts.map +1 -0
- package/node_modules/@noble/hashes/_u64.js +84 -0
- package/node_modules/@noble/hashes/_u64.js.map +1 -0
- package/node_modules/@noble/hashes/argon2.d.ts +112 -0
- package/node_modules/@noble/hashes/argon2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/argon2.js +517 -0
- package/node_modules/@noble/hashes/argon2.js.map +1 -0
- package/node_modules/@noble/hashes/blake1.d.ts +156 -0
- package/node_modules/@noble/hashes/blake1.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake1.js +560 -0
- package/node_modules/@noble/hashes/blake1.js.map +1 -0
- package/node_modules/@noble/hashes/blake2.d.ts +184 -0
- package/node_modules/@noble/hashes/blake2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake2.js +501 -0
- package/node_modules/@noble/hashes/blake2.js.map +1 -0
- package/node_modules/@noble/hashes/blake3.d.ts +68 -0
- package/node_modules/@noble/hashes/blake3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/blake3.js +284 -0
- package/node_modules/@noble/hashes/blake3.js.map +1 -0
- package/node_modules/@noble/hashes/eskdf.d.ts +92 -0
- package/node_modules/@noble/hashes/eskdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/eskdf.js +218 -0
- package/node_modules/@noble/hashes/eskdf.js.map +1 -0
- package/node_modules/@noble/hashes/hkdf.d.ts +64 -0
- package/node_modules/@noble/hashes/hkdf.d.ts.map +1 -0
- package/node_modules/@noble/hashes/hkdf.js +120 -0
- package/node_modules/@noble/hashes/hkdf.js.map +1 -0
- package/node_modules/@noble/hashes/hmac.d.ts +47 -0
- package/node_modules/@noble/hashes/hmac.d.ts.map +1 -0
- package/node_modules/@noble/hashes/hmac.js +93 -0
- package/node_modules/@noble/hashes/hmac.js.map +1 -0
- package/node_modules/@noble/hashes/index.d.ts +2 -0
- package/node_modules/@noble/hashes/index.d.ts.map +1 -0
- package/node_modules/@noble/hashes/index.js +35 -0
- package/node_modules/@noble/hashes/index.js.map +1 -0
- package/node_modules/@noble/hashes/legacy.d.ts +102 -0
- package/node_modules/@noble/hashes/legacy.d.ts.map +1 -0
- package/node_modules/@noble/hashes/legacy.js +327 -0
- package/node_modules/@noble/hashes/legacy.js.map +1 -0
- package/node_modules/@noble/hashes/package.json +97 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts +56 -0
- package/node_modules/@noble/hashes/pbkdf2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/pbkdf2.js +135 -0
- package/node_modules/@noble/hashes/pbkdf2.js.map +1 -0
- package/node_modules/@noble/hashes/scrypt.d.ts +65 -0
- package/node_modules/@noble/hashes/scrypt.d.ts.map +1 -0
- package/node_modules/@noble/hashes/scrypt.js +257 -0
- package/node_modules/@noble/hashes/scrypt.js.map +1 -0
- package/node_modules/@noble/hashes/sha2.d.ts +249 -0
- package/node_modules/@noble/hashes/sha2.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha2.js +458 -0
- package/node_modules/@noble/hashes/sha2.js.map +1 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts +461 -0
- package/node_modules/@noble/hashes/sha3-addons.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha3-addons.js +783 -0
- package/node_modules/@noble/hashes/sha3-addons.js.map +1 -0
- package/node_modules/@noble/hashes/sha3.d.ts +199 -0
- package/node_modules/@noble/hashes/sha3.d.ts.map +1 -0
- package/node_modules/@noble/hashes/sha3.js +431 -0
- package/node_modules/@noble/hashes/sha3.js.map +1 -0
- package/node_modules/@noble/hashes/src/_blake.ts +57 -0
- package/node_modules/@noble/hashes/src/_md.ts +222 -0
- package/node_modules/@noble/hashes/src/_u64.ts +117 -0
- package/node_modules/@noble/hashes/src/argon2.ts +667 -0
- package/node_modules/@noble/hashes/src/blake1.ts +614 -0
- package/node_modules/@noble/hashes/src/blake2.ts +582 -0
- package/node_modules/@noble/hashes/src/blake3.ts +317 -0
- package/node_modules/@noble/hashes/src/eskdf.ts +259 -0
- package/node_modules/@noble/hashes/src/hkdf.ts +133 -0
- package/node_modules/@noble/hashes/src/hmac.ts +126 -0
- package/node_modules/@noble/hashes/src/index.ts +33 -0
- package/node_modules/@noble/hashes/src/legacy.ts +339 -0
- package/node_modules/@noble/hashes/src/pbkdf2.ts +175 -0
- package/node_modules/@noble/hashes/src/scrypt.ts +315 -0
- package/node_modules/@noble/hashes/src/sha2.ts +530 -0
- package/node_modules/@noble/hashes/src/sha3-addons.ts +983 -0
- package/node_modules/@noble/hashes/src/sha3.ts +485 -0
- package/node_modules/@noble/hashes/src/utils.ts +848 -0
- package/node_modules/@noble/hashes/src/webcrypto.ts +239 -0
- package/node_modules/@noble/hashes/utils.d.ts +519 -0
- package/node_modules/@noble/hashes/utils.d.ts.map +1 -0
- package/node_modules/@noble/hashes/utils.js +578 -0
- package/node_modules/@noble/hashes/utils.js.map +1 -0
- package/node_modules/@noble/hashes/webcrypto.d.ts +120 -0
- package/node_modules/@noble/hashes/webcrypto.d.ts.map +1 -0
- package/node_modules/@noble/hashes/webcrypto.js +165 -0
- package/node_modules/@noble/hashes/webcrypto.js.map +1 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1407 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +53 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.
|
|
3
|
+
* SHA256 is the fastest hash implementable in JS, even faster than Blake3.
|
|
4
|
+
* Check out {@link https://www.rfc-editor.org/rfc/rfc4634 | RFC 4634} and
|
|
5
|
+
* {@link https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf | FIPS 180-4}.
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';
|
|
9
|
+
import * as u64 from './_u64.ts';
|
|
10
|
+
import { type CHash, clean, createHasher, oidNist, rotr, type TRet } from './utils.ts';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* SHA-224 / SHA-256 round constants from RFC 6234 §5.1: the first 32 bits
|
|
14
|
+
* of the cube roots of the first 64 primes (2..311).
|
|
15
|
+
*/
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
const SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
18
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
19
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
20
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
21
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
22
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
23
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
24
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
25
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** Reusable SHA-224 / SHA-256 message schedule buffer `W_t` from RFC 6234 §6.2 step 1. */
|
|
29
|
+
const SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
30
|
+
|
|
31
|
+
/** Internal SHA-224 / SHA-256 compression engine from RFC 6234 §6.2. */
|
|
32
|
+
abstract class SHA2_32B<T extends SHA2_32B<T>> extends HashMD<T> {
|
|
33
|
+
// We cannot use array here since array allows indexing by variable
|
|
34
|
+
// which means optimizer/compiler cannot use registers.
|
|
35
|
+
protected abstract A: number;
|
|
36
|
+
protected abstract B: number;
|
|
37
|
+
protected abstract C: number;
|
|
38
|
+
protected abstract D: number;
|
|
39
|
+
protected abstract E: number;
|
|
40
|
+
protected abstract F: number;
|
|
41
|
+
protected abstract G: number;
|
|
42
|
+
protected abstract H: number;
|
|
43
|
+
|
|
44
|
+
constructor(outputLen: number) {
|
|
45
|
+
super(64, outputLen, 8, false);
|
|
46
|
+
}
|
|
47
|
+
protected get(): [number, number, number, number, number, number, number, number] {
|
|
48
|
+
const { A, B, C, D, E, F, G, H } = this;
|
|
49
|
+
return [A, B, C, D, E, F, G, H];
|
|
50
|
+
}
|
|
51
|
+
// prettier-ignore
|
|
52
|
+
protected set(
|
|
53
|
+
A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number
|
|
54
|
+
): void {
|
|
55
|
+
this.A = A | 0;
|
|
56
|
+
this.B = B | 0;
|
|
57
|
+
this.C = C | 0;
|
|
58
|
+
this.D = D | 0;
|
|
59
|
+
this.E = E | 0;
|
|
60
|
+
this.F = F | 0;
|
|
61
|
+
this.G = G | 0;
|
|
62
|
+
this.H = H | 0;
|
|
63
|
+
}
|
|
64
|
+
protected process(view: DataView, offset: number): void {
|
|
65
|
+
// Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array
|
|
66
|
+
for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);
|
|
67
|
+
for (let i = 16; i < 64; i++) {
|
|
68
|
+
const W15 = SHA256_W[i - 15];
|
|
69
|
+
const W2 = SHA256_W[i - 2];
|
|
70
|
+
const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);
|
|
71
|
+
const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);
|
|
72
|
+
SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;
|
|
73
|
+
}
|
|
74
|
+
// Compression function main loop, 64 rounds
|
|
75
|
+
let { A, B, C, D, E, F, G, H } = this;
|
|
76
|
+
for (let i = 0; i < 64; i++) {
|
|
77
|
+
const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);
|
|
78
|
+
const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
|
79
|
+
const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);
|
|
80
|
+
const T2 = (sigma0 + Maj(A, B, C)) | 0;
|
|
81
|
+
H = G;
|
|
82
|
+
G = F;
|
|
83
|
+
F = E;
|
|
84
|
+
E = (D + T1) | 0;
|
|
85
|
+
D = C;
|
|
86
|
+
C = B;
|
|
87
|
+
B = A;
|
|
88
|
+
A = (T1 + T2) | 0;
|
|
89
|
+
}
|
|
90
|
+
// Add the compressed chunk to the current hash value
|
|
91
|
+
A = (A + this.A) | 0;
|
|
92
|
+
B = (B + this.B) | 0;
|
|
93
|
+
C = (C + this.C) | 0;
|
|
94
|
+
D = (D + this.D) | 0;
|
|
95
|
+
E = (E + this.E) | 0;
|
|
96
|
+
F = (F + this.F) | 0;
|
|
97
|
+
G = (G + this.G) | 0;
|
|
98
|
+
H = (H + this.H) | 0;
|
|
99
|
+
this.set(A, B, C, D, E, F, G, H);
|
|
100
|
+
}
|
|
101
|
+
protected roundClean(): void {
|
|
102
|
+
clean(SHA256_W);
|
|
103
|
+
}
|
|
104
|
+
destroy(): void {
|
|
105
|
+
// HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves
|
|
106
|
+
// update()/digest() callable on reused instances.
|
|
107
|
+
this.destroyed = true;
|
|
108
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
109
|
+
clean(this.buffer);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Internal SHA-256 hash class grounded in RFC 6234 §6.2. */
|
|
114
|
+
export class _SHA256 extends SHA2_32B<_SHA256> {
|
|
115
|
+
// We cannot use array here since array allows indexing by variable
|
|
116
|
+
// which means optimizer/compiler cannot use registers.
|
|
117
|
+
protected A: number = SHA256_IV[0] | 0;
|
|
118
|
+
protected B: number = SHA256_IV[1] | 0;
|
|
119
|
+
protected C: number = SHA256_IV[2] | 0;
|
|
120
|
+
protected D: number = SHA256_IV[3] | 0;
|
|
121
|
+
protected E: number = SHA256_IV[4] | 0;
|
|
122
|
+
protected F: number = SHA256_IV[5] | 0;
|
|
123
|
+
protected G: number = SHA256_IV[6] | 0;
|
|
124
|
+
protected H: number = SHA256_IV[7] | 0;
|
|
125
|
+
constructor() {
|
|
126
|
+
super(32);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Internal SHA-224 hash class grounded in RFC 6234 §6.2 and §8.5. */
|
|
131
|
+
export class _SHA224 extends SHA2_32B<_SHA224> {
|
|
132
|
+
protected A: number = SHA224_IV[0] | 0;
|
|
133
|
+
protected B: number = SHA224_IV[1] | 0;
|
|
134
|
+
protected C: number = SHA224_IV[2] | 0;
|
|
135
|
+
protected D: number = SHA224_IV[3] | 0;
|
|
136
|
+
protected E: number = SHA224_IV[4] | 0;
|
|
137
|
+
protected F: number = SHA224_IV[5] | 0;
|
|
138
|
+
protected G: number = SHA224_IV[6] | 0;
|
|
139
|
+
protected H: number = SHA224_IV[7] | 0;
|
|
140
|
+
constructor() {
|
|
141
|
+
super(28);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// SHA2-512 is slower than sha256 in js because u64 operations are slow.
|
|
146
|
+
|
|
147
|
+
// SHA-384 / SHA-512 round constants from RFC 6234 §5.2:
|
|
148
|
+
// 80 full 64-bit words split into high/low halves.
|
|
149
|
+
// prettier-ignore
|
|
150
|
+
const K512 = /* @__PURE__ */ (() => u64.split([
|
|
151
|
+
'0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',
|
|
152
|
+
'0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',
|
|
153
|
+
'0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',
|
|
154
|
+
'0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',
|
|
155
|
+
'0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',
|
|
156
|
+
'0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',
|
|
157
|
+
'0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',
|
|
158
|
+
'0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',
|
|
159
|
+
'0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',
|
|
160
|
+
'0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',
|
|
161
|
+
'0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',
|
|
162
|
+
'0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',
|
|
163
|
+
'0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',
|
|
164
|
+
'0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',
|
|
165
|
+
'0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',
|
|
166
|
+
'0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',
|
|
167
|
+
'0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',
|
|
168
|
+
'0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',
|
|
169
|
+
'0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',
|
|
170
|
+
'0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'
|
|
171
|
+
].map(n => BigInt(n))))();
|
|
172
|
+
const SHA512_Kh = /* @__PURE__ */ (() => K512[0])();
|
|
173
|
+
const SHA512_Kl = /* @__PURE__ */ (() => K512[1])();
|
|
174
|
+
|
|
175
|
+
// Reusable high-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.
|
|
176
|
+
const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
|
|
177
|
+
// Reusable low-half schedule buffer for the RFC 6234 §6.4 64-bit `W_t` words.
|
|
178
|
+
const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
|
|
179
|
+
|
|
180
|
+
/** Internal SHA-384 / SHA-512 compression engine from RFC 6234 §6.4. */
|
|
181
|
+
abstract class SHA2_64B<T extends SHA2_64B<T>> extends HashMD<T> {
|
|
182
|
+
// We cannot use array here since array allows indexing by variable
|
|
183
|
+
// which means optimizer/compiler cannot use registers.
|
|
184
|
+
// h -- high 32 bits, l -- low 32 bits
|
|
185
|
+
protected abstract Ah: number;
|
|
186
|
+
protected abstract Al: number;
|
|
187
|
+
protected abstract Bh: number;
|
|
188
|
+
protected abstract Bl: number;
|
|
189
|
+
protected abstract Ch: number;
|
|
190
|
+
protected abstract Cl: number;
|
|
191
|
+
protected abstract Dh: number;
|
|
192
|
+
protected abstract Dl: number;
|
|
193
|
+
protected abstract Eh: number;
|
|
194
|
+
protected abstract El: number;
|
|
195
|
+
protected abstract Fh: number;
|
|
196
|
+
protected abstract Fl: number;
|
|
197
|
+
protected abstract Gh: number;
|
|
198
|
+
protected abstract Gl: number;
|
|
199
|
+
protected abstract Hh: number;
|
|
200
|
+
protected abstract Hl: number;
|
|
201
|
+
|
|
202
|
+
constructor(outputLen: number) {
|
|
203
|
+
super(128, outputLen, 16, false);
|
|
204
|
+
}
|
|
205
|
+
// prettier-ignore
|
|
206
|
+
protected get(): [
|
|
207
|
+
number, number, number, number, number, number, number, number,
|
|
208
|
+
number, number, number, number, number, number, number, number
|
|
209
|
+
] {
|
|
210
|
+
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
211
|
+
return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
212
|
+
}
|
|
213
|
+
// prettier-ignore
|
|
214
|
+
protected set(
|
|
215
|
+
Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number,
|
|
216
|
+
Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number
|
|
217
|
+
): void {
|
|
218
|
+
this.Ah = Ah | 0;
|
|
219
|
+
this.Al = Al | 0;
|
|
220
|
+
this.Bh = Bh | 0;
|
|
221
|
+
this.Bl = Bl | 0;
|
|
222
|
+
this.Ch = Ch | 0;
|
|
223
|
+
this.Cl = Cl | 0;
|
|
224
|
+
this.Dh = Dh | 0;
|
|
225
|
+
this.Dl = Dl | 0;
|
|
226
|
+
this.Eh = Eh | 0;
|
|
227
|
+
this.El = El | 0;
|
|
228
|
+
this.Fh = Fh | 0;
|
|
229
|
+
this.Fl = Fl | 0;
|
|
230
|
+
this.Gh = Gh | 0;
|
|
231
|
+
this.Gl = Gl | 0;
|
|
232
|
+
this.Hh = Hh | 0;
|
|
233
|
+
this.Hl = Hl | 0;
|
|
234
|
+
}
|
|
235
|
+
protected process(view: DataView, offset: number): void {
|
|
236
|
+
// Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array
|
|
237
|
+
for (let i = 0; i < 16; i++, offset += 4) {
|
|
238
|
+
SHA512_W_H[i] = view.getUint32(offset);
|
|
239
|
+
SHA512_W_L[i] = view.getUint32((offset += 4));
|
|
240
|
+
}
|
|
241
|
+
for (let i = 16; i < 80; i++) {
|
|
242
|
+
// s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)
|
|
243
|
+
const W15h = SHA512_W_H[i - 15] | 0;
|
|
244
|
+
const W15l = SHA512_W_L[i - 15] | 0;
|
|
245
|
+
const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);
|
|
246
|
+
const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);
|
|
247
|
+
// s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)
|
|
248
|
+
const W2h = SHA512_W_H[i - 2] | 0;
|
|
249
|
+
const W2l = SHA512_W_L[i - 2] | 0;
|
|
250
|
+
const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);
|
|
251
|
+
const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);
|
|
252
|
+
// SHA512_W[i] = s0 + s1 + SHA512_W[i - 7] + SHA512_W[i - 16];
|
|
253
|
+
const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);
|
|
254
|
+
const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);
|
|
255
|
+
SHA512_W_H[i] = SUMh | 0;
|
|
256
|
+
SHA512_W_L[i] = SUMl | 0;
|
|
257
|
+
}
|
|
258
|
+
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
259
|
+
// Compression function main loop, 80 rounds
|
|
260
|
+
for (let i = 0; i < 80; i++) {
|
|
261
|
+
// S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)
|
|
262
|
+
const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);
|
|
263
|
+
const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);
|
|
264
|
+
//const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;
|
|
265
|
+
const CHIh = (Eh & Fh) ^ (~Eh & Gh);
|
|
266
|
+
const CHIl = (El & Fl) ^ (~El & Gl);
|
|
267
|
+
// T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]
|
|
268
|
+
// prettier-ignore
|
|
269
|
+
const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);
|
|
270
|
+
const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);
|
|
271
|
+
const T1l = T1ll | 0;
|
|
272
|
+
// S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)
|
|
273
|
+
const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);
|
|
274
|
+
const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);
|
|
275
|
+
const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);
|
|
276
|
+
const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);
|
|
277
|
+
Hh = Gh | 0;
|
|
278
|
+
Hl = Gl | 0;
|
|
279
|
+
Gh = Fh | 0;
|
|
280
|
+
Gl = Fl | 0;
|
|
281
|
+
Fh = Eh | 0;
|
|
282
|
+
Fl = El | 0;
|
|
283
|
+
({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
284
|
+
Dh = Ch | 0;
|
|
285
|
+
Dl = Cl | 0;
|
|
286
|
+
Ch = Bh | 0;
|
|
287
|
+
Cl = Bl | 0;
|
|
288
|
+
Bh = Ah | 0;
|
|
289
|
+
Bl = Al | 0;
|
|
290
|
+
const All = u64.add3L(T1l, sigma0l, MAJl);
|
|
291
|
+
Ah = u64.add3H(All, T1h, sigma0h, MAJh);
|
|
292
|
+
Al = All | 0;
|
|
293
|
+
}
|
|
294
|
+
// Add the compressed chunk to the current hash value
|
|
295
|
+
({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
296
|
+
({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
297
|
+
({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
|
|
298
|
+
({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
299
|
+
({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
300
|
+
({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
301
|
+
({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
302
|
+
({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
303
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
304
|
+
}
|
|
305
|
+
protected roundClean(): void {
|
|
306
|
+
clean(SHA512_W_H, SHA512_W_L);
|
|
307
|
+
}
|
|
308
|
+
destroy(): void {
|
|
309
|
+
// HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves
|
|
310
|
+
// update()/digest() callable on reused instances.
|
|
311
|
+
this.destroyed = true;
|
|
312
|
+
clean(this.buffer);
|
|
313
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** Internal SHA-512 hash class grounded in RFC 6234 §6.3 and §6.4. */
|
|
318
|
+
export class _SHA512 extends SHA2_64B<_SHA512> {
|
|
319
|
+
protected Ah: number = SHA512_IV[0] | 0;
|
|
320
|
+
protected Al: number = SHA512_IV[1] | 0;
|
|
321
|
+
protected Bh: number = SHA512_IV[2] | 0;
|
|
322
|
+
protected Bl: number = SHA512_IV[3] | 0;
|
|
323
|
+
protected Ch: number = SHA512_IV[4] | 0;
|
|
324
|
+
protected Cl: number = SHA512_IV[5] | 0;
|
|
325
|
+
protected Dh: number = SHA512_IV[6] | 0;
|
|
326
|
+
protected Dl: number = SHA512_IV[7] | 0;
|
|
327
|
+
protected Eh: number = SHA512_IV[8] | 0;
|
|
328
|
+
protected El: number = SHA512_IV[9] | 0;
|
|
329
|
+
protected Fh: number = SHA512_IV[10] | 0;
|
|
330
|
+
protected Fl: number = SHA512_IV[11] | 0;
|
|
331
|
+
protected Gh: number = SHA512_IV[12] | 0;
|
|
332
|
+
protected Gl: number = SHA512_IV[13] | 0;
|
|
333
|
+
protected Hh: number = SHA512_IV[14] | 0;
|
|
334
|
+
protected Hl: number = SHA512_IV[15] | 0;
|
|
335
|
+
|
|
336
|
+
constructor() {
|
|
337
|
+
super(64);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Internal SHA-384 hash class grounded in RFC 6234 §6.3 and §6.4. */
|
|
342
|
+
export class _SHA384 extends SHA2_64B<_SHA384> {
|
|
343
|
+
protected Ah: number = SHA384_IV[0] | 0;
|
|
344
|
+
protected Al: number = SHA384_IV[1] | 0;
|
|
345
|
+
protected Bh: number = SHA384_IV[2] | 0;
|
|
346
|
+
protected Bl: number = SHA384_IV[3] | 0;
|
|
347
|
+
protected Ch: number = SHA384_IV[4] | 0;
|
|
348
|
+
protected Cl: number = SHA384_IV[5] | 0;
|
|
349
|
+
protected Dh: number = SHA384_IV[6] | 0;
|
|
350
|
+
protected Dl: number = SHA384_IV[7] | 0;
|
|
351
|
+
protected Eh: number = SHA384_IV[8] | 0;
|
|
352
|
+
protected El: number = SHA384_IV[9] | 0;
|
|
353
|
+
protected Fh: number = SHA384_IV[10] | 0;
|
|
354
|
+
protected Fl: number = SHA384_IV[11] | 0;
|
|
355
|
+
protected Gh: number = SHA384_IV[12] | 0;
|
|
356
|
+
protected Gl: number = SHA384_IV[13] | 0;
|
|
357
|
+
protected Hh: number = SHA384_IV[14] | 0;
|
|
358
|
+
protected Hl: number = SHA384_IV[15] | 0;
|
|
359
|
+
|
|
360
|
+
constructor() {
|
|
361
|
+
super(48);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Truncated SHA512/256 and SHA512/224.
|
|
367
|
+
* SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t.
|
|
368
|
+
* Then t hashes string to produce result IV.
|
|
369
|
+
* See the repo-side derivation recipe in `test/misc/sha2-gen-iv.js`.
|
|
370
|
+
* These IV literals are checked against that script rather than a dedicated
|
|
371
|
+
* local RFC section.
|
|
372
|
+
*/
|
|
373
|
+
|
|
374
|
+
/** SHA-512/224 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and
|
|
375
|
+
* stored as sixteen big-endian 32-bit halves. */
|
|
376
|
+
const T224_IV = /* @__PURE__ */ Uint32Array.from([
|
|
377
|
+
0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,
|
|
378
|
+
0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,
|
|
379
|
+
]);
|
|
380
|
+
|
|
381
|
+
/** SHA-512/256 IV derived by the SHA-512/t recipe in `test/misc/sha2-gen-iv.js` and
|
|
382
|
+
* stored as sixteen big-endian 32-bit halves. */
|
|
383
|
+
const T256_IV = /* @__PURE__ */ Uint32Array.from([
|
|
384
|
+
0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,
|
|
385
|
+
0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,
|
|
386
|
+
]);
|
|
387
|
+
|
|
388
|
+
/** Internal SHA-512/224 hash class using the derived `T224_IV` and the shared
|
|
389
|
+
* RFC 6234 §6.4 compression engine. */
|
|
390
|
+
export class _SHA512_224 extends SHA2_64B<_SHA512_224> {
|
|
391
|
+
protected Ah: number = T224_IV[0] | 0;
|
|
392
|
+
protected Al: number = T224_IV[1] | 0;
|
|
393
|
+
protected Bh: number = T224_IV[2] | 0;
|
|
394
|
+
protected Bl: number = T224_IV[3] | 0;
|
|
395
|
+
protected Ch: number = T224_IV[4] | 0;
|
|
396
|
+
protected Cl: number = T224_IV[5] | 0;
|
|
397
|
+
protected Dh: number = T224_IV[6] | 0;
|
|
398
|
+
protected Dl: number = T224_IV[7] | 0;
|
|
399
|
+
protected Eh: number = T224_IV[8] | 0;
|
|
400
|
+
protected El: number = T224_IV[9] | 0;
|
|
401
|
+
protected Fh: number = T224_IV[10] | 0;
|
|
402
|
+
protected Fl: number = T224_IV[11] | 0;
|
|
403
|
+
protected Gh: number = T224_IV[12] | 0;
|
|
404
|
+
protected Gl: number = T224_IV[13] | 0;
|
|
405
|
+
protected Hh: number = T224_IV[14] | 0;
|
|
406
|
+
protected Hl: number = T224_IV[15] | 0;
|
|
407
|
+
|
|
408
|
+
constructor() {
|
|
409
|
+
super(28);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** Internal SHA-512/256 hash class using the derived `T256_IV` and the shared
|
|
414
|
+
* RFC 6234 §6.4 compression engine. */
|
|
415
|
+
export class _SHA512_256 extends SHA2_64B<_SHA512_256> {
|
|
416
|
+
protected Ah: number = T256_IV[0] | 0;
|
|
417
|
+
protected Al: number = T256_IV[1] | 0;
|
|
418
|
+
protected Bh: number = T256_IV[2] | 0;
|
|
419
|
+
protected Bl: number = T256_IV[3] | 0;
|
|
420
|
+
protected Ch: number = T256_IV[4] | 0;
|
|
421
|
+
protected Cl: number = T256_IV[5] | 0;
|
|
422
|
+
protected Dh: number = T256_IV[6] | 0;
|
|
423
|
+
protected Dl: number = T256_IV[7] | 0;
|
|
424
|
+
protected Eh: number = T256_IV[8] | 0;
|
|
425
|
+
protected El: number = T256_IV[9] | 0;
|
|
426
|
+
protected Fh: number = T256_IV[10] | 0;
|
|
427
|
+
protected Fl: number = T256_IV[11] | 0;
|
|
428
|
+
protected Gh: number = T256_IV[12] | 0;
|
|
429
|
+
protected Gl: number = T256_IV[13] | 0;
|
|
430
|
+
protected Hh: number = T256_IV[14] | 0;
|
|
431
|
+
protected Hl: number = T256_IV[15] | 0;
|
|
432
|
+
|
|
433
|
+
constructor() {
|
|
434
|
+
super(32);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:
|
|
440
|
+
*
|
|
441
|
+
* - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.
|
|
442
|
+
* - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.
|
|
443
|
+
* - Each sha256 hash is executing 2^18 bit operations.
|
|
444
|
+
* - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.
|
|
445
|
+
* @param msg - message bytes to hash
|
|
446
|
+
* @returns Digest bytes.
|
|
447
|
+
* @example
|
|
448
|
+
* Hash a message with SHA2-256.
|
|
449
|
+
* ```ts
|
|
450
|
+
* sha256(new Uint8Array([97, 98, 99]));
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
export const sha256: TRet<CHash<_SHA256>> = /* @__PURE__ */ createHasher(
|
|
454
|
+
() => new _SHA256(),
|
|
455
|
+
/* @__PURE__ */ oidNist(0x01)
|
|
456
|
+
);
|
|
457
|
+
/**
|
|
458
|
+
* SHA2-224 hash function from RFC 4634.
|
|
459
|
+
* @param msg - message bytes to hash
|
|
460
|
+
* @returns Digest bytes.
|
|
461
|
+
* @example
|
|
462
|
+
* Hash a message with SHA2-224.
|
|
463
|
+
* ```ts
|
|
464
|
+
* sha224(new Uint8Array([97, 98, 99]));
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
export const sha224: TRet<CHash<_SHA224>> = /* @__PURE__ */ createHasher(
|
|
468
|
+
() => new _SHA224(),
|
|
469
|
+
/* @__PURE__ */ oidNist(0x04)
|
|
470
|
+
);
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* SHA2-512 hash function from RFC 4634.
|
|
474
|
+
* @param msg - message bytes to hash
|
|
475
|
+
* @returns Digest bytes.
|
|
476
|
+
* @example
|
|
477
|
+
* Hash a message with SHA2-512.
|
|
478
|
+
* ```ts
|
|
479
|
+
* sha512(new Uint8Array([97, 98, 99]));
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
export const sha512: TRet<CHash<_SHA512>> = /* @__PURE__ */ createHasher(
|
|
483
|
+
() => new _SHA512(),
|
|
484
|
+
/* @__PURE__ */ oidNist(0x03)
|
|
485
|
+
);
|
|
486
|
+
/**
|
|
487
|
+
* SHA2-384 hash function from RFC 4634.
|
|
488
|
+
* @param msg - message bytes to hash
|
|
489
|
+
* @returns Digest bytes.
|
|
490
|
+
* @example
|
|
491
|
+
* Hash a message with SHA2-384.
|
|
492
|
+
* ```ts
|
|
493
|
+
* sha384(new Uint8Array([97, 98, 99]));
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
export const sha384: TRet<CHash<_SHA384>> = /* @__PURE__ */ createHasher(
|
|
497
|
+
() => new _SHA384(),
|
|
498
|
+
/* @__PURE__ */ oidNist(0x02)
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks.
|
|
503
|
+
* See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.
|
|
504
|
+
* @param msg - message bytes to hash
|
|
505
|
+
* @returns Digest bytes.
|
|
506
|
+
* @example
|
|
507
|
+
* Hash a message with SHA2-512/256.
|
|
508
|
+
* ```ts
|
|
509
|
+
* sha512_256(new Uint8Array([97, 98, 99]));
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
512
|
+
export const sha512_256: TRet<CHash<_SHA512_256>> = /* @__PURE__ */ createHasher(
|
|
513
|
+
() => new _SHA512_256(),
|
|
514
|
+
/* @__PURE__ */ oidNist(0x06)
|
|
515
|
+
);
|
|
516
|
+
/**
|
|
517
|
+
* SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks.
|
|
518
|
+
* See the paper on {@link https://eprint.iacr.org/2010/548.pdf | truncated SHA512}.
|
|
519
|
+
* @param msg - message bytes to hash
|
|
520
|
+
* @returns Digest bytes.
|
|
521
|
+
* @example
|
|
522
|
+
* Hash a message with SHA2-512/224.
|
|
523
|
+
* ```ts
|
|
524
|
+
* sha512_224(new Uint8Array([97, 98, 99]));
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
export const sha512_224: TRet<CHash<_SHA512_224>> = /* @__PURE__ */ createHasher(
|
|
528
|
+
() => new _SHA512_224(),
|
|
529
|
+
/* @__PURE__ */ oidNist(0x05)
|
|
530
|
+
);
|