@awacloud/fw 0.1.0 → 1.0.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 +125 -0
- package/NOTICE +8 -0
- package/README.md +163 -31
- package/dist/build/fw.core.pure.meta.json +6 -6
- package/dist/build/fw.core.pure.min.js +15 -12
- package/dist/build/fw.full.pure.meta.json +13 -7
- package/dist/build/fw.full.pure.min.js +45 -42
- package/dist/build/fw.minimal.pure.meta.json +6 -6
- package/dist/build/fw.minimal.pure.min.js +16 -13
- package/dist/build/fw.pack.compress-heavy.pure.meta.json +6 -6
- package/dist/build/fw.pack.compress-heavy.pure.min.js +3 -3
- package/dist/build/fw.pack.crypto-advanced.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-advanced.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-basic.pure.meta.json +6 -6
- package/dist/build/fw.pack.crypto-basic.pure.min.js +1 -1
- package/dist/build/fw.pack.crypto-identity.pure.meta.json +7 -6
- package/dist/build/fw.pack.crypto-identity.pure.min.js +4 -4
- package/dist/build/fw.pwa.pure.meta.json +7 -6
- package/dist/build/fw.pwa.pure.min.js +38 -35
- package/dist/build/fw.site-interactive.pure.meta.json +6 -6
- package/dist/build/fw.site-interactive.pure.min.js +37 -34
- package/dist/build/fw.site.pure.meta.json +6 -6
- package/dist/build/fw.site.pure.min.js +24 -21
- package/dist/build/fw.spa.pure.meta.json +8 -7
- package/dist/build/fw.spa.pure.min.js +41 -38
- package/dist/build/sanity-base-classic.min.js +1 -1
- package/dist/build/sanity.min.js +1 -1
- package/dist/types/core/internal.d.ts +29 -0
- package/dist/types/core/internal.d.ts.map +1 -0
- package/dist/types/core/logger.d.ts +23 -4
- package/dist/types/core/logger.d.ts.map +1 -1
- package/dist/types/core/modules.d.ts +374 -61
- package/dist/types/core/modules.d.ts.map +1 -1
- package/dist/types/core/runtime.d.ts +10 -6
- package/dist/types/core/runtime.d.ts.map +1 -1
- package/dist/types/core/worker-helper.d.ts +35 -0
- package/dist/types/core/worker-helper.d.ts.map +1 -1
- package/dist/types/crypto/cipher/aes.d.ts +1 -7
- package/dist/types/crypto/cipher/aes.d.ts.map +1 -1
- package/dist/types/crypto/cipher/chacha20.d.ts +0 -10
- package/dist/types/crypto/cipher/chacha20.d.ts.map +1 -1
- package/dist/types/crypto/hash/argon2.d.ts +0 -15
- package/dist/types/crypto/hash/argon2.d.ts.map +1 -1
- package/dist/types/crypto/hash/blake2b.d.ts.map +1 -1
- package/dist/types/crypto/hash/hmac.d.ts.map +1 -1
- package/dist/types/crypto/hash/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/hash/poly1305.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha224.d.ts +1 -1
- package/dist/types/crypto/hash/sha256.d.ts +4 -13
- package/dist/types/crypto/hash/sha256.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha3.d.ts.map +1 -1
- package/dist/types/crypto/hash/sha384.d.ts +1 -1
- package/dist/types/crypto/hash/sha512.d.ts +4 -13
- package/dist/types/crypto/hash/sha512.d.ts.map +1 -1
- package/dist/types/crypto/mode/cmac.d.ts +0 -6
- package/dist/types/crypto/mode/cmac.d.ts.map +1 -1
- package/dist/types/crypto/mode/ctr.d.ts +0 -6
- package/dist/types/crypto/mode/ctr.d.ts.map +1 -1
- package/dist/types/crypto/mode/gcm.d.ts +0 -9
- package/dist/types/crypto/mode/gcm.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ecc.d.ts +0 -1
- package/dist/types/crypto/pkc/ecc.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ed25519.d.ts +4 -25
- package/dist/types/crypto/pkc/ed25519.d.ts.map +1 -1
- package/dist/types/crypto/pkc/hybridSign.d.ts +25 -5
- package/dist/types/crypto/pkc/hybridSign.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_dsa.d.ts +6 -26
- package/dist/types/crypto/pkc/ml_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/ml_kem.d.ts +0 -43
- package/dist/types/crypto/pkc/ml_kem.d.ts.map +1 -1
- package/dist/types/crypto/pkc/rsa.d.ts +0 -24
- package/dist/types/crypto/pkc/rsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/slh_dsa.d.ts +6 -16
- package/dist/types/crypto/pkc/slh_dsa.d.ts.map +1 -1
- package/dist/types/crypto/pkc/x25519.d.ts +0 -6
- package/dist/types/crypto/pkc/x25519.d.ts.map +1 -1
- package/dist/types/crypto/utils/bitArray.d.ts +0 -8
- package/dist/types/crypto/utils/bitArray.d.ts.map +1 -1
- package/dist/types/crypto/utils/jws.d.ts +6 -14
- package/dist/types/crypto/utils/jws.d.ts.map +1 -1
- package/dist/types/crypto/utils/keyformat.d.ts +52 -0
- package/dist/types/crypto/utils/keyformat.d.ts.map +1 -1
- package/dist/types/crypto/utils/random.d.ts +1 -10
- package/dist/types/crypto/utils/random.d.ts.map +1 -1
- package/dist/types/crypto/utils/rsaKeygen.d.ts +0 -10
- package/dist/types/crypto/utils/rsaKeygen.d.ts.map +1 -1
- package/dist/types/crypto/utils/uuid.d.ts.map +1 -1
- package/dist/types/crypto/utils/x509.d.ts +397 -0
- package/dist/types/crypto/utils/x509.d.ts.map +1 -0
- package/dist/types/crypto/wasm/argon2.d.ts +2 -1
- package/dist/types/crypto/wasm/argon2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/pbkdf2.d.ts +2 -2
- package/dist/types/crypto/wasm/pbkdf2.d.ts.map +1 -1
- package/dist/types/crypto/wasm/rsa.d.ts.map +1 -1
- package/dist/types/crypto/wasm/runtime.d.ts +13 -0
- package/dist/types/crypto/wasm/runtime.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aes.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/aeskw.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/digest.d.ts +0 -4
- package/dist/types/crypto/webcrypto/digest.d.ts.map +1 -1
- package/dist/types/crypto/webcrypto/rsa.d.ts.map +1 -1
- package/dist/types/dom/fs/fileIntake.d.ts +59 -0
- package/dist/types/dom/fs/fileIntake.d.ts.map +1 -0
- package/dist/types/dom/fs/fsAccess.d.ts.map +1 -1
- package/dist/types/dom/query/dnd.d.ts.map +1 -1
- package/dist/types/dom/query/sound.d.ts +89 -0
- package/dist/types/dom/query/sound.d.ts.map +1 -0
- package/dist/types/dom/rendering/chart.d.ts.map +1 -1
- package/dist/types/dom/rendering/component.d.ts +9 -3
- package/dist/types/dom/rendering/component.d.ts.map +1 -1
- package/dist/types/dom/rendering/parser.d.ts +39 -0
- package/dist/types/dom/rendering/parser.d.ts.map +1 -1
- package/dist/types/dom/rendering/render.d.ts.map +1 -1
- package/dist/types/dom/rendering/sanitize.d.ts +4 -0
- package/dist/types/dom/rendering/sanitize.d.ts.map +1 -1
- package/dist/types/dom/rendering/secPolicy.d.ts.map +1 -1
- package/dist/types/dom/rendering/styleSheet.d.ts +74 -0
- package/dist/types/dom/rendering/styleSheet.d.ts.map +1 -0
- package/dist/types/dom/rendering/template.d.ts +9 -3
- package/dist/types/dom/rendering/template.d.ts.map +1 -1
- package/dist/types/dom/rendering/themeTokens.d.ts +9 -3
- package/dist/types/dom/rendering/themeTokens.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-core.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-core.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession-list.d.ts +9 -3
- package/dist/types/dom/rendering/uiSession-list.d.ts.map +1 -1
- package/dist/types/dom/rendering/uiSession.d.ts +18 -6
- package/dist/types/dom/rendering/uiSession.d.ts.map +1 -1
- package/dist/types/dom/sw/installPrompt.d.ts +89 -0
- package/dist/types/dom/sw/installPrompt.d.ts.map +1 -0
- package/dist/types/dom/sw/precache.d.ts +149 -0
- package/dist/types/dom/sw/precache.d.ts.map +1 -0
- package/dist/types/dom/sw/swUpdate.d.ts +129 -0
- package/dist/types/dom/sw/swUpdate.d.ts.map +1 -0
- package/dist/types/dom/utils/clipboard.d.ts +8 -0
- package/dist/types/dom/utils/clipboard.d.ts.map +1 -1
- package/dist/types/dom/utils/keybindings.d.ts.map +1 -1
- package/dist/types/dom/utils/route.d.ts.map +1 -1
- package/dist/types/dom/utils/ua.d.ts +2 -2
- package/dist/types/dom/utils/ua.d.ts.map +1 -1
- package/dist/types/io/calc/crc32.d.ts.map +1 -1
- package/dist/types/io/codec/b64.d.ts +24 -0
- package/dist/types/io/codec/b64.d.ts.map +1 -1
- package/dist/types/io/codec/cbor.d.ts +1 -0
- package/dist/types/io/codec/cbor.d.ts.map +1 -1
- package/dist/types/io/codec/hex.d.ts.map +1 -1
- package/dist/types/io/codec/msgpack.d.ts +1 -0
- package/dist/types/io/codec/msgpack.d.ts.map +1 -1
- package/dist/types/io/codec/url.d.ts +3 -1
- package/dist/types/io/codec/url.d.ts.map +1 -1
- package/dist/types/io/codec/utf8.d.ts.map +1 -1
- package/dist/types/io/compress/bitstream.d.ts +1 -1
- package/dist/types/io/compress/brotli.d.ts +0 -1
- package/dist/types/io/compress/brotli.d.ts.map +1 -1
- package/dist/types/io/compress/brotli_shared.d.ts +0 -4
- package/dist/types/io/compress/brotli_shared.d.ts.map +1 -1
- package/dist/types/io/compress/deflate.d.ts +14 -1
- package/dist/types/io/compress/deflate.d.ts.map +1 -1
- package/dist/types/io/compress/gzip.d.ts +4 -0
- package/dist/types/io/compress/gzip.d.ts.map +1 -1
- package/dist/types/io/compress/huffman.d.ts +7 -0
- package/dist/types/io/compress/huffman.d.ts.map +1 -1
- package/dist/types/io/compress/lz4.d.ts +4 -2
- package/dist/types/io/compress/lz4.d.ts.map +1 -1
- package/dist/types/io/compress/lz77.d.ts +17 -0
- package/dist/types/io/compress/lz77.d.ts.map +1 -1
- package/dist/types/io/compress/lzw.d.ts +2 -0
- package/dist/types/io/compress/lzw.d.ts.map +1 -1
- package/dist/types/io/compress/zip.d.ts.map +1 -1
- package/dist/types/io/compress/zlib.d.ts +9 -2
- package/dist/types/io/compress/zlib.d.ts.map +1 -1
- package/dist/types/io/math/linalg.d.ts.map +1 -1
- package/dist/types/process/rpc.d.ts.map +1 -1
- package/dist/types/process/workerPool.d.ts.map +1 -1
- package/dist/types/sanity/base.d.ts +12 -2
- package/dist/types/sanity/base.d.ts.map +1 -1
- package/dist/types/sanity/lockdown.d.ts +6 -5
- package/dist/types/sanity/lockdown.d.ts.map +1 -1
- package/dist/types/sanity/wasm-gate.d.ts +1 -1
- package/docs/README.md +17 -10
- package/docs/api/README.md +5 -5
- package/docs/api/core/logger.md +2 -1
- package/docs/api/core/modules.md +3 -3
- package/docs/api/core/runtime.md +9 -9
- package/docs/api/core/worker-helper.md +12 -2
- package/docs/api/crypto/README.md +1 -1
- package/docs/api/crypto/cipher/README.md +2 -2
- package/docs/api/crypto/cipher/aes.md +5 -10
- package/docs/api/crypto/cipher/chacha20.md +3 -8
- package/docs/api/crypto/hash/README.md +5 -5
- package/docs/api/crypto/hash/adf.md +21 -11
- package/docs/api/crypto/hash/argon2.md +3 -12
- package/docs/api/crypto/hash/blake2b.md +12 -14
- package/docs/api/crypto/hash/pbkdf2.md +1 -1
- package/docs/api/crypto/hash/sha224.md +2 -2
- package/docs/api/crypto/hash/sha256.md +4 -4
- package/docs/api/crypto/hash/sha3.md +2 -2
- package/docs/api/crypto/hash/sha384.md +1 -1
- package/docs/api/crypto/hash/sha512.md +5 -5
- package/docs/api/crypto/hash/sha512_224.md +1 -1
- package/docs/api/crypto/hash/sha512_256.md +1 -1
- package/docs/api/crypto/mode/README.md +3 -3
- package/docs/api/crypto/mode/cbc.md +2 -2
- package/docs/api/crypto/mode/chacha20poly1305.md +1 -1
- package/docs/api/crypto/mode/cmac.md +4 -4
- package/docs/api/crypto/mode/ctr.md +2 -3
- package/docs/api/crypto/mode/gcm.md +5 -5
- package/docs/api/crypto/mode/kw.md +4 -4
- package/docs/api/crypto/pkc/README.md +8 -8
- package/docs/api/crypto/pkc/ecc.md +19 -17
- package/docs/api/crypto/pkc/ed25519.md +10 -15
- package/docs/api/crypto/pkc/hybridKem.md +8 -2
- package/docs/api/crypto/pkc/hybridSign.md +34 -7
- package/docs/api/crypto/pkc/ml_dsa.md +20 -19
- package/docs/api/crypto/pkc/ml_kem.md +3 -3
- package/docs/api/crypto/pkc/rsa.md +7 -9
- package/docs/api/crypto/pkc/slh_dsa.md +12 -12
- package/docs/api/crypto/pkc/x25519.md +5 -4
- package/docs/api/crypto/utils/README.md +7 -7
- package/docs/api/crypto/utils/aes_modes.md +2 -5
- package/docs/api/crypto/utils/asn1.md +25 -16
- package/docs/api/crypto/utils/jws.md +6 -4
- package/docs/api/crypto/utils/keyformat.md +24 -15
- package/docs/api/crypto/utils/pad.md +1 -1
- package/docs/api/crypto/utils/pem.md +3 -3
- package/docs/api/crypto/utils/random.md +3 -4
- package/docs/api/crypto/utils/rsaKeygen.md +2 -2
- package/docs/api/crypto/utils/totp.md +2 -2
- package/docs/api/crypto/utils/uuid.md +5 -5
- package/docs/api/crypto/utils/x509.md +124 -0
- package/docs/api/crypto/wasm/aes.md +1 -1
- package/docs/api/crypto/wasm/argon2.md +6 -4
- package/docs/api/crypto/wasm/ml_kem.md +1 -0
- package/docs/api/crypto/wasm/pbkdf2.md +8 -8
- package/docs/api/crypto/wasm/rsa.md +1 -1
- package/docs/api/crypto/wasm/runtime.md +27 -10
- package/docs/api/crypto/webcrypto/aes.md +1 -1
- package/docs/api/crypto/webcrypto/aeskw.md +2 -2
- package/docs/api/crypto/webcrypto/digest.md +3 -5
- package/docs/api/crypto/webcrypto/ecc.md +1 -1
- package/docs/api/crypto/webcrypto/ed25519.md +1 -1
- package/docs/api/crypto/webcrypto/rsa.md +3 -2
- package/docs/api/crypto/webcrypto/x25519.md +1 -1
- package/docs/api/dom/README.md +6 -1
- package/docs/api/dom/fs/README.md +1 -0
- package/docs/api/dom/fs/fileIntake.md +120 -0
- package/docs/api/dom/fs/fsAccess.md +1 -0
- package/docs/api/dom/fs/indexedDB.md +1 -1
- package/docs/api/dom/fs/storage.md +1 -1
- package/docs/api/dom/query/README.md +2 -1
- package/docs/api/dom/query/dnd.md +4 -1
- package/docs/api/dom/query/dom.md +5 -0
- package/docs/api/dom/query/sound.md +103 -0
- package/docs/api/dom/rendering/README.md +4 -3
- package/docs/api/dom/rendering/chart.md +5 -4
- package/docs/api/dom/rendering/component.md +25 -3
- package/docs/api/dom/rendering/parser.md +5 -2
- package/docs/api/dom/rendering/reactiveBind.md +1 -1
- package/docs/api/dom/rendering/render.md +2 -2
- package/docs/api/dom/rendering/sanitize.md +10 -2
- package/docs/api/dom/rendering/secPolicy.md +4 -4
- package/docs/api/dom/rendering/styleSheet.md +85 -0
- package/docs/api/dom/rendering/template.md +20 -5
- package/docs/api/dom/rendering/themeTokens.md +6 -3
- package/docs/api/dom/rendering/uiSession.md +18 -5
- package/docs/api/dom/rendering/virtualScroll.md +2 -2
- package/docs/api/dom/sensors/geolocation.md +1 -1
- package/docs/api/dom/sw/README.md +7 -1
- package/docs/api/dom/sw/cache.md +2 -1
- package/docs/api/dom/sw/installPrompt.md +111 -0
- package/docs/api/dom/sw/precache.md +124 -0
- package/docs/api/dom/sw/serviceWorker.md +4 -2
- package/docs/api/dom/sw/swUpdate.md +112 -0
- package/docs/api/dom/utils/clipboard.md +56 -5
- package/docs/api/dom/utils/entropyCollector.md +1 -1
- package/docs/api/dom/utils/keybindings.md +17 -2
- package/docs/api/dom/utils/leaderElection.md +2 -2
- package/docs/api/dom/utils/route.md +1 -0
- package/docs/api/dom/utils/ua.md +15 -10
- package/docs/api/io/calc/crc32.md +4 -1
- package/docs/api/io/codec/README.md +2 -2
- package/docs/api/io/codec/b64.md +31 -2
- package/docs/api/io/codec/buffer.md +1 -1
- package/docs/api/io/codec/cbor.md +6 -4
- package/docs/api/io/codec/csv.md +178 -178
- package/docs/api/io/codec/hex.md +10 -2
- package/docs/api/io/codec/msgpack.md +4 -3
- package/docs/api/io/codec/url.md +4 -3
- package/docs/api/io/codec/utf8.md +3 -3
- package/docs/api/io/compress/bitstream.md +6 -3
- package/docs/api/io/compress/brotli.md +36 -4
- package/docs/api/io/compress/brotli_shared.md +1 -1
- package/docs/api/io/compress/deflate.md +42 -34
- package/docs/api/io/compress/gzip.md +26 -6
- package/docs/api/io/compress/huffman.md +2 -1
- package/docs/api/io/compress/lz4.md +5 -3
- package/docs/api/io/compress/lz77.md +26 -3
- package/docs/api/io/compress/lzw.md +13 -8
- package/docs/api/io/compress/zip.md +36 -10
- package/docs/api/io/compress/zlib.md +21 -5
- package/docs/api/io/math/linalg.md +1 -1
- package/docs/api/io/utils/valid.md +1 -1
- package/docs/api/process/rpc.md +3 -2
- package/docs/api/process/workerPool.md +1 -1
- package/docs/api/sanity/base.md +9 -5
- package/docs/api/sanity/lockdown.md +7 -6
- package/docs/api/surface.json +12311 -0
- package/docs/api/typed.md +5 -3
- package/docs/dev/README.md +2 -0
- package/docs/dev/bench.md +76 -0
- package/docs/dev/crypto-references.md +54 -0
- package/docs/dev/provenance.md +30 -7
- package/docs/dev/publishing.md +7 -7
- package/docs/dev/runtime.md +1 -1
- package/docs/dev/testing.md +13 -0
- package/docs/evidence/l4-evidence.md +86 -0
- package/docs/evidence/pqc-hybrid-evidence.md +7 -6
- package/docs/guide/README.md +1 -0
- package/docs/guide/_QUICK_REF.md +5 -5
- package/docs/guide/doc-format.md +4 -3
- package/docs/guide/integrations-hmr.md +1 -1
- package/docs/guide/module-creation-workflow.md +8 -8
- package/docs/guide/rendering-pipeline.md +11 -4
- package/docs/guide/security.md +7 -5
- package/docs/guide/stability.md +123 -0
- package/docs/guide/tutorial-todo.md +20 -8
- package/docs/guide/typescript.md +9 -0
- package/docs/guide/worker-confinement.md +30 -17
- package/docs/notes/lz77-deflate-factorization.md +3 -3
- package/docs/tools/README.md +1 -1
- package/docs/tools/bundler.md +3 -3
- package/docs/tools/codegen.md +1 -1
- package/docs/tools/standalone.md +0 -1
- package/fw.config.json +2 -2
- package/integrations/_shared/catalog.generated.json +7 -1
- package/integrations/_shared/core.js +1 -1
- package/integrations/astro/index.js +1 -1
- package/integrations/eslint/README.md +7 -1
- package/integrations/nextjs/index.js +1 -1
- package/integrations/nodejs/README.md +3 -3
- package/integrations/turbopack/index.js +2 -2
- package/integrations/typedoc/categorize.js +1 -1
- package/integrations/typedoc/typedoc.json +2 -1
- package/integrations/vite/index.js +2 -2
- package/integrations/vite/vite-env.d.ts +7 -4
- package/integrations/webpack/index.js +3 -3
- package/package.json +76 -10
- package/src/core/internal.js +31 -0
- package/src/core/logger.js +95 -23
- package/src/core/modules.js +17 -8
- package/src/core/readyState.js +1 -1
- package/src/core/runtime.js +74 -27
- package/src/core/worker-helper.js +83 -4
- package/src/crypto/NIST_CONFORMANCE.md +47 -34
- package/src/crypto/cipher/aes.acvp.md +7 -8
- package/src/crypto/cipher/aes.js +280 -229
- package/src/crypto/cipher/chacha20.acvp.md +6 -7
- package/src/crypto/cipher/chacha20.js +91 -61
- package/src/crypto/hash/adf.js +1 -1
- package/src/crypto/hash/argon2.acvp.md +11 -15
- package/src/crypto/hash/argon2.js +9 -24
- package/src/crypto/hash/blake2b.js +157 -125
- package/src/crypto/hash/hkdf.acvp.md +15 -15
- package/src/crypto/hash/hkdf.js +1 -1
- package/src/crypto/hash/hmac.acvp.md +10 -12
- package/src/crypto/hash/hmac.js +5 -1
- package/src/crypto/hash/pbkdf2.acvp.md +13 -13
- package/src/crypto/hash/pbkdf2.js +36 -8
- package/src/crypto/hash/poly1305.acvp.md +10 -6
- package/src/crypto/hash/poly1305.js +171 -50
- package/src/crypto/hash/sha224.acvp.md +3 -3
- package/src/crypto/hash/sha224.js +4 -4
- package/src/crypto/hash/sha256.acvp.md +2 -2
- package/src/crypto/hash/sha256.js +514 -50
- package/src/crypto/hash/sha3.acvp.md +9 -9
- package/src/crypto/hash/sha3.js +127 -71
- package/src/crypto/hash/sha384.acvp.md +3 -3
- package/src/crypto/hash/sha384.js +4 -4
- package/src/crypto/hash/sha512.acvp.md +7 -8
- package/src/crypto/hash/sha512.js +107 -108
- package/src/crypto/hash/sha512_224.acvp.md +6 -6
- package/src/crypto/hash/sha512_224.js +2 -2
- package/src/crypto/hash/sha512_256.acvp.md +6 -6
- package/src/crypto/hash/sha512_256.js +2 -2
- package/src/crypto/mode/cbc.acvp.md +2 -2
- package/src/crypto/mode/cbc.js +1 -1
- package/src/crypto/mode/chacha20poly1305.acvp.md +6 -6
- package/src/crypto/mode/chacha20poly1305.js +3 -3
- package/src/crypto/mode/cmac.acvp.md +5 -5
- package/src/crypto/mode/cmac.js +8 -8
- package/src/crypto/mode/ctr.acvp.md +2 -2
- package/src/crypto/mode/ctr.js +1 -3
- package/src/crypto/mode/gcm.acvp.md +6 -6
- package/src/crypto/mode/gcm.js +7 -7
- package/src/crypto/mode/kw.acvp.md +4 -4
- package/src/crypto/mode/kw.js +5 -5
- package/src/crypto/pkc/ecc.acvp.md +13 -13
- package/src/crypto/pkc/ecc.js +9 -11
- package/src/crypto/pkc/ed25519.acvp.md +30 -34
- package/src/crypto/pkc/ed25519.js +453 -94
- package/src/crypto/pkc/hybrid-kat.provenance.md +4 -4
- package/src/crypto/pkc/hybridSign.js +103 -24
- package/src/crypto/pkc/ml_dsa.acvp.md +18 -18
- package/src/crypto/pkc/ml_dsa.js +29 -32
- package/src/crypto/pkc/ml_kem.acvp.md +7 -7
- package/src/crypto/pkc/ml_kem.js +15 -21
- package/src/crypto/pkc/rsa.acvp.md +11 -15
- package/src/crypto/pkc/rsa.js +7 -44
- package/src/crypto/pkc/slh_dsa.acvp.md +16 -16
- package/src/crypto/pkc/slh_dsa.js +16 -18
- package/src/crypto/pkc/x25519.acvp.md +13 -10
- package/src/crypto/pkc/x25519.js +273 -29
- package/src/crypto/utils/aes_modes.acvp.md +1 -2
- package/src/crypto/utils/aes_modes.js +2 -2
- package/src/crypto/utils/asn1-oid.js +1 -1
- package/src/crypto/utils/asn1.js +1 -1
- package/src/crypto/utils/bitArray.js +33 -48
- package/src/crypto/utils/bn.js +1 -1
- package/src/crypto/utils/jws.js +37 -41
- package/src/crypto/utils/keyformat.js +181 -2
- package/src/crypto/utils/pem.js +1 -1
- package/src/crypto/utils/random.acvp.md +5 -5
- package/src/crypto/utils/random.js +845 -846
- package/src/crypto/utils/rsaKeygen.acvp.md +3 -2
- package/src/crypto/utils/rsaKeygen.js +6 -6
- package/src/crypto/utils/totp.js +1 -1
- package/src/crypto/utils/uuid.acvp.md +5 -5
- package/src/crypto/utils/uuid.js +11 -10
- package/src/crypto/utils/x509.js +591 -0
- package/src/crypto/wasm/aes.js +1 -1
- package/src/crypto/wasm/aes.scalar.wasm +0 -0
- package/src/crypto/wasm/argon2.js +17 -1
- package/src/crypto/wasm/argon2.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.scalar.wasm +0 -0
- package/src/crypto/wasm/blake2b.simd.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.scalar.wasm +0 -0
- package/src/crypto/wasm/chacha20poly1305.simd.wasm +0 -0
- package/src/crypto/wasm/cmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ecc.js +3 -3
- package/src/crypto/wasm/ecc.scalar.wasm +0 -0
- package/src/crypto/wasm/ed25519.js +1 -1
- package/src/crypto/wasm/ed25519.scalar.wasm +0 -0
- package/src/crypto/wasm/hkdf.scalar.wasm +0 -0
- package/src/crypto/wasm/hmac.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.js +2 -2
- package/src/crypto/wasm/ml_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_dsa.simd.wasm +0 -0
- package/src/crypto/wasm/ml_kem.js +2 -2
- package/src/crypto/wasm/ml_kem.scalar.wasm +0 -0
- package/src/crypto/wasm/ml_kem.simd.wasm +0 -0
- package/src/crypto/wasm/pbkdf2.js +8 -6
- package/src/crypto/wasm/pbkdf2.scalar.wasm +0 -0
- package/src/crypto/wasm/rsa.js +6 -5
- package/src/crypto/wasm/rsa.scalar.wasm +0 -0
- package/src/crypto/wasm/runtime.js +84 -17
- package/src/crypto/wasm/sha2.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.scalar.wasm +0 -0
- package/src/crypto/wasm/sha3.simd.wasm +0 -0
- package/src/crypto/wasm/slh_dsa.js +1 -1
- package/src/crypto/wasm/slh_dsa.scalar.wasm +0 -0
- package/src/crypto/wasm/x25519.js +1 -1
- package/src/crypto/wasm/x25519.scalar.wasm +0 -0
- package/src/crypto/webcrypto/aes.js +8 -2
- package/src/crypto/webcrypto/aeskw.js +7 -2
- package/src/crypto/webcrypto/digest.js +1 -15
- package/src/crypto/webcrypto/ecc.js +2 -2
- package/src/crypto/webcrypto/ed25519.js +2 -2
- package/src/crypto/webcrypto/hmac.js +2 -2
- package/src/crypto/webcrypto/rsa.js +7 -2
- package/src/crypto/webcrypto/x25519.js +2 -2
- package/src/dom/display/animate.js +1 -1
- package/src/dom/display/fullscreen.js +1 -1
- package/src/dom/fs/download.js +1 -1
- package/src/dom/fs/fileIntake.js +192 -0
- package/src/dom/fs/fsAccess.js +2 -3
- package/src/dom/fs/indexedDB.js +1 -1
- package/src/dom/fs/remoteStore.js +1 -1
- package/src/dom/fs/storage.js +1 -1
- package/src/dom/lifecycle/idle.js +1 -1
- package/src/dom/lifecycle/visibility.js +1 -1
- package/src/dom/lifecycle/wakeLock.js +1 -1
- package/src/dom/net/ajax.js +1 -1
- package/src/dom/net/network.js +1 -1
- package/src/dom/net/sse.js +1 -1
- package/src/dom/net/webrtc.js +1 -1
- package/src/dom/net/ws.js +1 -1
- package/src/dom/query/dnd.js +56 -4
- package/src/dom/query/dom.js +1 -1
- package/src/dom/query/events.js +1 -1
- package/src/dom/query/gesture.js +1 -1
- package/src/dom/query/media.js +1 -1
- package/src/dom/query/sound.js +333 -0
- package/src/dom/rendering/chart.js +736 -663
- package/src/dom/rendering/component.js +25 -14
- package/src/dom/rendering/devtools.js +2 -2
- package/src/dom/rendering/parser.js +155 -12
- package/src/dom/rendering/render.js +14 -4
- package/src/dom/rendering/sanitize.js +11 -4
- package/src/dom/rendering/secPolicy.js +6 -4
- package/src/dom/rendering/styleSheet.js +217 -0
- package/src/dom/rendering/template.js +72 -13
- package/src/dom/rendering/themeTokens.js +542 -522
- package/src/dom/rendering/uiSession-core.js +51 -6
- package/src/dom/rendering/uiSession-direct.js +1 -1
- package/src/dom/rendering/uiSession-list.js +4 -4
- package/src/dom/rendering/uiSession.js +1 -1
- package/src/dom/rendering/virtualScroll.js +341 -341
- package/src/dom/sensors/battery.js +1 -1
- package/src/dom/sensors/geolocation.js +1 -1
- package/src/dom/sensors/networkInfo.js +1 -1
- package/src/dom/sensors/sensors.js +1 -1
- package/src/dom/sw/backgroundSync.js +1 -1
- package/src/dom/sw/cache.js +1 -1
- package/src/dom/sw/installPrompt.js +151 -0
- package/src/dom/sw/precache.js +257 -0
- package/src/dom/sw/push.js +1 -1
- package/src/dom/sw/sharedWorker.js +1 -1
- package/src/dom/sw/swUpdate.js +239 -0
- package/src/dom/utils/a11y.js +1 -1
- package/src/dom/utils/clipboard.js +56 -6
- package/src/dom/utils/entropyCollector.js +1 -1
- package/src/dom/utils/focus.js +1 -1
- package/src/dom/utils/form.js +1 -1
- package/src/dom/utils/keybindings.js +600 -574
- package/src/dom/utils/leaderElection.js +1 -1
- package/src/dom/utils/notifications.js +1 -1
- package/src/dom/utils/permissions.js +107 -107
- package/src/dom/utils/route.js +14 -2
- package/src/dom/utils/ua.js +42 -28
- package/src/dom/utils/webauthn.js +1 -1
- package/src/io/binary/reader.js +1 -1
- package/src/io/binary/writer.js +1 -1
- package/src/io/calc/bigint.js +1 -1
- package/src/io/calc/crc32.js +28 -2
- package/src/io/calc/easing.js +514 -514
- package/src/io/codec/b64.js +189 -52
- package/src/io/codec/base32.js +1 -1
- package/src/io/codec/base58.js +1 -1
- package/src/io/codec/buffer.js +1 -1
- package/src/io/codec/cbor.js +111 -18
- package/src/io/codec/csv.js +1 -1
- package/src/io/codec/hex.js +51 -6
- package/src/io/codec/mime.js +1 -1
- package/src/io/codec/msgpack.js +47 -6
- package/src/io/codec/url.js +24 -7
- package/src/io/codec/utf8.js +5 -3
- package/src/io/codec/xml.js +1 -1
- package/src/io/compress/bitstream.js +2 -2
- package/src/io/compress/brotli.js +663 -163
- package/src/io/compress/brotli_dict.js +1 -1
- package/src/io/compress/brotli_dict_words.js +1 -1
- package/src/io/compress/brotli_frame.js +1 -1
- package/src/io/compress/brotli_shared.js +7 -7
- package/src/io/compress/deflate.js +87 -53
- package/src/io/compress/gzip.js +187 -74
- package/src/io/compress/huffman.js +24 -1
- package/src/io/compress/lz4.js +45 -7
- package/src/io/compress/lz77.js +148 -63
- package/src/io/compress/lzw.js +35 -19
- package/src/io/compress/zip.js +862 -815
- package/src/io/compress/zlib.js +87 -7
- package/src/io/i18n/i18n.js +1 -1
- package/src/io/math/fixed-point.js +1 -1
- package/src/io/math/geom.js +1 -1
- package/src/io/math/interp.js +1 -1
- package/src/io/math/linalg.js +10 -4
- package/src/io/math/stats.js +1 -1
- package/src/io/structures/btree.js +1 -1
- package/src/io/structures/heap.js +1 -1
- package/src/io/structures/lruCache.js +1 -1
- package/src/io/structures/ringBuffer.js +1 -1
- package/src/io/structures/tree-walker.js +1 -1
- package/src/io/structures/trie.js +1 -1
- package/src/io/sync/abort.js +1 -1
- package/src/io/sync/atomics.js +1 -1
- package/src/io/sync/cancellable.js +1 -1
- package/src/io/sync/channel.js +1 -1
- package/src/io/sync/mutex.js +1 -1
- package/src/io/sync/semaphore.js +1 -1
- package/src/io/sync/tokenBucket.js +1 -1
- package/src/io/text/ansi.js +1 -1
- package/src/io/text/html-entities.js +1 -1
- package/src/io/time/date.js +1 -1
- package/src/io/timing/clock.js +1 -1
- package/src/io/timing/rateLimit.js +1 -1
- package/src/io/timing/scheduler.js +1 -1
- package/src/io/utils/errors.js +1 -1
- package/src/io/utils/eventBus.js +1 -1
- package/src/io/utils/signal.js +1 -1
- package/src/io/utils/valid.js +1 -1
- package/src/main.js +1 -1
- package/src/process/message.js +1 -1
- package/src/process/rpc.js +7 -3
- package/src/process/workerPool.js +11 -4
- package/src/sanity/base.js +85 -39
- package/src/sanity/lockdown-apply.js +3 -3
- package/src/sanity/lockdown.js +58 -32
- package/src/sanity/wasm-gate.js +2 -2
- package/src/typed.js +7 -3
- package/third-party/NOTICE-brotli-dictionary.txt +69 -0
- package/third-party/NOTICE-fw-wasm-crypto.txt +576 -0
- package/third-party/NOTICE-whatwg-entities.txt +44 -0
- package/types/registry.generated.d.ts +7 -1
- package/types/typed.d.ts +7 -3
- package/dist/types/crypto/utils/aes_ctr.d.ts +0 -84
- package/dist/types/crypto/utils/aes_ctr.d.ts.map +0 -1
- package/docs/api/crypto/utils/aes_ctr.md +0 -71
- package/src/crypto/utils/aes_ctr.acvp.md +0 -67
- package/src/crypto/utils/aes_ctr.js +0 -134
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
- `verify(key, msg, tag)` → `true | false`. Constant-time comparison
|
|
30
30
|
via `bitArray.equal` or accumulated XOR.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Implemented on ten 13-bit limbs (modulo p = 2¹³⁰−5): products exact in
|
|
33
|
+
doubles, the block loop unrolled on locals, the final reduction by mask —
|
|
34
|
+
no `BigInt` (it was, until it became the AEAD's bottleneck and a timing
|
|
35
|
+
concern: `BigInt` operations run in value-dependent time).
|
|
33
36
|
|
|
34
37
|
## Test coverage
|
|
35
38
|
|
|
@@ -78,10 +81,10 @@ BigInt implementation (modulo p = 2¹³⁰−5).
|
|
|
78
81
|
scope**: protection is the responsibility of the AEAD wrapper
|
|
79
82
|
ChaCha20-Poly1305 (see mode/chacha20poly1305.js, which derives a
|
|
80
83
|
distinct `(r,s)` per ChaCha20 nonce).
|
|
81
|
-
- [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
- [x] **No secret-dependent branch or index** — a fixed sequence of
|
|
85
|
+
limb arithmetic, the `h ≥ p` reduction by mask; a structural test
|
|
86
|
+
pins the absence of `BigInt`. The engine-level timing of double
|
|
87
|
+
arithmetic cannot be guaranteed from JavaScript.
|
|
85
88
|
|
|
86
89
|
## FIPS 140-3 conformance
|
|
87
90
|
|
|
@@ -99,7 +102,8 @@ BigInt implementation (modulo p = 2¹³⁰−5).
|
|
|
99
102
|
- **One-time MAC**: security depends on the uniqueness of `(r,s)` per
|
|
100
103
|
message. Our module enforces nothing — caller responsibility or
|
|
101
104
|
AEAD wrapper.
|
|
102
|
-
- **
|
|
105
|
+
- **Engine-level timing**: the limb arithmetic is branch-free; what the
|
|
106
|
+
engine does with double arithmetic cannot be guaranteed from JavaScript.
|
|
103
107
|
|
|
104
108
|
## Cross references
|
|
105
109
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -12,18 +12,12 @@
|
|
|
12
12
|
* The 32-byte one-time key splits as `r || s`. `r` is "clamped" before use
|
|
13
13
|
* (mask 0x0FFFFFFC...0FFFFFFC0FFFFFFF...) per spec.
|
|
14
14
|
*
|
|
15
|
-
* Implemented
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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
|
-
*
|
|
15
|
+
* Implemented on ten 13-bit limbs over GF(2^130 - 5): each product of
|
|
16
|
+
* limbs stays below 2^30 and each column of ten below 2^34, so every value
|
|
17
|
+
* is exact in a double. The computation is a fixed sequence of arithmetic
|
|
18
|
+
* (the final reduction by mask): no branch and no index depends on the key
|
|
19
|
+
* or the message. `verify` compares the tags by XOR-accumulation over all
|
|
20
|
+
* 16 bytes. Callers MUST NOT reuse `(r, s)` keys across messages.
|
|
27
21
|
*/
|
|
28
22
|
|
|
29
23
|
/**
|
|
@@ -45,58 +39,185 @@ export const poly1305 = {
|
|
|
45
39
|
/** @returns {Poly1305API} */
|
|
46
40
|
factory() {
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
// GF(2^130 - 5) on ten 13-bit limbs (RFC 8439 §2.5 arithmetic): a
|
|
43
|
+
// product of limbs stays below 2^30 and a column of ten below 2^34,
|
|
44
|
+
// exact in doubles; 2^130 ≡ 5 folds the high columns back. Every
|
|
45
|
+
// step is a fixed sequence of arithmetic — no branch and no index
|
|
46
|
+
// depends on the key or the message.
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
return v;
|
|
48
|
+
/** Bits [13i, 13i + 13) of the little-endian bytes `b` at `o`, 19 bytes readable. */
|
|
49
|
+
function _limb(b, o, i) {
|
|
50
|
+
const bit = 13 * i, at = o + (bit >> 3);
|
|
51
|
+
return ((b[at] | (b[at + 1] << 8) | (b[at + 2] << 16)) >>> (bit & 7)) & 0x1fff;
|
|
58
52
|
}
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
const _blk = new Uint8Array(19); // one block (+ the 2^(8n) bit) and 2 spare bytes
|
|
55
|
+
const _h = new Float64Array(10), _r = new Float64Array(10), _d = new Float64Array(10); // h, r, scratch
|
|
56
|
+
|
|
57
|
+
/** Two full carry passes: every limb below 2^13, h below 2^130. */
|
|
58
|
+
function _carryFull(h) {
|
|
59
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
60
|
+
let c = 0;
|
|
61
|
+
for (let i = 0; i < 10; i++) {
|
|
62
|
+
const v = h[i] + c;
|
|
63
|
+
c = Math.floor(v / 8192);
|
|
64
|
+
h[i] = v - c * 8192;
|
|
65
|
+
}
|
|
66
|
+
h[0] += 5 * c;
|
|
67
|
+
}
|
|
68
|
+
let c = 0;
|
|
69
|
+
for (let i = 0; i < 10; i++) {
|
|
70
|
+
const v = h[i] + c;
|
|
71
|
+
c = Math.floor(v / 8192);
|
|
72
|
+
h[i] = v - c * 8192;
|
|
66
73
|
}
|
|
67
|
-
return out;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
76
|
/**
|
|
71
|
-
* Compute Poly1305
|
|
72
|
-
* @param {Uint8Array} key 32-byte one-time key.
|
|
73
|
-
* @param {Uint8Array} msg Message
|
|
74
|
-
* @returns {Uint8Array|false} 16-byte tag, or false on
|
|
77
|
+
* Compute the Poly1305 tag of `msg` under a 32-byte one-time key.
|
|
78
|
+
* @param {Uint8Array} key 32-byte one-time key (`r || s`).
|
|
79
|
+
* @param {Uint8Array} msg Message.
|
|
80
|
+
* @returns {Uint8Array|false} 16-byte tag, or `false` on a bad key.
|
|
75
81
|
*/
|
|
76
82
|
function mac(key, msg) {
|
|
77
83
|
if (!(key instanceof Uint8Array) || key.length !== 32) {
|
|
78
84
|
console.warn('[crypto] INVALID: poly1305: key must be 32 bytes');
|
|
79
85
|
return false;
|
|
80
86
|
}
|
|
87
|
+
// r, clamped (RFC 8439 §2.5): the top 4 bits of bytes 3, 7, 11, 15
|
|
88
|
+
// and the low 2 bits of bytes 4, 8, 12 cleared.
|
|
89
|
+
const rb = new Uint8Array(19);
|
|
90
|
+
rb.set(key.subarray(0, 16));
|
|
91
|
+
rb[3] &= 15; rb[7] &= 15; rb[11] &= 15; rb[15] &= 15;
|
|
92
|
+
rb[4] &= 252; rb[8] &= 252; rb[12] &= 252;
|
|
93
|
+
for (let i = 0; i < 10; i++) { _r[i] = _limb(rb, 0, i); _h[i] = 0; }
|
|
81
94
|
|
|
82
|
-
const r = _bytesToBigIntLE(key.subarray(0, 16)) & _CLAMP;
|
|
83
|
-
const s = _bytesToBigIntLE(key.subarray(16, 32));
|
|
84
|
-
|
|
85
|
-
let acc = 0n;
|
|
86
95
|
const len = msg.length;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
// h = (h + block) · r mod p per 16-byte block, unrolled on locals
|
|
97
|
+
// (generated: the same integer products as a loop over the limbs).
|
|
98
|
+
let h0 = 0, h1 = 0, h2 = 0, h3 = 0, h4 = 0, h5 = 0, h6 = 0, h7 = 0, h8 = 0, h9 = 0;
|
|
99
|
+
const r0 = _r[0], r1 = _r[1], r2 = _r[2], r3 = _r[3], r4 = _r[4], r5 = _r[5], r6 = _r[6], r7 = _r[7], r8 = _r[8], r9 = _r[9];
|
|
100
|
+
const s1 = 5 * r1, s2 = 5 * r2, s3 = 5 * r3, s4 = 5 * r4, s5 = 5 * r5, s6 = 5 * r6, s7 = 5 * r7, s8 = 5 * r8, s9 = 5 * r9;
|
|
101
|
+
const full = len - (len % 16);
|
|
102
|
+
for (let off = 0; off < full; off += 16) {
|
|
103
|
+
// A whole block: its limbs straight from `msg`, + 2^128.
|
|
104
|
+
h0 += (((msg[off + 0]) | (msg[off + 1] << 8) | (msg[off + 2] << 16)) & 0x1fff);
|
|
105
|
+
h1 += ((((msg[off + 1]) | (msg[off + 2] << 8) | (msg[off + 3] << 16)) >>> 5) & 0x1fff);
|
|
106
|
+
h2 += ((((msg[off + 3]) | (msg[off + 4] << 8) | (msg[off + 5] << 16)) >>> 2) & 0x1fff);
|
|
107
|
+
h3 += ((((msg[off + 4]) | (msg[off + 5] << 8) | (msg[off + 6] << 16)) >>> 7) & 0x1fff);
|
|
108
|
+
h4 += ((((msg[off + 6]) | (msg[off + 7] << 8) | (msg[off + 8] << 16)) >>> 4) & 0x1fff);
|
|
109
|
+
h5 += ((((msg[off + 8]) | (msg[off + 9] << 8) | (msg[off + 10] << 16)) >>> 1) & 0x1fff);
|
|
110
|
+
h6 += ((((msg[off + 9]) | (msg[off + 10] << 8) | (msg[off + 11] << 16)) >>> 6) & 0x1fff);
|
|
111
|
+
h7 += ((((msg[off + 11]) | (msg[off + 12] << 8) | (msg[off + 13] << 16)) >>> 3) & 0x1fff);
|
|
112
|
+
h8 += (((msg[off + 13]) | (msg[off + 14] << 8) | (msg[off + 15] << 16)) & 0x1fff);
|
|
113
|
+
h9 += ((((msg[off + 14]) | (msg[off + 15] << 8) | (1 << 16)) >>> 5) & 0x1fff);
|
|
114
|
+
const d0 = h0 * r0 + h1 * s9 + h2 * s8 + h3 * s7 + h4 * s6 + h5 * s5 + h6 * s4 + h7 * s3 + h8 * s2 + h9 * s1;
|
|
115
|
+
const d1 = h0 * r1 + h1 * r0 + h2 * s9 + h3 * s8 + h4 * s7 + h5 * s6 + h6 * s5 + h7 * s4 + h8 * s3 + h9 * s2;
|
|
116
|
+
const d2 = h0 * r2 + h1 * r1 + h2 * r0 + h3 * s9 + h4 * s8 + h5 * s7 + h6 * s6 + h7 * s5 + h8 * s4 + h9 * s3;
|
|
117
|
+
const d3 = h0 * r3 + h1 * r2 + h2 * r1 + h3 * r0 + h4 * s9 + h5 * s8 + h6 * s7 + h7 * s6 + h8 * s5 + h9 * s4;
|
|
118
|
+
const d4 = h0 * r4 + h1 * r3 + h2 * r2 + h3 * r1 + h4 * r0 + h5 * s9 + h6 * s8 + h7 * s7 + h8 * s6 + h9 * s5;
|
|
119
|
+
const d5 = h0 * r5 + h1 * r4 + h2 * r3 + h3 * r2 + h4 * r1 + h5 * r0 + h6 * s9 + h7 * s8 + h8 * s7 + h9 * s6;
|
|
120
|
+
const d6 = h0 * r6 + h1 * r5 + h2 * r4 + h3 * r3 + h4 * r2 + h5 * r1 + h6 * r0 + h7 * s9 + h8 * s8 + h9 * s7;
|
|
121
|
+
const d7 = h0 * r7 + h1 * r6 + h2 * r5 + h3 * r4 + h4 * r3 + h5 * r2 + h6 * r1 + h7 * r0 + h8 * s9 + h9 * s8;
|
|
122
|
+
const d8 = h0 * r8 + h1 * r7 + h2 * r6 + h3 * r5 + h4 * r4 + h5 * r3 + h6 * r2 + h7 * r1 + h8 * r0 + h9 * s9;
|
|
123
|
+
const d9 = h0 * r9 + h1 * r8 + h2 * r7 + h3 * r6 + h4 * r5 + h5 * r4 + h6 * r3 + h7 * r2 + h8 * r1 + h9 * r0;
|
|
124
|
+
let c = 0, v;
|
|
125
|
+
v = d0 + c; c = Math.floor(v / 8192); h0 = v - c * 8192;
|
|
126
|
+
v = d1 + c; c = Math.floor(v / 8192); h1 = v - c * 8192;
|
|
127
|
+
v = d2 + c; c = Math.floor(v / 8192); h2 = v - c * 8192;
|
|
128
|
+
v = d3 + c; c = Math.floor(v / 8192); h3 = v - c * 8192;
|
|
129
|
+
v = d4 + c; c = Math.floor(v / 8192); h4 = v - c * 8192;
|
|
130
|
+
v = d5 + c; c = Math.floor(v / 8192); h5 = v - c * 8192;
|
|
131
|
+
v = d6 + c; c = Math.floor(v / 8192); h6 = v - c * 8192;
|
|
132
|
+
v = d7 + c; c = Math.floor(v / 8192); h7 = v - c * 8192;
|
|
133
|
+
v = d8 + c; c = Math.floor(v / 8192); h8 = v - c * 8192;
|
|
134
|
+
v = d9 + c; c = Math.floor(v / 8192); h9 = v - c * 8192;
|
|
135
|
+
v = h0 + 5 * c; c = Math.floor(v / 8192); h0 = v - c * 8192; h1 += c;
|
|
96
136
|
}
|
|
137
|
+
if (full < len) {
|
|
138
|
+
// The last, partial block: copied, 0x01 after it, zeros up to 17 bytes.
|
|
139
|
+
const n = len - full;
|
|
140
|
+
_blk.fill(0);
|
|
141
|
+
for (let i = 0; i < n; i++) _blk[i] = msg[full + i];
|
|
142
|
+
_blk[n] = 1;
|
|
143
|
+
h0 += _limb(_blk, 0, 0);
|
|
144
|
+
h1 += _limb(_blk, 0, 1);
|
|
145
|
+
h2 += _limb(_blk, 0, 2);
|
|
146
|
+
h3 += _limb(_blk, 0, 3);
|
|
147
|
+
h4 += _limb(_blk, 0, 4);
|
|
148
|
+
h5 += _limb(_blk, 0, 5);
|
|
149
|
+
h6 += _limb(_blk, 0, 6);
|
|
150
|
+
h7 += _limb(_blk, 0, 7);
|
|
151
|
+
h8 += _limb(_blk, 0, 8);
|
|
152
|
+
h9 += _limb(_blk, 0, 9);
|
|
153
|
+
const d0 = h0 * r0 + h1 * s9 + h2 * s8 + h3 * s7 + h4 * s6 + h5 * s5 + h6 * s4 + h7 * s3 + h8 * s2 + h9 * s1;
|
|
154
|
+
const d1 = h0 * r1 + h1 * r0 + h2 * s9 + h3 * s8 + h4 * s7 + h5 * s6 + h6 * s5 + h7 * s4 + h8 * s3 + h9 * s2;
|
|
155
|
+
const d2 = h0 * r2 + h1 * r1 + h2 * r0 + h3 * s9 + h4 * s8 + h5 * s7 + h6 * s6 + h7 * s5 + h8 * s4 + h9 * s3;
|
|
156
|
+
const d3 = h0 * r3 + h1 * r2 + h2 * r1 + h3 * r0 + h4 * s9 + h5 * s8 + h6 * s7 + h7 * s6 + h8 * s5 + h9 * s4;
|
|
157
|
+
const d4 = h0 * r4 + h1 * r3 + h2 * r2 + h3 * r1 + h4 * r0 + h5 * s9 + h6 * s8 + h7 * s7 + h8 * s6 + h9 * s5;
|
|
158
|
+
const d5 = h0 * r5 + h1 * r4 + h2 * r3 + h3 * r2 + h4 * r1 + h5 * r0 + h6 * s9 + h7 * s8 + h8 * s7 + h9 * s6;
|
|
159
|
+
const d6 = h0 * r6 + h1 * r5 + h2 * r4 + h3 * r3 + h4 * r2 + h5 * r1 + h6 * r0 + h7 * s9 + h8 * s8 + h9 * s7;
|
|
160
|
+
const d7 = h0 * r7 + h1 * r6 + h2 * r5 + h3 * r4 + h4 * r3 + h5 * r2 + h6 * r1 + h7 * r0 + h8 * s9 + h9 * s8;
|
|
161
|
+
const d8 = h0 * r8 + h1 * r7 + h2 * r6 + h3 * r5 + h4 * r4 + h5 * r3 + h6 * r2 + h7 * r1 + h8 * r0 + h9 * s9;
|
|
162
|
+
const d9 = h0 * r9 + h1 * r8 + h2 * r7 + h3 * r6 + h4 * r5 + h5 * r4 + h6 * r3 + h7 * r2 + h8 * r1 + h9 * r0;
|
|
163
|
+
let c = 0, v;
|
|
164
|
+
v = d0 + c; c = Math.floor(v / 8192); h0 = v - c * 8192;
|
|
165
|
+
v = d1 + c; c = Math.floor(v / 8192); h1 = v - c * 8192;
|
|
166
|
+
v = d2 + c; c = Math.floor(v / 8192); h2 = v - c * 8192;
|
|
167
|
+
v = d3 + c; c = Math.floor(v / 8192); h3 = v - c * 8192;
|
|
168
|
+
v = d4 + c; c = Math.floor(v / 8192); h4 = v - c * 8192;
|
|
169
|
+
v = d5 + c; c = Math.floor(v / 8192); h5 = v - c * 8192;
|
|
170
|
+
v = d6 + c; c = Math.floor(v / 8192); h6 = v - c * 8192;
|
|
171
|
+
v = d7 + c; c = Math.floor(v / 8192); h7 = v - c * 8192;
|
|
172
|
+
v = d8 + c; c = Math.floor(v / 8192); h8 = v - c * 8192;
|
|
173
|
+
v = d9 + c; c = Math.floor(v / 8192); h9 = v - c * 8192;
|
|
174
|
+
v = h0 + 5 * c; c = Math.floor(v / 8192); h0 = v - c * 8192; h1 += c;
|
|
175
|
+
}
|
|
176
|
+
const h = _h;
|
|
177
|
+
h[0] = h0;
|
|
178
|
+
h[1] = h1;
|
|
179
|
+
h[2] = h2;
|
|
180
|
+
h[3] = h3;
|
|
181
|
+
h[4] = h4;
|
|
182
|
+
h[5] = h5;
|
|
183
|
+
h[6] = h6;
|
|
184
|
+
h[7] = h7;
|
|
185
|
+
h[8] = h8;
|
|
186
|
+
h[9] = h9;
|
|
187
|
+
|
|
188
|
+
// h mod p: h < 2^130 after the carries, so h - p = h + 5 - 2^130 is
|
|
189
|
+
// kept, by mask, exactly when h + 5 reaches 2^130.
|
|
190
|
+
_carryFull(h);
|
|
191
|
+
const g = _d;
|
|
192
|
+
let c = 5;
|
|
193
|
+
for (let i = 0; i < 10; i++) {
|
|
194
|
+
const v = h[i] + c;
|
|
195
|
+
c = v >>> 13;
|
|
196
|
+
g[i] = v & 0x1fff;
|
|
197
|
+
}
|
|
198
|
+
const keep = -c; // -1: take g, 0: keep h
|
|
199
|
+
for (let i = 0; i < 10; i++) h[i] = (h[i] & ~keep) | (g[i] & keep);
|
|
97
200
|
|
|
98
|
-
|
|
99
|
-
|
|
201
|
+
// (h mod 2^128) + s, little-endian.
|
|
202
|
+
const out = new Uint8Array(16);
|
|
203
|
+
let acc = 0, bits = 0, k = 0;
|
|
204
|
+
for (let i = 0; i < 10 && k < 16; i++) {
|
|
205
|
+
acc += h[i] * Math.pow(2, bits);
|
|
206
|
+
bits += 13;
|
|
207
|
+
while (bits >= 8 && k < 16) {
|
|
208
|
+
out[k++] = acc & 255;
|
|
209
|
+
acc = Math.floor(acc / 256);
|
|
210
|
+
bits -= 8;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
let carry = 0;
|
|
214
|
+
for (let i = 0; i < 16; i++) {
|
|
215
|
+
const v = out[i] + key[16 + i] + carry;
|
|
216
|
+
out[i] = v & 255;
|
|
217
|
+
carry = v >> 8;
|
|
218
|
+
}
|
|
219
|
+
for (let i = 0; i < 10; i++) { _h[i] = 0; _r[i] = 0; _d[i] = 0; }
|
|
220
|
+
return out;
|
|
100
221
|
}
|
|
101
222
|
|
|
102
223
|
/**
|
|
@@ -104,8 +225,8 @@ export const poly1305 = {
|
|
|
104
225
|
* 16 bytes with no early exit, so the running time depends only on
|
|
105
226
|
* the (fixed) tag length, not on which byte mismatches first.
|
|
106
227
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
228
|
+
* `mac` is itself a fixed sequence of limb arithmetic (see the
|
|
229
|
+
* module header).
|
|
109
230
|
*
|
|
110
231
|
* @param {Uint8Array} key 32-byte one-time key.
|
|
111
232
|
* @param {Uint8Array} msg Message.
|
|
@@ -14,7 +14,7 @@ SHA-224 hash (FIPS 180-4 §6.3). Identical to SHA-256 except for the IV (FIPS 18
|
|
|
14
14
|
|
|
15
15
|
**Architecture (post-upgrade audit Finding 1 resolved)**: `factory(sha256)` →
|
|
16
16
|
`{ fn, hash }`. Thin wrapper (~14 useful LOC) over
|
|
17
|
-
`sha256.
|
|
17
|
+
`internalOf(sha256).makeSha(_INIT_224, 7)`. **Previously**: this module
|
|
18
18
|
duplicated the ~80 LOC of the compression function "to preserve
|
|
19
19
|
streaming-state independence" — inconsistent with sha512_224/256, which
|
|
20
20
|
reuse sha512 via factory injection with no observed bug. Sharing the
|
|
@@ -41,7 +41,7 @@ The SHA2-224 AFT enumerates 512 messages at lengths `[0..65535]` bits — **433/
|
|
|
41
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
42
|
- **Volume cap**: tests > 32000 bits filtered out (except the `max(len)=65535` anchor, which is kept) to bound the test file size.
|
|
43
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)**:
|
|
44
|
+
- **LDT (testGroup 3)**: tcId=514 (1 GiB of repeated `e788c962d3e8ff55`) integrated behind `CRYPTO_FULL=1`. Validates the 64-bit `_length` counter over ≥ 2³³ bits.
|
|
45
45
|
|
|
46
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
47
|
|
|
@@ -68,7 +68,7 @@ Non-byte-aligned vectors are decoded via `bitArray.clamp(ui8_to_ba(bytes), bitLe
|
|
|
68
68
|
|
|
69
69
|
## Known limitations
|
|
70
70
|
|
|
71
|
-
- ~~**LDT not integrated**~~ — resolved
|
|
71
|
+
- ~~**LDT not integrated**~~ — resolved: tcId=514 (1 GiB) runs under `CRYPTO_FULL=1` and passes byte-exact.
|
|
72
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
73
|
- **"alternate" MCT version** not tested (ACVP provides `"standard"` here).
|
|
74
74
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// Copyright (c) 2026 AwaCloud SAS
|
|
2
2
|
// Author: Matthieu Bouilloux
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Block size: 512 bits (identical to SHA-256, required for HMAC-SHA-224).
|
|
13
13
|
*
|
|
14
14
|
* **Architecture (post-upgrade audit)**: this module is now a thin wrapper
|
|
15
|
-
* over `
|
|
15
|
+
* over the `makeSha(_INIT_224, 7)` of sha256's internal slot - previously it duplicated
|
|
16
16
|
* the 80 LOC of the compression function. Mirrors the
|
|
17
17
|
* `sha512_224.js` / `sha512_256.js` pattern.
|
|
18
18
|
*
|
|
@@ -33,7 +33,7 @@ import { sha256 } from './sha256.js';
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Object returned by `sha224.factory()` (delegates to `
|
|
36
|
+
* Object returned by `sha224.factory()` (delegates to the `makeSha` of sha256's internal slot).
|
|
37
37
|
* @typedef {object} Sha224API
|
|
38
38
|
* @property {new (hash?: Sha224Hasher) => Sha224Hasher} fn Streaming hasher constructor (optional arg clones an existing instance).
|
|
39
39
|
* @property {(data: number[]|string) => number[]} hash One-shot hash; returns the 224-bit digest as a bitArray.
|
|
@@ -55,6 +55,6 @@ export const sha224 = {
|
|
|
55
55
|
];
|
|
56
56
|
|
|
57
57
|
// outWords = 7 → 7 × 32-bit = 224 bits (FIPS 180-4 §6.3 truncation).
|
|
58
|
-
return sha256.
|
|
58
|
+
return sha256[Symbol.for('@awacloud/fw/internal')].makeSha(_INIT_224, 7);
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -38,7 +38,7 @@ The SHA2-256 AFT enumerates 512 messages at pseudo-random lengths in `[1720..121
|
|
|
38
38
|
- **Regular stride**: tcId 1, 9, 17, …, 505, 512 (one in 8) — uniformly covers the range.
|
|
39
39
|
- **Anchors**: `min(len)` and `max(len)` explicitly added (already within the regular stride here, by chance).
|
|
40
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)**:
|
|
41
|
+
- **LDT (testGroup 3)**: 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
42
|
|
|
43
43
|
### Security properties tested
|
|
44
44
|
|
|
@@ -62,7 +62,7 @@ The SHA2-256 AFT enumerates 512 messages at pseudo-random lengths in `[1720..121
|
|
|
62
62
|
|
|
63
63
|
## Known limitations
|
|
64
64
|
|
|
65
|
-
- ~~**LDT not integrated**~~ — resolved
|
|
65
|
+
- ~~**LDT not integrated**~~ — resolved: tcId=514 (1 GiB) runs under `CRYPTO_FULL=1` and passes byte-exact (~11 s).
|
|
66
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
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
68
|
|