@awacloud/fw 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/CHANGELOG.md +79 -0
- package/LICENSE +176 -0
- package/NOTICE +12 -0
- package/README.md +355 -0
- package/dist/build/fw.core.pure.meta.json +29 -0
- package/dist/build/fw.core.pure.min.js +26 -0
- package/dist/build/fw.full.pure.meta.json +224 -0
- package/dist/build/fw.full.pure.min.js +60 -0
- package/dist/build/fw.minimal.pure.meta.json +21 -0
- package/dist/build/fw.minimal.pure.min.js +26 -0
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +29 -0
- package/dist/build/fw.pack.compress-heavy.pure.min.js +8 -0
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +38 -0
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +6 -0
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +29 -0
- package/dist/build/fw.pack.crypto-basic.pure.min.js +6 -0
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +29 -0
- package/dist/build/fw.pack.crypto-identity.pure.min.js +9 -0
- package/dist/build/fw.pack.realtime.pure.meta.json +21 -0
- package/dist/build/fw.pack.realtime.pure.min.js +6 -0
- package/dist/build/fw.pack.sensors.pure.meta.json +21 -0
- package/dist/build/fw.pack.sensors.pure.min.js +6 -0
- package/dist/build/fw.pack.structures-advanced.pure.meta.json +20 -0
- package/dist/build/fw.pack.structures-advanced.pure.min.js +6 -0
- package/dist/build/fw.pack.text-advanced.pure.meta.json +20 -0
- package/dist/build/fw.pack.text-advanced.pure.min.js +6 -0
- package/dist/build/fw.pwa.pure.meta.json +127 -0
- package/dist/build/fw.pwa.pure.min.js +55 -0
- package/dist/build/fw.site-interactive.pure.meta.json +81 -0
- package/dist/build/fw.site-interactive.pure.min.js +52 -0
- package/dist/build/fw.site.pure.meta.json +51 -0
- package/dist/build/fw.site.pure.min.js +35 -0
- package/dist/build/fw.spa.pure.meta.json +108 -0
- package/dist/build/fw.spa.pure.min.js +55 -0
- package/dist/build/io/compress/brotli_dict.bin +432 -0
- package/dist/build/sanity-base-classic.min.js +6 -0
- package/dist/build/sanity-community-classic.min.js +6 -0
- package/dist/build/sanity.min.js +6 -0
- package/dist/types/core/logger.d.ts +71 -0
- package/dist/types/core/logger.d.ts.map +1 -0
- package/dist/types/core/modules.d.ts +3962 -0
- package/dist/types/core/modules.d.ts.map +1 -0
- package/dist/types/core/readyState.d.ts +14 -0
- package/dist/types/core/readyState.d.ts.map +1 -0
- package/dist/types/core/runtime.d.ts +625 -0
- package/dist/types/core/runtime.d.ts.map +1 -0
- package/dist/types/core/worker-helper.d.ts +153 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -0
- package/dist/types/crypto/cipher/aes.d.ts +55 -0
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -0
- package/dist/types/crypto/cipher/chacha20.d.ts +33 -0
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -0
- package/dist/types/crypto/hash/adf.d.ts +65 -0
- package/dist/types/crypto/hash/adf.d.ts.map +1 -0
- package/dist/types/crypto/hash/argon2.d.ts +79 -0
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -0
- package/dist/types/crypto/hash/blake2b.d.ts +40 -0
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -0
- package/dist/types/crypto/hash/hkdf.d.ts +88 -0
- package/dist/types/crypto/hash/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/hash/hmac.d.ts +85 -0
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -0
- package/dist/types/crypto/hash/pbkdf2.d.ts +80 -0
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/hash/poly1305.d.ts +31 -0
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha224.d.ts +80 -0
- package/dist/types/crypto/hash/sha224.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha256.d.ts +82 -0
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha3.d.ts +111 -0
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha384.d.ts +84 -0
- package/dist/types/crypto/hash/sha384.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512.d.ts +87 -0
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512_224.d.ts +84 -0
- package/dist/types/crypto/hash/sha512_224.d.ts.map +1 -0
- package/dist/types/crypto/hash/sha512_256.d.ts +84 -0
- package/dist/types/crypto/hash/sha512_256.d.ts.map +1 -0
- package/dist/types/crypto/mode/cbc.d.ts +38 -0
- package/dist/types/crypto/mode/cbc.d.ts.map +1 -0
- package/dist/types/crypto/mode/chacha20poly1305.d.ts +71 -0
- package/dist/types/crypto/mode/chacha20poly1305.d.ts.map +1 -0
- package/dist/types/crypto/mode/cmac.d.ts +56 -0
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -0
- package/dist/types/crypto/mode/ctr.d.ts +52 -0
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -0
- package/dist/types/crypto/mode/gcm.d.ts +88 -0
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -0
- package/dist/types/crypto/mode/kw.d.ts +60 -0
- package/dist/types/crypto/mode/kw.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ecc.d.ts +284 -0
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ed25519.d.ts +107 -0
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/pkc/hybridKem.d.ts +154 -0
- package/dist/types/crypto/pkc/hybridKem.d.ts.map +1 -0
- package/dist/types/crypto/pkc/hybridSign.d.ts +383 -0
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ml_dsa.d.ts +174 -0
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/ml_kem.d.ts +194 -0
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -0
- package/dist/types/crypto/pkc/rsa.d.ts +175 -0
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/slh_dsa.d.ts +232 -0
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -0
- package/dist/types/crypto/pkc/x25519.d.ts +37 -0
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -0
- package/dist/types/crypto/utils/aes_ctr.d.ts +84 -0
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +1 -0
- package/dist/types/crypto/utils/aes_modes.d.ts +128 -0
- package/dist/types/crypto/utils/aes_modes.d.ts.map +1 -0
- package/dist/types/crypto/utils/asn1-oid.d.ts +45 -0
- package/dist/types/crypto/utils/asn1-oid.d.ts.map +1 -0
- package/dist/types/crypto/utils/asn1.d.ts +115 -0
- package/dist/types/crypto/utils/asn1.d.ts.map +1 -0
- package/dist/types/crypto/utils/bitArray.d.ts +75 -0
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -0
- package/dist/types/crypto/utils/bn.d.ts +214 -0
- package/dist/types/crypto/utils/bn.d.ts.map +1 -0
- package/dist/types/crypto/utils/jws.d.ts +159 -0
- package/dist/types/crypto/utils/jws.d.ts.map +1 -0
- package/dist/types/crypto/utils/keyformat.d.ts +100 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -0
- package/dist/types/crypto/utils/pad.d.ts +44 -0
- package/dist/types/crypto/utils/pad.d.ts.map +1 -0
- package/dist/types/crypto/utils/pem.d.ts +41 -0
- package/dist/types/crypto/utils/pem.d.ts.map +1 -0
- package/dist/types/crypto/utils/random.d.ts +203 -0
- package/dist/types/crypto/utils/random.d.ts.map +1 -0
- package/dist/types/crypto/utils/rsaKeygen.d.ts +162 -0
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -0
- package/dist/types/crypto/utils/totp.d.ts +183 -0
- package/dist/types/crypto/utils/totp.d.ts.map +1 -0
- package/dist/types/crypto/utils/uuid.d.ts +29 -0
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -0
- package/dist/types/crypto/wasm/aes.d.ts +59 -0
- package/dist/types/crypto/wasm/aes.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +70 -0
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/blake2b.d.ts +59 -0
- package/dist/types/crypto/wasm/blake2b.d.ts.map +1 -0
- package/dist/types/crypto/wasm/chacha20poly1305.d.ts +43 -0
- package/dist/types/crypto/wasm/chacha20poly1305.d.ts.map +1 -0
- package/dist/types/crypto/wasm/cmac.d.ts +42 -0
- package/dist/types/crypto/wasm/cmac.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ecc.d.ts +56 -0
- package/dist/types/crypto/wasm/ecc.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ed25519.d.ts +52 -0
- package/dist/types/crypto/wasm/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/wasm/hkdf.d.ts +40 -0
- package/dist/types/crypto/wasm/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/wasm/hmac.d.ts +42 -0
- package/dist/types/crypto/wasm/hmac.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ml_dsa.d.ts +48 -0
- package/dist/types/crypto/wasm/ml_dsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/ml_kem.d.ts +58 -0
- package/dist/types/crypto/wasm/ml_kem.d.ts.map +1 -0
- package/dist/types/crypto/wasm/pbkdf2.d.ts +38 -0
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/rsa.d.ts +56 -0
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/runtime.d.ts +99 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -0
- package/dist/types/crypto/wasm/sha2.d.ts +45 -0
- package/dist/types/crypto/wasm/sha2.d.ts.map +1 -0
- package/dist/types/crypto/wasm/sha3.d.ts +57 -0
- package/dist/types/crypto/wasm/sha3.d.ts.map +1 -0
- package/dist/types/crypto/wasm/slh_dsa.d.ts +62 -0
- package/dist/types/crypto/wasm/slh_dsa.d.ts.map +1 -0
- package/dist/types/crypto/wasm/x25519.d.ts +53 -0
- package/dist/types/crypto/wasm/x25519.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/aes.d.ts +59 -0
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/aeskw.d.ts +40 -0
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/digest.d.ts +43 -0
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/ecc.d.ts +51 -0
- package/dist/types/crypto/webcrypto/ecc.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/ed25519.d.ts +43 -0
- package/dist/types/crypto/webcrypto/ed25519.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/hkdf.d.ts +18 -0
- package/dist/types/crypto/webcrypto/hkdf.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/hmac.d.ts +43 -0
- package/dist/types/crypto/webcrypto/hmac.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/pbkdf2.d.ts +18 -0
- package/dist/types/crypto/webcrypto/pbkdf2.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/rsa.d.ts +51 -0
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -0
- package/dist/types/crypto/webcrypto/x25519.d.ts +43 -0
- package/dist/types/crypto/webcrypto/x25519.d.ts.map +1 -0
- package/dist/types/dom/display/animate.d.ts +35 -0
- package/dist/types/dom/display/animate.d.ts.map +1 -0
- package/dist/types/dom/display/fullscreen.d.ts +59 -0
- package/dist/types/dom/display/fullscreen.d.ts.map +1 -0
- package/dist/types/dom/fs/download.d.ts +36 -0
- package/dist/types/dom/fs/download.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts +107 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -0
- package/dist/types/dom/fs/indexedDB.d.ts +62 -0
- package/dist/types/dom/fs/indexedDB.d.ts.map +1 -0
- package/dist/types/dom/fs/remoteStore.d.ts +64 -0
- package/dist/types/dom/fs/remoteStore.d.ts.map +1 -0
- package/dist/types/dom/fs/storage.d.ts +56 -0
- package/dist/types/dom/fs/storage.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/idle.d.ts +91 -0
- package/dist/types/dom/lifecycle/idle.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/visibility.d.ts +49 -0
- package/dist/types/dom/lifecycle/visibility.d.ts.map +1 -0
- package/dist/types/dom/lifecycle/wakeLock.d.ts +69 -0
- package/dist/types/dom/lifecycle/wakeLock.d.ts.map +1 -0
- package/dist/types/dom/net/ajax.d.ts +27 -0
- package/dist/types/dom/net/ajax.d.ts.map +1 -0
- package/dist/types/dom/net/broadcastChannel.d.ts +51 -0
- package/dist/types/dom/net/broadcastChannel.d.ts.map +1 -0
- package/dist/types/dom/net/network.d.ts +80 -0
- package/dist/types/dom/net/network.d.ts.map +1 -0
- package/dist/types/dom/net/sse.d.ts +72 -0
- package/dist/types/dom/net/sse.d.ts.map +1 -0
- package/dist/types/dom/net/webrtc.d.ts +149 -0
- package/dist/types/dom/net/webrtc.d.ts.map +1 -0
- package/dist/types/dom/net/ws.d.ts +70 -0
- package/dist/types/dom/net/ws.d.ts.map +1 -0
- package/dist/types/dom/query/dnd.d.ts +86 -0
- package/dist/types/dom/query/dnd.d.ts.map +1 -0
- package/dist/types/dom/query/dom.d.ts +194 -0
- package/dist/types/dom/query/dom.d.ts.map +1 -0
- package/dist/types/dom/query/events.d.ts +135 -0
- package/dist/types/dom/query/events.d.ts.map +1 -0
- package/dist/types/dom/query/gesture.d.ts +59 -0
- package/dist/types/dom/query/gesture.d.ts.map +1 -0
- package/dist/types/dom/query/media.d.ts +156 -0
- package/dist/types/dom/query/media.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts +143 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -0
- package/dist/types/dom/rendering/component.d.ts +92 -0
- package/dist/types/dom/rendering/component.d.ts.map +1 -0
- package/dist/types/dom/rendering/devtools-ui.d.ts +83 -0
- package/dist/types/dom/rendering/devtools-ui.d.ts.map +1 -0
- package/dist/types/dom/rendering/devtools.d.ts +68 -0
- package/dist/types/dom/rendering/devtools.d.ts.map +1 -0
- package/dist/types/dom/rendering/parser.d.ts +216 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -0
- package/dist/types/dom/rendering/reactiveBind.d.ts +101 -0
- package/dist/types/dom/rendering/reactiveBind.d.ts.map +1 -0
- package/dist/types/dom/rendering/render.d.ts +121 -0
- package/dist/types/dom/rendering/render.d.ts.map +1 -0
- package/dist/types/dom/rendering/sanitize.d.ts +48 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -0
- package/dist/types/dom/rendering/secPolicy.d.ts +89 -0
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +251 -0
- package/dist/types/dom/rendering/template.d.ts.map +1 -0
- package/dist/types/dom/rendering/themeTokens.d.ts +61 -0
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-core.d.ts +192 -0
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-direct.d.ts +63 -0
- package/dist/types/dom/rendering/uiSession-direct.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession-list.d.ts +205 -0
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -0
- package/dist/types/dom/rendering/uiSession.d.ts +285 -0
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -0
- package/dist/types/dom/rendering/virtualScroll.d.ts +80 -0
- package/dist/types/dom/rendering/virtualScroll.d.ts.map +1 -0
- package/dist/types/dom/sensors/battery.d.ts +71 -0
- package/dist/types/dom/sensors/battery.d.ts.map +1 -0
- package/dist/types/dom/sensors/geolocation.d.ts +83 -0
- package/dist/types/dom/sensors/geolocation.d.ts.map +1 -0
- package/dist/types/dom/sensors/networkInfo.d.ts +82 -0
- package/dist/types/dom/sensors/networkInfo.d.ts.map +1 -0
- package/dist/types/dom/sensors/sensors.d.ts +191 -0
- package/dist/types/dom/sensors/sensors.d.ts.map +1 -0
- package/dist/types/dom/sw/backgroundSync.d.ts +48 -0
- package/dist/types/dom/sw/backgroundSync.d.ts.map +1 -0
- package/dist/types/dom/sw/cache.d.ts +71 -0
- package/dist/types/dom/sw/cache.d.ts.map +1 -0
- package/dist/types/dom/sw/push.d.ts +77 -0
- package/dist/types/dom/sw/push.d.ts.map +1 -0
- package/dist/types/dom/sw/serviceWorker.d.ts +57 -0
- package/dist/types/dom/sw/serviceWorker.d.ts.map +1 -0
- package/dist/types/dom/sw/sharedWorker.d.ts +81 -0
- package/dist/types/dom/sw/sharedWorker.d.ts.map +1 -0
- package/dist/types/dom/utils/a11y.d.ts +53 -0
- package/dist/types/dom/utils/a11y.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +44 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -0
- package/dist/types/dom/utils/entropyCollector.d.ts +58 -0
- package/dist/types/dom/utils/entropyCollector.d.ts.map +1 -0
- package/dist/types/dom/utils/focus.d.ts +123 -0
- package/dist/types/dom/utils/focus.d.ts.map +1 -0
- package/dist/types/dom/utils/form.d.ts +227 -0
- package/dist/types/dom/utils/form.d.ts.map +1 -0
- package/dist/types/dom/utils/formKit.d.ts +206 -0
- package/dist/types/dom/utils/formKit.d.ts.map +1 -0
- package/dist/types/dom/utils/keybindings.d.ts +53 -0
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -0
- package/dist/types/dom/utils/leaderElection.d.ts +70 -0
- package/dist/types/dom/utils/leaderElection.d.ts.map +1 -0
- package/dist/types/dom/utils/notifications.d.ts +164 -0
- package/dist/types/dom/utils/notifications.d.ts.map +1 -0
- package/dist/types/dom/utils/permissions.d.ts +35 -0
- package/dist/types/dom/utils/permissions.d.ts.map +1 -0
- package/dist/types/dom/utils/route.d.ts +117 -0
- package/dist/types/dom/utils/route.d.ts.map +1 -0
- package/dist/types/dom/utils/ua.d.ts +35 -0
- package/dist/types/dom/utils/ua.d.ts.map +1 -0
- package/dist/types/dom/utils/webauthn.d.ts +98 -0
- package/dist/types/dom/utils/webauthn.d.ts.map +1 -0
- package/dist/types/io/binary/reader.d.ts +59 -0
- package/dist/types/io/binary/reader.d.ts.map +1 -0
- package/dist/types/io/binary/writer.d.ts +56 -0
- package/dist/types/io/binary/writer.d.ts.map +1 -0
- package/dist/types/io/calc/adler32.d.ts +31 -0
- package/dist/types/io/calc/adler32.d.ts.map +1 -0
- package/dist/types/io/calc/bigint.d.ts +74 -0
- package/dist/types/io/calc/bigint.d.ts.map +1 -0
- package/dist/types/io/calc/crc32.d.ts +36 -0
- package/dist/types/io/calc/crc32.d.ts.map +1 -0
- package/dist/types/io/calc/easing.d.ts +60 -0
- package/dist/types/io/calc/easing.d.ts.map +1 -0
- package/dist/types/io/codec/b64.d.ts +28 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -0
- package/dist/types/io/codec/base32.d.ts +28 -0
- package/dist/types/io/codec/base32.d.ts.map +1 -0
- package/dist/types/io/codec/base58.d.ts +28 -0
- package/dist/types/io/codec/base58.d.ts.map +1 -0
- package/dist/types/io/codec/buffer.d.ts +66 -0
- package/dist/types/io/codec/buffer.d.ts.map +1 -0
- package/dist/types/io/codec/cbor.d.ts +43 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -0
- package/dist/types/io/codec/csv.d.ts +35 -0
- package/dist/types/io/codec/csv.d.ts.map +1 -0
- package/dist/types/io/codec/hex.d.ts +28 -0
- package/dist/types/io/codec/hex.d.ts.map +1 -0
- package/dist/types/io/codec/mime.d.ts +100 -0
- package/dist/types/io/codec/mime.d.ts.map +1 -0
- package/dist/types/io/codec/msgpack.d.ts +36 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -0
- package/dist/types/io/codec/url.d.ts +52 -0
- package/dist/types/io/codec/url.d.ts.map +1 -0
- package/dist/types/io/codec/utf8.d.ts +22 -0
- package/dist/types/io/codec/utf8.d.ts.map +1 -0
- package/dist/types/io/codec/xml.d.ts +91 -0
- package/dist/types/io/codec/xml.d.ts.map +1 -0
- package/dist/types/io/compress/bitstream.d.ts +51 -0
- package/dist/types/io/compress/bitstream.d.ts.map +1 -0
- package/dist/types/io/compress/brotli.d.ts +86 -0
- package/dist/types/io/compress/brotli.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_dict.d.ts +76 -0
- package/dist/types/io/compress/brotli_dict.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_dict_words.d.ts +43 -0
- package/dist/types/io/compress/brotli_dict_words.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_frame.d.ts +166 -0
- package/dist/types/io/compress/brotli_frame.d.ts.map +1 -0
- package/dist/types/io/compress/brotli_shared.d.ts +165 -0
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -0
- package/dist/types/io/compress/deflate.d.ts +89 -0
- package/dist/types/io/compress/deflate.d.ts.map +1 -0
- package/dist/types/io/compress/gzip.d.ts +100 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -0
- package/dist/types/io/compress/huffman.d.ts +37 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -0
- package/dist/types/io/compress/lz4.d.ts +45 -0
- package/dist/types/io/compress/lz4.d.ts.map +1 -0
- package/dist/types/io/compress/lz77.d.ts +66 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -0
- package/dist/types/io/compress/lzw.d.ts +37 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -0
- package/dist/types/io/compress/zip.d.ts +112 -0
- package/dist/types/io/compress/zip.d.ts.map +1 -0
- package/dist/types/io/compress/zlib.d.ts +97 -0
- package/dist/types/io/compress/zlib.d.ts.map +1 -0
- package/dist/types/io/i18n/i18n.d.ts +64 -0
- package/dist/types/io/i18n/i18n.d.ts.map +1 -0
- package/dist/types/io/math/fixed-point.d.ts +30 -0
- package/dist/types/io/math/fixed-point.d.ts.map +1 -0
- package/dist/types/io/math/geom.d.ts +125 -0
- package/dist/types/io/math/geom.d.ts.map +1 -0
- package/dist/types/io/math/interp.d.ts +48 -0
- package/dist/types/io/math/interp.d.ts.map +1 -0
- package/dist/types/io/math/linalg.d.ts +117 -0
- package/dist/types/io/math/linalg.d.ts.map +1 -0
- package/dist/types/io/math/stats.d.ts +45 -0
- package/dist/types/io/math/stats.d.ts.map +1 -0
- package/dist/types/io/structures/btree.d.ts +84 -0
- package/dist/types/io/structures/btree.d.ts.map +1 -0
- package/dist/types/io/structures/heap.d.ts +75 -0
- package/dist/types/io/structures/heap.d.ts.map +1 -0
- package/dist/types/io/structures/lruCache.d.ts +88 -0
- package/dist/types/io/structures/lruCache.d.ts.map +1 -0
- package/dist/types/io/structures/ringBuffer.d.ts +82 -0
- package/dist/types/io/structures/ringBuffer.d.ts.map +1 -0
- package/dist/types/io/structures/tree-walker.d.ts +95 -0
- package/dist/types/io/structures/tree-walker.d.ts.map +1 -0
- package/dist/types/io/structures/trie.d.ts +71 -0
- package/dist/types/io/structures/trie.d.ts.map +1 -0
- package/dist/types/io/sync/abort.d.ts +59 -0
- package/dist/types/io/sync/abort.d.ts.map +1 -0
- package/dist/types/io/sync/atomics.d.ts +107 -0
- package/dist/types/io/sync/atomics.d.ts.map +1 -0
- package/dist/types/io/sync/cancellable.d.ts +69 -0
- package/dist/types/io/sync/cancellable.d.ts.map +1 -0
- package/dist/types/io/sync/channel.d.ts +70 -0
- package/dist/types/io/sync/channel.d.ts.map +1 -0
- package/dist/types/io/sync/mutex.d.ts +39 -0
- package/dist/types/io/sync/mutex.d.ts.map +1 -0
- package/dist/types/io/sync/semaphore.d.ts +40 -0
- package/dist/types/io/sync/semaphore.d.ts.map +1 -0
- package/dist/types/io/sync/tokenBucket.d.ts +53 -0
- package/dist/types/io/sync/tokenBucket.d.ts.map +1 -0
- package/dist/types/io/text/ansi.d.ts +125 -0
- package/dist/types/io/text/ansi.d.ts.map +1 -0
- package/dist/types/io/text/html-entities.d.ts +35 -0
- package/dist/types/io/text/html-entities.d.ts.map +1 -0
- package/dist/types/io/text/semver.d.ts +75 -0
- package/dist/types/io/text/semver.d.ts.map +1 -0
- package/dist/types/io/text/str.d.ts +88 -0
- package/dist/types/io/text/str.d.ts.map +1 -0
- package/dist/types/io/text/unicode.d.ts +70 -0
- package/dist/types/io/text/unicode.d.ts.map +1 -0
- package/dist/types/io/time/date.d.ts +73 -0
- package/dist/types/io/time/date.d.ts.map +1 -0
- package/dist/types/io/timing/clock.d.ts +39 -0
- package/dist/types/io/timing/clock.d.ts.map +1 -0
- package/dist/types/io/timing/rateLimit.d.ts +40 -0
- package/dist/types/io/timing/rateLimit.d.ts.map +1 -0
- package/dist/types/io/timing/scheduler.d.ts +122 -0
- package/dist/types/io/timing/scheduler.d.ts.map +1 -0
- package/dist/types/io/utils/bitmap.d.ts +34 -0
- package/dist/types/io/utils/bitmap.d.ts.map +1 -0
- package/dist/types/io/utils/errors.d.ts +94 -0
- package/dist/types/io/utils/errors.d.ts.map +1 -0
- package/dist/types/io/utils/eventBus.d.ts +68 -0
- package/dist/types/io/utils/eventBus.d.ts.map +1 -0
- package/dist/types/io/utils/queue.d.ts +69 -0
- package/dist/types/io/utils/queue.d.ts.map +1 -0
- package/dist/types/io/utils/signal.d.ts +362 -0
- package/dist/types/io/utils/signal.d.ts.map +1 -0
- package/dist/types/io/utils/ui8.d.ts +34 -0
- package/dist/types/io/utils/ui8.d.ts.map +1 -0
- package/dist/types/io/utils/valid.d.ts +130 -0
- package/dist/types/io/utils/valid.d.ts.map +1 -0
- package/dist/types/main.d.ts +25 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/process/message.d.ts +64 -0
- package/dist/types/process/message.d.ts.map +1 -0
- package/dist/types/process/rpc.d.ts +35 -0
- package/dist/types/process/rpc.d.ts.map +1 -0
- package/dist/types/process/workerPool.d.ts +62 -0
- package/dist/types/process/workerPool.d.ts.map +1 -0
- package/dist/types/sanity/base.d.ts +28 -0
- package/dist/types/sanity/base.d.ts.map +1 -0
- package/dist/types/sanity/community.d.ts +20 -0
- package/dist/types/sanity/community.d.ts.map +1 -0
- package/dist/types/sanity/lockdown-apply.d.ts +7 -0
- package/dist/types/sanity/lockdown-apply.d.ts.map +1 -0
- package/dist/types/sanity/lockdown.d.ts +43 -0
- package/dist/types/sanity/lockdown.d.ts.map +1 -0
- package/dist/types/sanity/wasm-gate.d.ts +128 -0
- package/dist/types/sanity/wasm-gate.d.ts.map +1 -0
- package/docs/README.md +301 -0
- package/docs/api/README.md +33 -0
- package/docs/api/core/README.md +14 -0
- package/docs/api/core/logger.md +151 -0
- package/docs/api/core/main.md +105 -0
- package/docs/api/core/modules.md +123 -0
- package/docs/api/core/readyState.md +94 -0
- package/docs/api/core/runtime.md +499 -0
- package/docs/api/core/worker-helper.md +180 -0
- package/docs/api/crypto/README.md +39 -0
- package/docs/api/crypto/cipher/README.md +24 -0
- package/docs/api/crypto/cipher/aes.md +101 -0
- package/docs/api/crypto/cipher/chacha20.md +85 -0
- package/docs/api/crypto/hash/README.md +49 -0
- package/docs/api/crypto/hash/adf.md +61 -0
- package/docs/api/crypto/hash/argon2.md +92 -0
- package/docs/api/crypto/hash/blake2b.md +88 -0
- package/docs/api/crypto/hash/hkdf.md +82 -0
- package/docs/api/crypto/hash/hmac.md +90 -0
- package/docs/api/crypto/hash/pbkdf2.md +93 -0
- package/docs/api/crypto/hash/poly1305.md +71 -0
- package/docs/api/crypto/hash/sha224.md +61 -0
- package/docs/api/crypto/hash/sha256.md +84 -0
- package/docs/api/crypto/hash/sha3.md +89 -0
- package/docs/api/crypto/hash/sha384.md +58 -0
- package/docs/api/crypto/hash/sha512.md +73 -0
- package/docs/api/crypto/hash/sha512_224.md +59 -0
- package/docs/api/crypto/hash/sha512_256.md +58 -0
- package/docs/api/crypto/mode/README.md +33 -0
- package/docs/api/crypto/mode/cbc.md +69 -0
- package/docs/api/crypto/mode/chacha20poly1305.md +77 -0
- package/docs/api/crypto/mode/cmac.md +79 -0
- package/docs/api/crypto/mode/ctr.md +66 -0
- package/docs/api/crypto/mode/gcm.md +93 -0
- package/docs/api/crypto/mode/kw.md +84 -0
- package/docs/api/crypto/pkc/README.md +48 -0
- package/docs/api/crypto/pkc/ecc.md +91 -0
- package/docs/api/crypto/pkc/ed25519.md +99 -0
- package/docs/api/crypto/pkc/hybridKem.md +178 -0
- package/docs/api/crypto/pkc/hybridSign.md +192 -0
- package/docs/api/crypto/pkc/ml_dsa.md +99 -0
- package/docs/api/crypto/pkc/ml_kem.md +90 -0
- package/docs/api/crypto/pkc/rsa.md +87 -0
- package/docs/api/crypto/pkc/slh_dsa.md +86 -0
- package/docs/api/crypto/pkc/x25519.md +84 -0
- package/docs/api/crypto/utils/README.md +39 -0
- package/docs/api/crypto/utils/aes_ctr.md +71 -0
- package/docs/api/crypto/utils/aes_modes.md +81 -0
- package/docs/api/crypto/utils/asn1-oid.md +130 -0
- package/docs/api/crypto/utils/asn1.md +69 -0
- package/docs/api/crypto/utils/bitArray.md +77 -0
- package/docs/api/crypto/utils/bn.md +67 -0
- package/docs/api/crypto/utils/jws.md +94 -0
- package/docs/api/crypto/utils/keyformat.md +78 -0
- package/docs/api/crypto/utils/pad.md +66 -0
- package/docs/api/crypto/utils/pem.md +63 -0
- package/docs/api/crypto/utils/random.md +103 -0
- package/docs/api/crypto/utils/rsaKeygen.md +118 -0
- package/docs/api/crypto/utils/totp.md +159 -0
- package/docs/api/crypto/utils/uuid.md +98 -0
- package/docs/api/crypto/wasm/README.md +76 -0
- package/docs/api/crypto/wasm/aes.md +128 -0
- package/docs/api/crypto/wasm/argon2.md +110 -0
- package/docs/api/crypto/wasm/blake2b.md +103 -0
- package/docs/api/crypto/wasm/chacha20poly1305.md +120 -0
- package/docs/api/crypto/wasm/cmac.md +119 -0
- package/docs/api/crypto/wasm/ecc.md +114 -0
- package/docs/api/crypto/wasm/ed25519.md +117 -0
- package/docs/api/crypto/wasm/hkdf.md +163 -0
- package/docs/api/crypto/wasm/hmac.md +129 -0
- package/docs/api/crypto/wasm/ml_dsa.md +99 -0
- package/docs/api/crypto/wasm/ml_kem.md +91 -0
- package/docs/api/crypto/wasm/pbkdf2.md +111 -0
- package/docs/api/crypto/wasm/rsa.md +113 -0
- package/docs/api/crypto/wasm/runtime.md +172 -0
- package/docs/api/crypto/wasm/sha2.md +95 -0
- package/docs/api/crypto/wasm/sha3.md +127 -0
- package/docs/api/crypto/wasm/slh_dsa.md +89 -0
- package/docs/api/crypto/wasm/x25519.md +116 -0
- package/docs/api/crypto/webcrypto/README.md +56 -0
- package/docs/api/crypto/webcrypto/aes.md +140 -0
- package/docs/api/crypto/webcrypto/aeskw.md +120 -0
- package/docs/api/crypto/webcrypto/digest.md +103 -0
- package/docs/api/crypto/webcrypto/ecc.md +122 -0
- package/docs/api/crypto/webcrypto/ed25519.md +121 -0
- package/docs/api/crypto/webcrypto/hkdf.md +141 -0
- package/docs/api/crypto/webcrypto/hmac.md +112 -0
- package/docs/api/crypto/webcrypto/pbkdf2.md +140 -0
- package/docs/api/crypto/webcrypto/rsa.md +149 -0
- package/docs/api/crypto/webcrypto/x25519.md +96 -0
- package/docs/api/dom/README.md +117 -0
- package/docs/api/dom/display/README.md +27 -0
- package/docs/api/dom/display/animate.md +113 -0
- package/docs/api/dom/display/fullscreen.md +121 -0
- package/docs/api/dom/fs/README.md +36 -0
- package/docs/api/dom/fs/download.md +108 -0
- package/docs/api/dom/fs/fsAccess.md +200 -0
- package/docs/api/dom/fs/indexedDB.md +219 -0
- package/docs/api/dom/fs/remoteStore.md +158 -0
- package/docs/api/dom/fs/storage.md +197 -0
- package/docs/api/dom/lifecycle/README.md +11 -0
- package/docs/api/dom/lifecycle/idle.md +89 -0
- package/docs/api/dom/lifecycle/visibility.md +73 -0
- package/docs/api/dom/lifecycle/wakeLock.md +94 -0
- package/docs/api/dom/net/README.md +31 -0
- package/docs/api/dom/net/ajax.md +176 -0
- package/docs/api/dom/net/broadcastChannel.md +110 -0
- package/docs/api/dom/net/network.md +137 -0
- package/docs/api/dom/net/sse.md +141 -0
- package/docs/api/dom/net/webrtc.md +158 -0
- package/docs/api/dom/net/ws.md +168 -0
- package/docs/api/dom/query/README.md +30 -0
- package/docs/api/dom/query/dnd.md +137 -0
- package/docs/api/dom/query/dom.md +275 -0
- package/docs/api/dom/query/events.md +211 -0
- package/docs/api/dom/query/gesture.md +137 -0
- package/docs/api/dom/query/media.md +188 -0
- package/docs/api/dom/rendering/README.md +41 -0
- package/docs/api/dom/rendering/chart.md +149 -0
- package/docs/api/dom/rendering/component.md +287 -0
- package/docs/api/dom/rendering/devtools-ui.md +129 -0
- package/docs/api/dom/rendering/devtools.md +157 -0
- package/docs/api/dom/rendering/parser.md +200 -0
- package/docs/api/dom/rendering/reactiveBind.md +234 -0
- package/docs/api/dom/rendering/render.md +219 -0
- package/docs/api/dom/rendering/sanitize.md +97 -0
- package/docs/api/dom/rendering/secPolicy.md +155 -0
- package/docs/api/dom/rendering/template.md +301 -0
- package/docs/api/dom/rendering/themeTokens.md +175 -0
- package/docs/api/dom/rendering/uiSession.md +546 -0
- package/docs/api/dom/rendering/virtualScroll.md +126 -0
- package/docs/api/dom/sensors/README.md +12 -0
- package/docs/api/dom/sensors/battery.md +70 -0
- package/docs/api/dom/sensors/geolocation.md +115 -0
- package/docs/api/dom/sensors/networkInfo.md +73 -0
- package/docs/api/dom/sensors/sensors.md +123 -0
- package/docs/api/dom/sw/README.md +31 -0
- package/docs/api/dom/sw/backgroundSync.md +145 -0
- package/docs/api/dom/sw/cache.md +116 -0
- package/docs/api/dom/sw/push.md +114 -0
- package/docs/api/dom/sw/serviceWorker.md +90 -0
- package/docs/api/dom/sw/sharedWorker.md +131 -0
- package/docs/api/dom/utils/README.md +25 -0
- package/docs/api/dom/utils/a11y.md +143 -0
- package/docs/api/dom/utils/clipboard.md +146 -0
- package/docs/api/dom/utils/entropyCollector.md +175 -0
- package/docs/api/dom/utils/focus.md +140 -0
- package/docs/api/dom/utils/form.md +196 -0
- package/docs/api/dom/utils/formKit.md +181 -0
- package/docs/api/dom/utils/keybindings.md +138 -0
- package/docs/api/dom/utils/leaderElection.md +130 -0
- package/docs/api/dom/utils/notifications.md +106 -0
- package/docs/api/dom/utils/permissions.md +82 -0
- package/docs/api/dom/utils/route.md +112 -0
- package/docs/api/dom/utils/ua.md +119 -0
- package/docs/api/dom/utils/webauthn.md +190 -0
- package/docs/api/io/README.md +20 -0
- package/docs/api/io/binary/README.md +29 -0
- package/docs/api/io/binary/reader.md +126 -0
- package/docs/api/io/binary/writer.md +127 -0
- package/docs/api/io/calc/README.md +22 -0
- package/docs/api/io/calc/adler32.md +75 -0
- package/docs/api/io/calc/bigint.md +105 -0
- package/docs/api/io/calc/crc32.md +74 -0
- package/docs/api/io/calc/easing.md +118 -0
- package/docs/api/io/codec/README.md +35 -0
- package/docs/api/io/codec/b64.md +92 -0
- package/docs/api/io/codec/base32.md +98 -0
- package/docs/api/io/codec/base58.md +104 -0
- package/docs/api/io/codec/buffer.md +144 -0
- package/docs/api/io/codec/cbor.md +179 -0
- package/docs/api/io/codec/csv.md +178 -0
- package/docs/api/io/codec/hex.md +75 -0
- package/docs/api/io/codec/mime.md +156 -0
- package/docs/api/io/codec/msgpack.md +142 -0
- package/docs/api/io/codec/url.md +265 -0
- package/docs/api/io/codec/utf8.md +84 -0
- package/docs/api/io/codec/xml.md +87 -0
- package/docs/api/io/compress/README.md +62 -0
- package/docs/api/io/compress/bitstream.md +131 -0
- package/docs/api/io/compress/brotli.md +232 -0
- package/docs/api/io/compress/brotli_dict.md +119 -0
- package/docs/api/io/compress/brotli_dict_words.md +142 -0
- package/docs/api/io/compress/brotli_frame.md +214 -0
- package/docs/api/io/compress/brotli_shared.md +144 -0
- package/docs/api/io/compress/deflate.md +474 -0
- package/docs/api/io/compress/gzip.md +130 -0
- package/docs/api/io/compress/huffman.md +210 -0
- package/docs/api/io/compress/lz4.md +278 -0
- package/docs/api/io/compress/lz77.md +180 -0
- package/docs/api/io/compress/lzw.md +121 -0
- package/docs/api/io/compress/zip.md +209 -0
- package/docs/api/io/compress/zlib.md +125 -0
- package/docs/api/io/i18n/README.md +23 -0
- package/docs/api/io/i18n/i18n.md +128 -0
- package/docs/api/io/math/README.md +24 -0
- package/docs/api/io/math/fixed-point.md +115 -0
- package/docs/api/io/math/geom.md +144 -0
- package/docs/api/io/math/interp.md +115 -0
- package/docs/api/io/math/linalg.md +138 -0
- package/docs/api/io/math/stats.md +109 -0
- package/docs/api/io/structures/README.md +31 -0
- package/docs/api/io/structures/btree.md +155 -0
- package/docs/api/io/structures/heap.md +166 -0
- package/docs/api/io/structures/lruCache.md +156 -0
- package/docs/api/io/structures/ringBuffer.md +188 -0
- package/docs/api/io/structures/tree-walker.md +132 -0
- package/docs/api/io/structures/trie.md +138 -0
- package/docs/api/io/sync/README.md +29 -0
- package/docs/api/io/sync/abort.md +129 -0
- package/docs/api/io/sync/atomics.md +159 -0
- package/docs/api/io/sync/cancellable.md +176 -0
- package/docs/api/io/sync/channel.md +125 -0
- package/docs/api/io/sync/mutex.md +93 -0
- package/docs/api/io/sync/semaphore.md +106 -0
- package/docs/api/io/sync/tokenBucket.md +139 -0
- package/docs/api/io/text/README.md +23 -0
- package/docs/api/io/text/ansi.md +182 -0
- package/docs/api/io/text/html-entities.md +79 -0
- package/docs/api/io/text/semver.md +158 -0
- package/docs/api/io/text/str.md +129 -0
- package/docs/api/io/text/unicode.md +89 -0
- package/docs/api/io/time/README.md +22 -0
- package/docs/api/io/time/date.md +128 -0
- package/docs/api/io/timing/README.md +32 -0
- package/docs/api/io/timing/clock.md +102 -0
- package/docs/api/io/timing/rateLimit.md +137 -0
- package/docs/api/io/timing/scheduler.md +163 -0
- package/docs/api/io/utils/README.md +30 -0
- package/docs/api/io/utils/bitmap.md +96 -0
- package/docs/api/io/utils/errors.md +165 -0
- package/docs/api/io/utils/eventBus.md +162 -0
- package/docs/api/io/utils/queue.md +141 -0
- package/docs/api/io/utils/signal.md +388 -0
- package/docs/api/io/utils/ui8.md +111 -0
- package/docs/api/io/utils/valid.md +272 -0
- package/docs/api/process/README.md +18 -0
- package/docs/api/process/message.md +166 -0
- package/docs/api/process/rpc.md +161 -0
- package/docs/api/process/workerPool.md +130 -0
- package/docs/api/sanity/base.md +132 -0
- package/docs/api/sanity/community.md +96 -0
- package/docs/api/sanity/lockdown.md +128 -0
- package/docs/api/typed.md +85 -0
- package/docs/dev/README.md +25 -0
- package/docs/dev/provenance.md +80 -0
- package/docs/dev/publishing.md +31 -0
- package/docs/dev/runtime.md +64 -0
- package/docs/dev/testing.md +61 -0
- package/docs/dev/types.md +35 -0
- package/docs/evidence/pqc-hybrid-evidence.md +438 -0
- package/docs/guide/README.md +38 -0
- package/docs/guide/_QUICK_REF.md +341 -0
- package/docs/guide/by-use-case.md +160 -0
- package/docs/guide/doc-format.md +306 -0
- package/docs/guide/gesture-dnd-side-channel.md +119 -0
- package/docs/guide/getting-started.md +134 -0
- package/docs/guide/hmr.md +187 -0
- package/docs/guide/integration-bundlers.md +193 -0
- package/docs/guide/integrations-hmr.md +103 -0
- package/docs/guide/module-creation-workflow.md +342 -0
- package/docs/guide/module-pattern.md +244 -0
- package/docs/guide/rendering-pipeline.md +422 -0
- package/docs/guide/security.md +346 -0
- package/docs/guide/test-format.md +190 -0
- package/docs/guide/tutorial-todo.md +298 -0
- package/docs/guide/typescript.md +215 -0
- package/docs/guide/worker-confinement.md +301 -0
- package/docs/guide/workers.md +168 -0
- package/docs/notes/lz77-deflate-factorization.md +96 -0
- package/docs/notes/worker-confinement-spike.md +302 -0
- package/docs/tools/README.md +56 -0
- package/docs/tools/aot.md +108 -0
- package/docs/tools/audit.md +61 -0
- package/docs/tools/bundler.md +215 -0
- package/docs/tools/codegen.md +64 -0
- package/docs/tools/jsx.md +236 -0
- package/docs/tools/precompilation.md +88 -0
- package/docs/tools/standalone.md +107 -0
- package/fw.config.json +129 -0
- package/integrations/README.md +52 -0
- package/integrations/_shared/catalog.generated.json +207 -0
- package/integrations/_shared/config-resolve.js +201 -0
- package/integrations/_shared/core.js +362 -0
- package/integrations/astro/README.md +96 -0
- package/integrations/astro/index.d.ts +42 -0
- package/integrations/astro/index.js +94 -0
- package/integrations/bun/README.md +62 -0
- package/integrations/bun/index.d.ts +30 -0
- package/integrations/bun/index.js +134 -0
- package/integrations/deno/README.md +55 -0
- package/integrations/deno/deno.json +10 -0
- package/integrations/esbuild/README.md +75 -0
- package/integrations/esbuild/backend.js +147 -0
- package/integrations/esbuild/index.d.ts +32 -0
- package/integrations/esbuild/index.js +147 -0
- package/integrations/eslint/README.md +27 -0
- package/integrations/eslint/no-factory-capture.js +99 -0
- package/integrations/jest/README.md +45 -0
- package/integrations/jest/bun-test-shim.js +43 -0
- package/integrations/nestjs/README.md +68 -0
- package/integrations/nestjs/index.d.ts +38 -0
- package/integrations/nestjs/index.js +99 -0
- package/integrations/nextjs/README.md +149 -0
- package/integrations/nextjs/index.d.ts +30 -0
- package/integrations/nextjs/index.js +98 -0
- package/integrations/nodejs/README.md +46 -0
- package/integrations/nodejs/package.node.example.json +31 -0
- package/integrations/rollup/README.md +65 -0
- package/integrations/rollup/backend.js +132 -0
- package/integrations/rollup/index.d.ts +32 -0
- package/integrations/rollup/index.js +84 -0
- package/integrations/turbopack/README.md +56 -0
- package/integrations/turbopack/index.d.ts +47 -0
- package/integrations/turbopack/index.js +164 -0
- package/integrations/typedoc/README.md +57 -0
- package/integrations/typedoc/categorize.js +121 -0
- package/integrations/typedoc/tsconfig.typedoc.json +14 -0
- package/integrations/typedoc/typedoc.json +19 -0
- package/integrations/vite/README.md +115 -0
- package/integrations/vite/index.d.ts +29 -0
- package/integrations/vite/index.js +182 -0
- package/integrations/vite/package.json +8 -0
- package/integrations/vite/vite-env.d.ts +36 -0
- package/integrations/vitest/README.md +77 -0
- package/integrations/vitest/bun-test-shim.js +92 -0
- package/integrations/vitest/vitest.config.js +41 -0
- package/integrations/webpack/README.md +53 -0
- package/integrations/webpack/index.d.ts +29 -0
- package/integrations/webpack/index.js +182 -0
- package/package.json +303 -0
- package/src/core/logger.js +373 -0
- package/src/core/modules.js +289 -0
- package/src/core/readyState.js +119 -0
- package/src/core/runtime.js +929 -0
- package/src/core/worker-helper.js +261 -0
- package/src/crypto/NIST_CONFORMANCE.md +249 -0
- package/src/crypto/cipher/aes.acvp.md +74 -0
- package/src/crypto/cipher/aes.js +512 -0
- package/src/crypto/cipher/chacha20.acvp.md +117 -0
- package/src/crypto/cipher/chacha20.js +147 -0
- package/src/crypto/hash/adf.acvp.md +144 -0
- package/src/crypto/hash/adf.js +127 -0
- package/src/crypto/hash/argon2.acvp.md +144 -0
- package/src/crypto/hash/argon2.js +517 -0
- package/src/crypto/hash/blake2b.acvp.md +122 -0
- package/src/crypto/hash/blake2b.js +367 -0
- package/src/crypto/hash/hkdf.acvp.md +128 -0
- package/src/crypto/hash/hkdf.js +145 -0
- package/src/crypto/hash/hmac.acvp.md +110 -0
- package/src/crypto/hash/hmac.js +177 -0
- package/src/crypto/hash/pbkdf2.acvp.md +122 -0
- package/src/crypto/hash/pbkdf2.js +120 -0
- package/src/crypto/hash/poly1305.acvp.md +111 -0
- package/src/crypto/hash/poly1305.js +126 -0
- package/src/crypto/hash/sha224.acvp.md +81 -0
- package/src/crypto/hash/sha224.js +60 -0
- package/src/crypto/hash/sha256.acvp.md +75 -0
- package/src/crypto/hash/sha256.js +217 -0
- package/src/crypto/hash/sha3.acvp.md +133 -0
- package/src/crypto/hash/sha3.js +391 -0
- package/src/crypto/hash/sha384.acvp.md +82 -0
- package/src/crypto/hash/sha384.js +61 -0
- package/src/crypto/hash/sha512.acvp.md +84 -0
- package/src/crypto/hash/sha512.js +314 -0
- package/src/crypto/hash/sha512_224.acvp.md +90 -0
- package/src/crypto/hash/sha512_224.js +66 -0
- package/src/crypto/hash/sha512_256.acvp.md +96 -0
- package/src/crypto/hash/sha512_256.js +75 -0
- package/src/crypto/mode/cbc.acvp.md +105 -0
- package/src/crypto/mode/cbc.js +136 -0
- package/src/crypto/mode/chacha20poly1305.acvp.md +116 -0
- package/src/crypto/mode/chacha20poly1305.js +190 -0
- package/src/crypto/mode/cmac.acvp.md +106 -0
- package/src/crypto/mode/cmac.js +172 -0
- package/src/crypto/mode/ctr.acvp.md +110 -0
- package/src/crypto/mode/ctr.js +174 -0
- package/src/crypto/mode/gcm.acvp.md +129 -0
- package/src/crypto/mode/gcm.js +333 -0
- package/src/crypto/mode/kw.acvp.md +145 -0
- package/src/crypto/mode/kw.js +323 -0
- package/src/crypto/pkc/ecc.acvp.md +181 -0
- package/src/crypto/pkc/ecc.js +941 -0
- package/src/crypto/pkc/ed25519.acvp.md +172 -0
- package/src/crypto/pkc/ed25519.js +582 -0
- package/src/crypto/pkc/hybrid-kat.provenance.md +89 -0
- package/src/crypto/pkc/hybridKem.js +255 -0
- package/src/crypto/pkc/hybridSign.js +437 -0
- package/src/crypto/pkc/ml_dsa.acvp.md +146 -0
- package/src/crypto/pkc/ml_dsa.js +984 -0
- package/src/crypto/pkc/ml_kem.acvp.md +117 -0
- package/src/crypto/pkc/ml_kem.js +596 -0
- package/src/crypto/pkc/rsa.acvp.md +187 -0
- package/src/crypto/pkc/rsa.js +470 -0
- package/src/crypto/pkc/slh_dsa.acvp.md +155 -0
- package/src/crypto/pkc/slh_dsa.js +820 -0
- package/src/crypto/pkc/x25519.acvp.md +113 -0
- package/src/crypto/pkc/x25519.js +290 -0
- package/src/crypto/utils/aes_ctr.acvp.md +67 -0
- package/src/crypto/utils/aes_ctr.js +134 -0
- package/src/crypto/utils/aes_modes.acvp.md +66 -0
- package/src/crypto/utils/aes_modes.js +241 -0
- package/src/crypto/utils/asn1-oid.js +369 -0
- package/src/crypto/utils/asn1.js +343 -0
- package/src/crypto/utils/bitArray.js +312 -0
- package/src/crypto/utils/bn.js +825 -0
- package/src/crypto/utils/jws.js +222 -0
- package/src/crypto/utils/keyformat.js +303 -0
- package/src/crypto/utils/pad.js +198 -0
- package/src/crypto/utils/pem.js +90 -0
- package/src/crypto/utils/random.acvp.md +167 -0
- package/src/crypto/utils/random.js +846 -0
- package/src/crypto/utils/rsaKeygen.acvp.md +158 -0
- package/src/crypto/utils/rsaKeygen.js +448 -0
- package/src/crypto/utils/totp.js +409 -0
- package/src/crypto/utils/uuid.acvp.md +137 -0
- package/src/crypto/utils/uuid.js +176 -0
- package/src/crypto/wasm/aes.js +494 -0
- package/src/crypto/wasm/argon2.js +236 -0
- package/src/crypto/wasm/blake2b.js +213 -0
- package/src/crypto/wasm/chacha20poly1305.js +238 -0
- package/src/crypto/wasm/cmac.js +207 -0
- package/src/crypto/wasm/ecc.js +437 -0
- package/src/crypto/wasm/ed25519.js +307 -0
- package/src/crypto/wasm/hkdf.js +183 -0
- package/src/crypto/wasm/hmac.js +215 -0
- package/src/crypto/wasm/ml_dsa.js +375 -0
- package/src/crypto/wasm/ml_kem.js +313 -0
- package/src/crypto/wasm/pbkdf2.js +205 -0
- package/src/crypto/wasm/rsa.js +674 -0
- package/src/crypto/wasm/runtime.js +400 -0
- package/src/crypto/wasm/sha2.js +183 -0
- package/src/crypto/wasm/sha3.js +221 -0
- package/src/crypto/wasm/slh_dsa.js +397 -0
- package/src/crypto/wasm/x25519.js +241 -0
- package/src/crypto/webcrypto/aes.js +370 -0
- package/src/crypto/webcrypto/aeskw.js +185 -0
- package/src/crypto/webcrypto/digest.js +136 -0
- package/src/crypto/webcrypto/ecc.js +371 -0
- package/src/crypto/webcrypto/ed25519.js +248 -0
- package/src/crypto/webcrypto/hkdf.js +132 -0
- package/src/crypto/webcrypto/hmac.js +213 -0
- package/src/crypto/webcrypto/pbkdf2.js +146 -0
- package/src/crypto/webcrypto/rsa.js +415 -0
- package/src/crypto/webcrypto/x25519.js +250 -0
- package/src/dom/display/animate.js +154 -0
- package/src/dom/display/fullscreen.js +305 -0
- package/src/dom/fs/download.js +118 -0
- package/src/dom/fs/fsAccess.js +307 -0
- package/src/dom/fs/indexedDB.js +465 -0
- package/src/dom/fs/remoteStore.js +484 -0
- package/src/dom/fs/storage.js +440 -0
- package/src/dom/lifecycle/idle.js +133 -0
- package/src/dom/lifecycle/visibility.js +140 -0
- package/src/dom/lifecycle/wakeLock.js +187 -0
- package/src/dom/net/ajax.js +303 -0
- package/src/dom/net/broadcastChannel.js +89 -0
- package/src/dom/net/network.js +260 -0
- package/src/dom/net/sse.js +295 -0
- package/src/dom/net/webrtc.js +381 -0
- package/src/dom/net/ws.js +290 -0
- package/src/dom/query/dnd.js +409 -0
- package/src/dom/query/dom.js +831 -0
- package/src/dom/query/events.js +425 -0
- package/src/dom/query/gesture.js +396 -0
- package/src/dom/query/media.js +616 -0
- package/src/dom/rendering/chart.js +663 -0
- package/src/dom/rendering/component.js +469 -0
- package/src/dom/rendering/devtools-ui.js +399 -0
- package/src/dom/rendering/devtools.js +352 -0
- package/src/dom/rendering/parser.js +1055 -0
- package/src/dom/rendering/reactiveBind.js +341 -0
- package/src/dom/rendering/render.js +601 -0
- package/src/dom/rendering/sanitize.js +364 -0
- package/src/dom/rendering/secPolicy.js +281 -0
- package/src/dom/rendering/template.js +1031 -0
- package/src/dom/rendering/themeTokens.js +522 -0
- package/src/dom/rendering/uiSession-core.js +597 -0
- package/src/dom/rendering/uiSession-direct.js +251 -0
- package/src/dom/rendering/uiSession-list.js +751 -0
- package/src/dom/rendering/uiSession.js +145 -0
- package/src/dom/rendering/virtualScroll.js +341 -0
- package/src/dom/sensors/battery.js +153 -0
- package/src/dom/sensors/geolocation.js +156 -0
- package/src/dom/sensors/networkInfo.js +136 -0
- package/src/dom/sensors/sensors.js +340 -0
- package/src/dom/sw/backgroundSync.js +113 -0
- package/src/dom/sw/cache.js +139 -0
- package/src/dom/sw/push.js +181 -0
- package/src/dom/sw/serviceWorker.js +193 -0
- package/src/dom/sw/sharedWorker.js +192 -0
- package/src/dom/utils/a11y.js +244 -0
- package/src/dom/utils/clipboard.js +113 -0
- package/src/dom/utils/entropyCollector.js +344 -0
- package/src/dom/utils/focus.js +421 -0
- package/src/dom/utils/form.js +535 -0
- package/src/dom/utils/formKit.js +427 -0
- package/src/dom/utils/keybindings.js +574 -0
- package/src/dom/utils/leaderElection.js +280 -0
- package/src/dom/utils/notifications.js +218 -0
- package/src/dom/utils/permissions.js +107 -0
- package/src/dom/utils/route.js +482 -0
- package/src/dom/utils/ua.js +109 -0
- package/src/dom/utils/webauthn.js +369 -0
- package/src/external/README.md +15 -0
- package/src/io/binary/reader.js +374 -0
- package/src/io/binary/writer.js +351 -0
- package/src/io/calc/adler32.js +94 -0
- package/src/io/calc/bigint.js +276 -0
- package/src/io/calc/crc32.js +111 -0
- package/src/io/calc/easing.js +514 -0
- package/src/io/codec/b64.js +235 -0
- package/src/io/codec/base32.js +147 -0
- package/src/io/codec/base58.js +167 -0
- package/src/io/codec/buffer.js +630 -0
- package/src/io/codec/cbor.js +550 -0
- package/src/io/codec/csv.js +299 -0
- package/src/io/codec/hex.js +129 -0
- package/src/io/codec/mime.js +398 -0
- package/src/io/codec/msgpack.js +491 -0
- package/src/io/codec/url.js +530 -0
- package/src/io/codec/utf8.js +181 -0
- package/src/io/codec/xml.js +428 -0
- package/src/io/compress/bitstream.js +199 -0
- package/src/io/compress/brotli.js +3073 -0
- package/src/io/compress/brotli_dict.bin +432 -0
- package/src/io/compress/brotli_dict.js +356 -0
- package/src/io/compress/brotli_dict_words.js +157 -0
- package/src/io/compress/brotli_frame.js +420 -0
- package/src/io/compress/brotli_shared.js +715 -0
- package/src/io/compress/deflate.js +1432 -0
- package/src/io/compress/gzip.js +406 -0
- package/src/io/compress/huffman.js +322 -0
- package/src/io/compress/lz4.js +451 -0
- package/src/io/compress/lz77.js +408 -0
- package/src/io/compress/lzw.js +332 -0
- package/src/io/compress/zip.js +815 -0
- package/src/io/compress/zlib.js +340 -0
- package/src/io/i18n/i18n.js +236 -0
- package/src/io/math/fixed-point.js +269 -0
- package/src/io/math/geom.js +350 -0
- package/src/io/math/interp.js +263 -0
- package/src/io/math/linalg.js +472 -0
- package/src/io/math/stats.js +339 -0
- package/src/io/structures/btree.js +357 -0
- package/src/io/structures/heap.js +249 -0
- package/src/io/structures/lruCache.js +219 -0
- package/src/io/structures/ringBuffer.js +208 -0
- package/src/io/structures/tree-walker.js +413 -0
- package/src/io/structures/trie.js +219 -0
- package/src/io/sync/abort.js +196 -0
- package/src/io/sync/atomics.js +342 -0
- package/src/io/sync/cancellable.js +279 -0
- package/src/io/sync/channel.js +301 -0
- package/src/io/sync/mutex.js +148 -0
- package/src/io/sync/semaphore.js +156 -0
- package/src/io/sync/tokenBucket.js +208 -0
- package/src/io/text/ansi.js +536 -0
- package/src/io/text/html-entities.js +143 -0
- package/src/io/text/semver.js +375 -0
- package/src/io/text/str.js +243 -0
- package/src/io/text/unicode.js +188 -0
- package/src/io/time/date.js +355 -0
- package/src/io/timing/clock.js +79 -0
- package/src/io/timing/rateLimit.js +264 -0
- package/src/io/timing/scheduler.js +351 -0
- package/src/io/utils/bitmap.js +94 -0
- package/src/io/utils/errors.js +269 -0
- package/src/io/utils/eventBus.js +315 -0
- package/src/io/utils/queue.js +223 -0
- package/src/io/utils/signal.js +858 -0
- package/src/io/utils/ui8.js +99 -0
- package/src/io/utils/valid.js +556 -0
- package/src/main.js +41 -0
- package/src/polyfill/README.md +9 -0
- package/src/process/message.js +257 -0
- package/src/process/rpc.js +286 -0
- package/src/process/workerPool.js +392 -0
- package/src/sanity/base.js +374 -0
- package/src/sanity/community.js +254 -0
- package/src/sanity/lockdown-apply.js +58 -0
- package/src/sanity/lockdown.js +408 -0
- package/src/sanity/wasm-gate.js +316 -0
- package/src/typed.js +53 -0
- package/third-party/NOTICE-penner-easing +88 -0
- package/third-party/NOTICE-sjcl +50 -0
- package/tools/_lib/cli-help.js +55 -0
- package/tools/rendering/aot/index.js +148 -0
- package/tools/rendering/aot/lib/dom-codegen.js +295 -0
- package/tools/rendering/jsx/index.js +654 -0
- package/tools/rendering/precompilation/index.js +368 -0
- package/types/registry.generated.d.ts +217 -0
- package/types/typed.d.ts +106 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Poly1305 one-time MAC (RFC 8439 §2.5).
|
|
7
|
+
*
|
|
8
|
+
* Poly1305 evaluates a polynomial over GF(2^130 − 5) with the message
|
|
9
|
+
* blocks as coefficients and a 128-bit key `r` as the variable, then adds
|
|
10
|
+
* a second 128-bit "pad" key `s` mod 2^128.
|
|
11
|
+
*
|
|
12
|
+
* The 32-byte one-time key splits as `r || s`. `r` is "clamped" before use
|
|
13
|
+
* (mask 0x0FFFFFFC...0FFFFFFC0FFFFFFF...) per spec.
|
|
14
|
+
*
|
|
15
|
+
* Implemented with `BigInt` for arithmetic over GF(2^130-5) - JS doubles
|
|
16
|
+
* lose precision on the 130-bit products that arise during accumulation.
|
|
17
|
+
*
|
|
18
|
+
* **Constant-time caveat (BigInt)**: the tag-comparison path in `verify`
|
|
19
|
+
* is constant-time by construction (XOR-accumulate over all 16 tag bytes,
|
|
20
|
+
* no early exit). However, the BigInt arithmetic in `mac` itself is **not**
|
|
21
|
+
* guaranteed constant-time by any JS engine - V8/SpiderMonkey internals
|
|
22
|
+
* may short-circuit equality checks, allocate variable-size limbs, etc.
|
|
23
|
+
* Poly1305 is specified as a one-time MAC under one-time keys, so this
|
|
24
|
+
* timing exposure does not threaten unforgeability for compliant use, but
|
|
25
|
+
* callers MUST NOT reuse `(r, s)` keys across messages.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Public shape returned by `poly1305.factory()`.
|
|
31
|
+
* @typedef {object} Poly1305API
|
|
32
|
+
* @property {string} name Module name (`'poly1305'`).
|
|
33
|
+
* @property {(key: Uint8Array, msg: Uint8Array) => (Uint8Array|false)} mac
|
|
34
|
+
* Compute the 16-byte tag, or `false` on invalid key.
|
|
35
|
+
* @property {(key: Uint8Array, msg: Uint8Array, tag: Uint8Array) => boolean} verify
|
|
36
|
+
* Constant-time tag verification.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
export const poly1305 = {
|
|
40
|
+
name: 'poly1305',
|
|
41
|
+
version: '1.0.0',
|
|
42
|
+
type: 'fw.crypto.hash',
|
|
43
|
+
dependencies: [],
|
|
44
|
+
|
|
45
|
+
/** @returns {Poly1305API} */
|
|
46
|
+
factory() {
|
|
47
|
+
|
|
48
|
+
const _P = (1n << 130n) - 5n;
|
|
49
|
+
const _MASK128 = (1n << 128n) - 1n;
|
|
50
|
+
const _CLAMP = 0x0ffffffc0ffffffc0ffffffc0fffffffn;
|
|
51
|
+
|
|
52
|
+
function _bytesToBigIntLE(bytes) {
|
|
53
|
+
let v = 0n;
|
|
54
|
+
for (let i = bytes.length - 1; i >= 0; i--) {
|
|
55
|
+
v = (v << 8n) | BigInt(bytes[i]);
|
|
56
|
+
}
|
|
57
|
+
return v;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _bigIntToBytesLE(v, n) {
|
|
61
|
+
const out = new Uint8Array(n);
|
|
62
|
+
let x = v;
|
|
63
|
+
for (let i = 0; i < n; i++) {
|
|
64
|
+
out[i] = Number(x & 0xffn);
|
|
65
|
+
x >>= 8n;
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Compute Poly1305(key, message).
|
|
72
|
+
* @param {Uint8Array} key 32-byte one-time key.
|
|
73
|
+
* @param {Uint8Array} msg Message of any length.
|
|
74
|
+
* @returns {Uint8Array|false} 16-byte tag, or false on invalid input.
|
|
75
|
+
*/
|
|
76
|
+
function mac(key, msg) {
|
|
77
|
+
if (!(key instanceof Uint8Array) || key.length !== 32) {
|
|
78
|
+
console.warn('[crypto] INVALID: poly1305: key must be 32 bytes');
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const r = _bytesToBigIntLE(key.subarray(0, 16)) & _CLAMP;
|
|
83
|
+
const s = _bytesToBigIntLE(key.subarray(16, 32));
|
|
84
|
+
|
|
85
|
+
let acc = 0n;
|
|
86
|
+
const len = msg.length;
|
|
87
|
+
let off = 0;
|
|
88
|
+
while (off < len) {
|
|
89
|
+
const remaining = len - off;
|
|
90
|
+
const n = remaining < 16 ? remaining : 16;
|
|
91
|
+
const block = new Uint8Array(17);
|
|
92
|
+
for (let i = 0; i < n; i++) block[i] = msg[off + i];
|
|
93
|
+
block[n] = 1;
|
|
94
|
+
acc = ((acc + _bytesToBigIntLE(block)) * r) % _P;
|
|
95
|
+
off += n;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const tagInt = (acc + s) & _MASK128;
|
|
99
|
+
return _bigIntToBytesLE(tagInt, 16);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Constant-time tag verification. The comparison XOR-accumulates all
|
|
104
|
+
* 16 bytes with no early exit, so the running time depends only on
|
|
105
|
+
* the (fixed) tag length, not on which byte mismatches first.
|
|
106
|
+
*
|
|
107
|
+
* Note: see the module-level "Constant-time caveat" - `mac` itself is
|
|
108
|
+
* not strictly constant-time at the BigInt layer.
|
|
109
|
+
*
|
|
110
|
+
* @param {Uint8Array} key 32-byte one-time key.
|
|
111
|
+
* @param {Uint8Array} msg Message.
|
|
112
|
+
* @param {Uint8Array} tag Candidate 16-byte tag.
|
|
113
|
+
* @returns {boolean} true iff `tag` matches the recomputed MAC.
|
|
114
|
+
*/
|
|
115
|
+
function verify(key, msg, tag) {
|
|
116
|
+
if (!(tag instanceof Uint8Array) || tag.length !== 16) return false;
|
|
117
|
+
const expected = mac(key, msg);
|
|
118
|
+
if (expected === false) return false;
|
|
119
|
+
let diff = 0;
|
|
120
|
+
for (let i = 0; i < 16; i++) diff |= expected[i] ^ tag[i];
|
|
121
|
+
return diff === 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return { name: 'poly1305', mac, verify };
|
|
125
|
+
}
|
|
126
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# `sha224.js` — ACVP / NIST conformance
|
|
2
|
+
|
|
3
|
+
## Standards
|
|
4
|
+
|
|
5
|
+
- **Primary**: **FIPS 180-4** — *Secure Hash Standard (SHS)*, §6.3 (SHA-224).
|
|
6
|
+
- **Secondary**: ACVP — *Automated Cryptographic Validation Protocol*, draft-celi-acvp-sha.
|
|
7
|
+
- **ACVP draft**: `references/NIST/ACVP/src/draft-celi-acvp-sha.adoc`
|
|
8
|
+
- **Vectors**: `references/NIST/ACVP-Server-1.1.0.42/gen-val/json-files/SHA2-224-1.0/`
|
|
9
|
+
|
|
10
|
+
## Implemented algorithm
|
|
11
|
+
|
|
12
|
+
SHA-224 hash (FIPS 180-4 §6.3). Identical to SHA-256 except for the IV (FIPS 180-4
|
|
13
|
+
§5.3.2) and the final truncation (`h.slice(0, 7)` → 224 bits).
|
|
14
|
+
|
|
15
|
+
**Architecture (post-upgrade audit Finding 1 resolved)**: `factory(sha256)` →
|
|
16
|
+
`{ fn, hash }`. Thin wrapper (~14 useful LOC) over
|
|
17
|
+
`sha256._internal.makeSha(_INIT_224, 7)`. **Previously**: this module
|
|
18
|
+
duplicated the ~80 LOC of the compression function "to preserve
|
|
19
|
+
streaming-state independence" — inconsistent with sha512_224/256, which
|
|
20
|
+
reuse sha512 via factory injection with no observed bug. Sharing the
|
|
21
|
+
`sha.fn` prototype introduces no state coupling (each `new sha.fn()`
|
|
22
|
+
has its own `_h / _buffer / _length`).
|
|
23
|
+
|
|
24
|
+
## Test coverage
|
|
25
|
+
|
|
26
|
+
### Built-in official vectors
|
|
27
|
+
|
|
28
|
+
| Source | Reference | Test (`describe` / `test`) | Property verified |
|
|
29
|
+
|---|---|---|---|
|
|
30
|
+
| FIPS 180-4 | digest empty | `FIPS-180 vectors` / `empty string` | byte-exact KAT |
|
|
31
|
+
| FIPS 180-4 App. B | "abc" | `FIPS-180 vectors` / `"abc"` | byte-exact KAT |
|
|
32
|
+
| FIPS 180-4 App. B | 448-bit message | `FIPS-180 vectors` / `448-bit message` | byte-exact KAT |
|
|
33
|
+
| ACVP-SHA2-224-1.0 | `expectedResults.json` tcId 1-512 (sub-sample 24) | `ACVP SHA2-224-1.0 / AFT vectors` | byte-exact KAT (lengths 0..65535 bits, INCLUDING non-byte-aligned bit-level) |
|
|
34
|
+
| ACVP-SHA2-224-1.0 | `expectedResults.json` tcId 513 (standard MCT) | `ACVP SHA2-224-1.0 / MCT (standard)` | 100 outer × 1000 inner — byte-exact assertions of the 100 results |
|
|
35
|
+
|
|
36
|
+
#### AFT sub-sampling strategy
|
|
37
|
+
|
|
38
|
+
The SHA2-224 AFT enumerates 512 messages at lengths `[0..65535]` bits — **433/512 tests are non-byte-aligned** (bit-level inputs). Strategy:
|
|
39
|
+
|
|
40
|
+
- **Regular stride**: tcId 1, 17, 33, …, 497, 512 (one in 16).
|
|
41
|
+
- **Edge-case anchors**: `len=0` (tcId=148), `min(len)`, `max(len)`, first tcId for each critical short length (1, 7, 9, 13, 100, 471, 1023 bits).
|
|
42
|
+
- **Volume cap**: tests > 32000 bits filtered out (except the `max(len)=65535` anchor, which is kept) to bound the test file size.
|
|
43
|
+
- **Total integrated**: **24 / 512 AFT + 1 MCT** out of 513 tests from testGroups 1+2 + **1 LDT (1 GiB) gated behind `CRYPTO_FULL=1`** (see LDT line below).
|
|
44
|
+
- **LDT (testGroup 3)**: **Iteration H1** — tcId=514 (1 GiB of repeated `e788c962d3e8ff55`) integrated behind `CRYPTO_FULL=1`. Validates the 64-bit `_length` counter over ≥ 2³³ bits.
|
|
45
|
+
|
|
46
|
+
Non-byte-aligned vectors are decoded via `bitArray.clamp(ui8_to_ba(bytes), bitLen)`, which follows the ACVP convention (the useful bits are the leftmost MSBs of the last byte).
|
|
47
|
+
|
|
48
|
+
### Security properties tested
|
|
49
|
+
|
|
50
|
+
- [x] **Correct round / message schedule** — covered by 24 AFT spread across the length range (including block padding).
|
|
51
|
+
- [x] **Bit-level inputs (non-byte-aligned)** — most AFT (433/512) test lengths not a multiple of 8 bits; the retained cases (471, 1023, etc.) validate the clamp + FIPS 180-4 §5.1.1 padding.
|
|
52
|
+
- [x] **FIPS 180-4 §5.1.1 padding** — implicitly validated by every AFT (varied lengths, including the critical `≥ 448 mod 512` case that forces an extra padding block).
|
|
53
|
+
- [x] **Long-chain stability** — standard MCT: 100,000 consecutive hashes with A/B/C chaining; any byte-level drift deviates `resultsArray[j]`.
|
|
54
|
+
- [x] **Streaming = one-shot** — `chunked update matches one-shot`.
|
|
55
|
+
- [x] **256→224 truncation** — `digest is 224 bits (7 x 32-bit words)` validates the `slice(0, 7)`.
|
|
56
|
+
- [x] **2^53−1-bit limit** — `update` returns `false` + `console.warn` beyond it (code review, line 69-72).
|
|
57
|
+
- [ ] **Side-channel resistance** — N/A (no secret input by default; HMAC usage handled by `hmac.js`).
|
|
58
|
+
|
|
59
|
+
## FIPS 140-3 conformance
|
|
60
|
+
|
|
61
|
+
| Requirement | Status | Evidence |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| Approved algorithm | ✅ | FIPS 180-4 §6.3 + ACVP-SHA2-224-1.0 |
|
|
64
|
+
| Validated parameter sizes | ✅ | single 224-bit digest; 0..65535-bit input covered by AFT (incl. bit-level) |
|
|
65
|
+
| Power-on KAT / self-test | ✅ | FIPS-180 vectors + 24 AFT executed on every `bun test`; init = deterministic table precompute |
|
|
66
|
+
| CT comparisons (if secret) | N/A | Hash module with no secret (see `hmac.js`) |
|
|
67
|
+
| No `throw` / timing leak | ✅ | Review: `console.warn` + `return false`; no branch dependent on pseudo-secret data |
|
|
68
|
+
|
|
69
|
+
## Known limitations
|
|
70
|
+
|
|
71
|
+
- ~~**LDT not integrated**~~ — resolved in **H1**: tcId=514 (1 GiB) runs under `CRYPTO_FULL=1` and passes byte-exact.
|
|
72
|
+
- **AFT sub-sampling**: 24/512 (≈ 5%). Choice driven by message size (up to 65535 bits = ~8 KB hex each). The retained lengths sample: 0, 1, 7, 9, 13, 100, 471, 1023, and one case every 16 tcId. The 488 unplayed vectors share the same code paths (`_block` is parameterized solely by the pre-final buffer's length).
|
|
73
|
+
- **"alternate" MCT version** not tested (ACVP provides `"standard"` here).
|
|
74
|
+
|
|
75
|
+
## Cross references
|
|
76
|
+
|
|
77
|
+
- Module: [`hash/sha224.js`](./sha224.js)
|
|
78
|
+
- Tests: [`hash/sha224.test.js`](https://github.com/awacloud/awa/blob/main/packages/front/fw/src/crypto/hash/sha224.test.js) — **32 tests** (31 pass + 1 skip LDT — `CRYPTO_FULL=1` to enable; was 6 before the upgrade)
|
|
79
|
+
- ACVP draft: `references/NIST/ACVP/src/draft-celi-acvp-sha.adoc`
|
|
80
|
+
- Vectors: `references/NIST/ACVP-Server-1.1.0.42/gen-val/json-files/SHA2-224-1.0/`
|
|
81
|
+
- Overall conformance: [`NIST_CONFORMANCE.md`](../NIST_CONFORMANCE.md)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview SHA-224 hash function (FIPS 180-4 §5.3.2 + §6.3).
|
|
7
|
+
*
|
|
8
|
+
* Truncated SHA-256 variant: same compression function as SHA-256
|
|
9
|
+
* (cf. sha256.js) but with a distinct IV and a 224-bit digest taken
|
|
10
|
+
* from the first 7 × 32-bit words of the final SHA-256 state.
|
|
11
|
+
*
|
|
12
|
+
* Block size: 512 bits (identical to SHA-256, required for HMAC-SHA-224).
|
|
13
|
+
*
|
|
14
|
+
* **Architecture (post-upgrade audit)**: this module is now a thin wrapper
|
|
15
|
+
* over `sha256._internal.makeSha(_INIT_224, 7)` - previously it duplicated
|
|
16
|
+
* the 80 LOC of the compression function. Mirrors the
|
|
17
|
+
* `sha512_224.js` / `sha512_256.js` pattern.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { sha256 } from './sha256.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Streaming SHA-224 hasher instance (truncated SHA-256; bitArray = `number[]` of 32-bit words).
|
|
25
|
+
* @typedef {object} Sha224Hasher
|
|
26
|
+
* @property {number} blockSize Block size in bits (512).
|
|
27
|
+
* @property {number[]} _init IV (8 × 32-bit words).
|
|
28
|
+
* @property {number[]} _key Round constants K[0..63].
|
|
29
|
+
* @property {() => Sha224Hasher} reset Reset internal state; returns `this`.
|
|
30
|
+
* @property {(data: number[]|string) => (Sha224Hasher|false)} update Absorb a bitArray or UTF-8 string; returns `this`, or `false` on > 2^53-1 bit overflow.
|
|
31
|
+
* @property {() => number[]} finalize Pad and emit the 224-bit digest as a bitArray (7 words).
|
|
32
|
+
* @property {(words: ArrayLike<number>) => void} _block Compress one 16-word block.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Object returned by `sha224.factory()` (delegates to `sha256._internal.makeSha`).
|
|
37
|
+
* @typedef {object} Sha224API
|
|
38
|
+
* @property {new (hash?: Sha224Hasher) => Sha224Hasher} fn Streaming hasher constructor (optional arg clones an existing instance).
|
|
39
|
+
* @property {(data: number[]|string) => number[]} hash One-shot hash; returns the 224-bit digest as a bitArray.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export const sha224 = {
|
|
43
|
+
name: 'sha224',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
type: 'fw.crypto.hash',
|
|
46
|
+
dependencies: ['sha256'],
|
|
47
|
+
deps: [sha256],
|
|
48
|
+
|
|
49
|
+
/** @returns {Sha224API} */
|
|
50
|
+
factory(sha256) {
|
|
51
|
+
// FIPS 180-4 §5.3.2 - IV for SHA-224 (8 × 32-bit).
|
|
52
|
+
const _INIT_224 = [
|
|
53
|
+
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
|
|
54
|
+
0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// outWords = 7 → 7 × 32-bit = 224 bits (FIPS 180-4 §6.3 truncation).
|
|
58
|
+
return sha256._internal.makeSha(_INIT_224, 7);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# `sha256.js` — ACVP / NIST conformance
|
|
2
|
+
|
|
3
|
+
## Standards
|
|
4
|
+
|
|
5
|
+
- **Primary**: **FIPS 180-4** — *Secure Hash Standard (SHS)*, §6.2 (SHA-256).
|
|
6
|
+
- **Secondary**: ACVP — *Automated Cryptographic Validation Protocol*, draft-celi-acvp-sha.
|
|
7
|
+
- **ACVP draft**: `references/NIST/ACVP/src/draft-celi-acvp-sha.adoc`
|
|
8
|
+
- **Vectors**: `references/NIST/ACVP-Server-1.1.0.42/gen-val/json-files/SHA2-256-1.0/`
|
|
9
|
+
|
|
10
|
+
## Implemented algorithm
|
|
11
|
+
|
|
12
|
+
SHA-256 hash (FIPS 180-4 §6.2). API: `sha256.factory(bitArray, utf8)` →
|
|
13
|
+
`{ fn, hash(data) }`. `fn` is a streaming constructor
|
|
14
|
+
(`update(data)`/`finalize()`/`reset()`); `hash(data)` is the one-shot
|
|
15
|
+
version. Input may be a UTF-8 string or a `bitArray`; the
|
|
16
|
+
output is a `bitArray` of 8 32-bit words (256 bits). Guard:
|
|
17
|
+
`update` rejects messages > 2^53−1 bits (`console.warn` + `false`).
|
|
18
|
+
IV (8 × 32-bit) and K (64 × 32-bit) constants frozen at factory time;
|
|
19
|
+
`factory().toString()` remains Worker-serializable.
|
|
20
|
+
|
|
21
|
+
## Test coverage
|
|
22
|
+
|
|
23
|
+
### Built-in official vectors
|
|
24
|
+
|
|
25
|
+
| Source | Reference | Test (`describe` / `test`) | Property verified |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| FIPS 180-4 App. B | vector 1 ("abc") | `hash (one-shot)` / `"abc" -> ba7816bf...` | byte-exact KAT |
|
|
28
|
+
| FIPS 180-4 App. B | vector 2 (448-bit) | `hash (one-shot)` / `FIPS-180 App. B vector 2` | byte-exact KAT |
|
|
29
|
+
| FIPS 180-4 App. B | vector 3 (1M × "a") | `hash (one-shot)` / `1,000,000 x "a"` | byte-exact KAT + streaming stress |
|
|
30
|
+
| RFC 6234 / convention | empty string | `hash (one-shot)` / `empty string` | byte-exact KAT |
|
|
31
|
+
| ACVP-SHA2-256-1.0 | `expectedResults.json` tcId 1-512 (sub-sample 67) | `ACVP SHA2-256-1.0 / AFT vectors` | byte-exact KAT (msg lengths 1720..12144 bits, byte-aligned) |
|
|
32
|
+
| ACVP-SHA2-256-1.0 | `expectedResults.json` tcId 513 (alternate MCT) | `ACVP SHA2-256-1.0 / MCT (alternate)` | 100 outer × 1000 inner — byte-exact assertions of the 100 `resultsArray` results |
|
|
33
|
+
|
|
34
|
+
#### AFT sub-sampling strategy (see the audit plan, *Risks & guardrails*)
|
|
35
|
+
|
|
36
|
+
The SHA2-256 AFT enumerates 512 messages at pseudo-random lengths in `[1720..12144]` bits (all byte-aligned). Strategy:
|
|
37
|
+
|
|
38
|
+
- **Regular stride**: tcId 1, 9, 17, …, 505, 512 (one in 8) — uniformly covers the range.
|
|
39
|
+
- **Anchors**: `min(len)` and `max(len)` explicitly added (already within the regular stride here, by chance).
|
|
40
|
+
- **Total integrated**: **67 / 512 AFT + 1 MCT** out of 513 available in testGroups 1+2 + **1 LDT (1 GiB) gated behind `CRYPTO_FULL=1`** (see LDT line below). Default suite ~1 s; ~12 s under `CRYPTO_FULL=1`.
|
|
41
|
+
- **LDT (testGroup 3)**: **Iteration H1** — tcId=514 (1 GiB of repeated `12735c605f3d270c`) integrated behind `CRYPTO_FULL=1` (~11 s on Bun + V8 in 1 MiB batches). Explicitly validates the 64-bit `_length` counter from FIPS 180-4 §5.1.1 over ≥ 2³³ bits. The 2/4/8 GiB vectors (tcId 515-517) remain available in the ACVP suite but are not wired up.
|
|
42
|
+
|
|
43
|
+
### Security properties tested
|
|
44
|
+
|
|
45
|
+
- [x] **Correct round / message schedule** — covered by 67 byte-aligned AFT spread uniformly across the length range (each AFT exercises the final `_block` + the specific padding).
|
|
46
|
+
- [x] **FIPS 180-4 §5.1.1 padding** — implicitly validated by every AFT (varied lengths modulo 512, including the `≥ 448 mod 512` cases that force an extra padding block).
|
|
47
|
+
- [x] **Long-chain stability** — alternate MCT: 100,000 consecutive hashes with A/B/C chaining; any byte-level degradation would deviate `resultsArray[j]` at the next checkpoint.
|
|
48
|
+
- [x] **Streaming = one-shot** — `chunked update matches one-shot hash` + `clone via constructor preserves state` + `reset returns instance to empty state`.
|
|
49
|
+
- [x] **1M-byte stress** — FIPS-180 App. B vector 3 (1,000,000 × 'a') = 7,813 blocks, validates the 64-bit counter and sub-buffering.
|
|
50
|
+
- [x] **2^53−1-bit limit** — `update` returns `false` + `console.warn` beyond it (code review, line 68-71).
|
|
51
|
+
- [ ] **Side-channel resistance** — not applicable in the strict sense: SHA-256 has no secret input by default. For HMAC-SHA-256 (secret key), timing resistance is handled by [`hmac.js`](./hmac.js) (XOR-accumulated).
|
|
52
|
+
|
|
53
|
+
## FIPS 140-3 conformance
|
|
54
|
+
|
|
55
|
+
| Requirement | Status | Evidence |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Approved algorithm | ✅ | FIPS 180-4 §6.2 + ACVP-SHA2-256-1.0 |
|
|
58
|
+
| Validated parameter sizes | ✅ | single 256-bit digest; input lengths 0..12144 bits covered by AFT + 8M bits by stress |
|
|
59
|
+
| Power-on KAT / self-test | ✅ | FIPS-180 App. B 1-3 vectors + 67 AFT executed on every `bun test`; no dedicated `selfTest()` — module init is deterministic table precompute |
|
|
60
|
+
| CT comparisons (if secret) | N/A | Hash module with no secret input (see `hmac.js` for keyed usage) |
|
|
61
|
+
| No `throw` / timing leak | ✅ | Review: `console.warn` + `return false` on error; no branch dependent on pseudo-secret data |
|
|
62
|
+
|
|
63
|
+
## Known limitations
|
|
64
|
+
|
|
65
|
+
- ~~**LDT not integrated**~~ — resolved in **H1**: tcId=514 (1 GiB) runs under `CRYPTO_FULL=1` and passes byte-exact (~11 s).
|
|
66
|
+
- **AFT sub-sampling**: 67/512 (≈ 13%). The 445 unplayed vectors share the same length class (all byte-aligned within `[1720..12144]`) as the 67 retained ones; the probability that a bug manifests *only* on an unsampled case is negligible because the `_block` code path is identical for all (parameterized solely by the pre-final buffer's length).
|
|
67
|
+
- **MCT version**: the ACVP suite provides `mctVersion="alternate"` here (introduced 7/2023). The `"standard"` version (which would require `MSG = A||B||C` without truncation) is not tested separately; it corresponds to the case `digestSize × 3 ∈ SupportedMessageLengths`, already covered intrinsically by the AFT (varied lengths including multiples of 256 bits).
|
|
68
|
+
|
|
69
|
+
## Cross references
|
|
70
|
+
|
|
71
|
+
- Module: [`hash/sha256.js`](./sha256.js)
|
|
72
|
+
- Tests: [`hash/sha256.test.js`](https://github.com/awacloud/awa/blob/main/packages/front/fw/src/crypto/hash/sha256.test.js) — **77 tests** (76 pass + 1 skip LDT — `CRYPTO_FULL=1` to enable; was 7 before the upgrade)
|
|
73
|
+
- ACVP draft: `references/NIST/ACVP/src/draft-celi-acvp-sha.adoc`
|
|
74
|
+
- Vectors: `references/NIST/ACVP-Server-1.1.0.42/gen-val/json-files/SHA2-256-1.0/`
|
|
75
|
+
- Overall conformance: [`NIST_CONFORMANCE.md`](../NIST_CONFORMANCE.md)
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
|
+
// Author: Matthieu Bouilloux
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview SHA-256 hash function (FIPS 180-4).
|
|
7
|
+
*
|
|
8
|
+
* Origin: adapted from the Stanford JavaScript Crypto Library (SJCL),
|
|
9
|
+
* BSD-2-Clause (SJCL is dual-licensed BSD-2-Clause OR GPL-2.0-or-later; the
|
|
10
|
+
* BSD-2-Clause terms are retained, see third-party/NOTICE-sjcl); the ESM
|
|
11
|
+
* factory, JSDoc, tests and every later change are this project's own work.
|
|
12
|
+
* See docs/dev/provenance.md.
|
|
13
|
+
*
|
|
14
|
+
* Exposes a constructor `fn` for streaming hashing and a static `hash(data)`
|
|
15
|
+
* for one-shot hashing. Inputs may be a UTF-8 string or a `bitArray`. The
|
|
16
|
+
* digest is returned as a `bitArray` of 8 32-bit words (256 bits).
|
|
17
|
+
*
|
|
18
|
+
* **Architecture (post-upgrade audit)**: the parametric factory
|
|
19
|
+
* `_makeSha(init, outWords)` is exposed via `_internal.makeSha` - used by
|
|
20
|
+
* `sha224.js` (FIPS 180-4 §5.3.2), which shares the same compression
|
|
21
|
+
* function with a distinct IV and a 7-word truncation. Mirrors the pattern
|
|
22
|
+
* of `sha512.js`, which serves `sha512_224.js` and `sha512_256.js`.
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { bitArray } from '../utils/bitArray.js';
|
|
27
|
+
import { utf8 } from '../../io/codec/utf8.js';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Streaming SHA-256 hasher instance (SJCL-style; bitArray = `number[]` of 32-bit words).
|
|
31
|
+
* @typedef {object} Sha256Hasher
|
|
32
|
+
* @property {number} blockSize Block size in bits (512).
|
|
33
|
+
* @property {number[]} _init IV (8 × 32-bit words).
|
|
34
|
+
* @property {number[]} _key Round constants K[0..63].
|
|
35
|
+
* @property {() => Sha256Hasher} reset Reset internal state; returns `this`.
|
|
36
|
+
* @property {(data: number[]|string) => (Sha256Hasher|false)} update Absorb a bitArray or UTF-8 string; returns `this`, or `false` on > 2^53-1 bit overflow.
|
|
37
|
+
* @property {() => number[]} finalize Pad and emit the digest as a bitArray (8 words for SHA-256, truncated per `outWords`).
|
|
38
|
+
* @property {(words: ArrayLike<number>) => void} _block Compress one 16-word block.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Object returned by `sha256.factory()`.
|
|
43
|
+
* @typedef {object} Sha256API
|
|
44
|
+
* @property {new (hash?: Sha256Hasher) => Sha256Hasher} fn Streaming hasher constructor (optional arg clones an existing instance).
|
|
45
|
+
* @property {(data: number[]|string) => number[]} hash One-shot hash; returns the digest as a bitArray.
|
|
46
|
+
* @property {{ makeSha: (init: number[], outWords: number) => { fn: Function, hash: Function } }} _internal Escape hatch used by sha224.js to build a truncated variant.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
export const sha256 = {
|
|
50
|
+
name: 'sha256',
|
|
51
|
+
version: '1.0.0',
|
|
52
|
+
type: 'fw.crypto.hash',
|
|
53
|
+
dependencies: ['bitArray', 'utf8'],
|
|
54
|
+
deps: [bitArray, utf8],
|
|
55
|
+
|
|
56
|
+
/** @returns {Sha256API} */
|
|
57
|
+
factory(bitArray, utf8) {
|
|
58
|
+
|
|
59
|
+
const _INIT = [
|
|
60
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
61
|
+
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const _KEY = [
|
|
65
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
66
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
67
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
68
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
69
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
70
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
71
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
72
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
// Parametric factory shared with sha224.js. `init` is the IV
|
|
76
|
+
// (8 × 32-bit words) and `outWords` is the digest size in words
|
|
77
|
+
// (8 for SHA-256, 7 for SHA-224 - FIPS 180-4 §5.3.2). `_KEY`
|
|
78
|
+
// (constants K[0..63]) is identical for SHA-224 and SHA-256
|
|
79
|
+
// (FIPS 180-4 §4.2.2).
|
|
80
|
+
/**
|
|
81
|
+
* Parametric SHA-256/224 compression factory.
|
|
82
|
+
* @param {number[]} init 8 × 32-bit IV.
|
|
83
|
+
* @param {number} outWords Number of 32-bit words in the digest
|
|
84
|
+
* (8 for SHA-256, 7 for SHA-224).
|
|
85
|
+
* @returns {{fn: Function, hash: Function}}
|
|
86
|
+
*/
|
|
87
|
+
function _makeSha(init, outWords) {
|
|
88
|
+
const sha = {};
|
|
89
|
+
|
|
90
|
+
sha.fn = function (hash) {
|
|
91
|
+
if (hash) {
|
|
92
|
+
this._h = hash._h.slice(0);
|
|
93
|
+
this._buffer = hash._buffer.slice(0);
|
|
94
|
+
this._length = hash._length;
|
|
95
|
+
} else {
|
|
96
|
+
this.reset();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
sha.hash = function (data) {
|
|
101
|
+
// @ts-ignore - update() returns false only on overflow; for a fresh instance it always returns this
|
|
102
|
+
return (new sha.fn()).update(data).finalize();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
sha.fn.prototype = {
|
|
106
|
+
blockSize: 512,
|
|
107
|
+
_init: init,
|
|
108
|
+
_key: _KEY,
|
|
109
|
+
|
|
110
|
+
reset() {
|
|
111
|
+
this._h = this._init.slice(0);
|
|
112
|
+
this._buffer = [];
|
|
113
|
+
this._length = 0;
|
|
114
|
+
return this;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
update(data) {
|
|
118
|
+
if (typeof data === 'string') {
|
|
119
|
+
data = bitArray.ui8_to_ba(utf8.toBytes(data));
|
|
120
|
+
}
|
|
121
|
+
const b = this._buffer = bitArray.concat(this._buffer, data);
|
|
122
|
+
const ol = this._length;
|
|
123
|
+
const nl = this._length = ol + bitArray.bitLength(data);
|
|
124
|
+
if (nl > 9007199254740991) {
|
|
125
|
+
console.warn('[crypto] INVALID: sha256: cannot hash more than 2^53 - 1 bits');
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
const c = new Uint32Array(b);
|
|
129
|
+
let j = 0;
|
|
130
|
+
for (let i = 512 + ol - ((512 + ol) & 511); i <= nl; i += 512) {
|
|
131
|
+
this._block(c.subarray(16 * j, 16 * (j + 1)));
|
|
132
|
+
j += 1;
|
|
133
|
+
}
|
|
134
|
+
b.splice(0, 16 * j);
|
|
135
|
+
return this;
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
finalize() {
|
|
139
|
+
let b = this._buffer;
|
|
140
|
+
const h = this._h;
|
|
141
|
+
|
|
142
|
+
b = bitArray.concat(b, [bitArray.partial(1, 1)]);
|
|
143
|
+
for (let i = b.length + 2; i & 15; i++) {
|
|
144
|
+
b.push(0);
|
|
145
|
+
}
|
|
146
|
+
b.push(Math.floor(this._length / 0x100000000));
|
|
147
|
+
b.push(this._length | 0);
|
|
148
|
+
|
|
149
|
+
while (b.length) {
|
|
150
|
+
this._block(b.splice(0, 16));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.reset();
|
|
154
|
+
return outWords < 8 ? h.slice(0, outWords) : h;
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
_block(w) {
|
|
158
|
+
const h = this._h;
|
|
159
|
+
const k = this._key;
|
|
160
|
+
let h0 = h[0], h1 = h[1], h2 = h[2], h3 = h[3];
|
|
161
|
+
let h4 = h[4], h5 = h[5], h6 = h[6], h7 = h[7];
|
|
162
|
+
let tmp;
|
|
163
|
+
let a;
|
|
164
|
+
let b;
|
|
165
|
+
|
|
166
|
+
for (let i = 0; i < 64; i++) {
|
|
167
|
+
if (i < 16) {
|
|
168
|
+
tmp = w[i];
|
|
169
|
+
} else {
|
|
170
|
+
a = w[(i + 1) & 15];
|
|
171
|
+
b = w[(i + 14) & 15];
|
|
172
|
+
tmp = w[i & 15] = ((a >>> 7 ^ a >>> 18 ^ a >>> 3 ^ a << 25 ^ a << 14) +
|
|
173
|
+
(b >>> 17 ^ b >>> 19 ^ b >>> 10 ^ b << 15 ^ b << 13) +
|
|
174
|
+
w[i & 15] + w[(i + 9) & 15]) | 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
tmp = (tmp + h7 + (h4 >>> 6 ^ h4 >>> 11 ^ h4 >>> 25 ^ h4 << 26 ^ h4 << 21 ^ h4 << 7) + (h6 ^ h4 & (h5 ^ h6)) + k[i]);
|
|
178
|
+
|
|
179
|
+
h7 = h6;
|
|
180
|
+
h6 = h5;
|
|
181
|
+
h5 = h4;
|
|
182
|
+
h4 = h3 + tmp | 0;
|
|
183
|
+
h3 = h2;
|
|
184
|
+
h2 = h1;
|
|
185
|
+
h1 = h0;
|
|
186
|
+
h0 = (tmp + ((h1 & h2) ^ (h3 & (h1 ^ h2))) + (h1 >>> 2 ^ h1 >>> 13 ^ h1 >>> 22 ^ h1 << 30 ^ h1 << 19 ^ h1 << 10)) | 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
h[0] = h[0] + h0 | 0;
|
|
190
|
+
h[1] = h[1] + h1 | 0;
|
|
191
|
+
h[2] = h[2] + h2 | 0;
|
|
192
|
+
h[3] = h[3] + h3 | 0;
|
|
193
|
+
h[4] = h[4] + h4 | 0;
|
|
194
|
+
h[5] = h[5] + h5 | 0;
|
|
195
|
+
h[6] = h[6] + h6 | 0;
|
|
196
|
+
h[7] = h[7] + h7 | 0;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
return sha;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Default = SHA-256 (FIPS 180-4 §6.2, full 256-bit digest = 8 words).
|
|
204
|
+
const _sha256 = _makeSha(_INIT, 8);
|
|
205
|
+
|
|
206
|
+
return /** @type {Sha256API} */ (/** @type {any} */ ({
|
|
207
|
+
// Public API (unchanged).
|
|
208
|
+
fn: _sha256.fn,
|
|
209
|
+
hash: _sha256.hash,
|
|
210
|
+
|
|
211
|
+
// Internal escape hatch - used by sha224.js (FIPS 180-4 §5.3.2)
|
|
212
|
+
// to share the SHA-256 compression function with a custom IV
|
|
213
|
+
// and a 7-word truncated output.
|
|
214
|
+
_internal: { makeSha: _makeSha }
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
};
|