@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
package/src/crypto/wasm/ecc.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* A thin, opt-in accelerator over the colocated `ecc` binary (vendored from
|
|
10
10
|
* `@awacloud/fw-wasm-crypto`: fiat-crypto machine-verified field arithmetic framed by
|
|
11
11
|
* BearSSL's EC layer), loaded BY NAME through the fw `wasmRuntime` adapter
|
|
12
|
-
* (
|
|
12
|
+
* (no fw-local `.wasm.js`). Mirrors the pure-JS `crypto/pkc/ecc`
|
|
13
13
|
* surface for the recommended prime curves — keygen / ECDSA sign+verify / ECDH —
|
|
14
14
|
* over `Uint8Array`, async, no-throw.
|
|
15
15
|
*
|
|
@@ -126,13 +126,13 @@ export const wasmEcc = {
|
|
|
126
126
|
'P-521': { id: 2, flen: 66 },
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
-
/** Default curve (
|
|
129
|
+
/** Default curve (P-256). */
|
|
130
130
|
const _DEFAULT_CURVE = 'P-256';
|
|
131
131
|
|
|
132
132
|
/** Allowed ECDSA hash sizes (SHA-2 family the shim supports). */
|
|
133
133
|
const _HASHES = { 256: true, 384: true, 512: true };
|
|
134
134
|
|
|
135
|
-
/** Default hash size (
|
|
135
|
+
/** Default hash size (SHA-256). */
|
|
136
136
|
const _DEFAULT_HASH = 256;
|
|
137
137
|
|
|
138
138
|
/** Entropy staged for `ecdsa_keygen` rejection sampling (generous). */
|
|
Binary file
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* A thin, opt-in accelerator over the colocated `ed25519` binary (vendored from
|
|
10
10
|
* `@awacloud/fw-wasm-crypto`: libsodium ref10 framed by the package's arena + SHA-512
|
|
11
11
|
* seam + staged-entropy rng seam), loaded BY NAME through the fw `wasmRuntime`
|
|
12
|
-
* adapter (
|
|
12
|
+
* adapter (no fw-local `.wasm.js`). Mirrors the pure-JS
|
|
13
13
|
* `crypto/pkc/ed25519` surface for the Ed25519 signature scheme — keygen / sign
|
|
14
14
|
* / verify — over `Uint8Array`, async, no-throw.
|
|
15
15
|
*
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* A thin, opt-in accelerator over the colocated `ml_dsa` binary (vendored from
|
|
9
9
|
* `@awacloud/fw-wasm-crypto`: PQClean ml-dsa-{44,65,87}), loaded BY NAME through the fw
|
|
10
|
-
* `wasmRuntime` adapter (
|
|
10
|
+
* `wasmRuntime` adapter (no fw-local `.wasm.js`). Post-quantum
|
|
11
11
|
* Module-Lattice-based Digital Signature Algorithm — the algorithm WebCrypto
|
|
12
12
|
* does NOT cover. Mirrors the pure-JS `crypto/pkc/ml_dsa` surface
|
|
13
13
|
* (keygen/sign/verify over `Uint8Array`), async, no-throw.
|
|
@@ -94,7 +94,7 @@ export const wasmMlDsa = {
|
|
|
94
94
|
87: { ps: 2, pk: 2592, sk: 4896, sig: 4627 },
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
/** Default parameter set (
|
|
97
|
+
/** Default parameter set (ML-DSA-65). */
|
|
98
98
|
const _DEFAULT = 65;
|
|
99
99
|
|
|
100
100
|
// ── helpers ────────────────────────────────────────────────────────
|
|
Binary file
|
|
Binary file
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Opt-in WASM accelerator for the pure-JS [`ml_kem`](../pkc/ml_kem.js) module.
|
|
9
9
|
* A thin async wrapper over the colocated `ml_kem` binary (vendored from `@awacloud/fw-wasm-crypto`),
|
|
10
|
-
* loaded BY NAME through {@link wasmRuntime} (
|
|
10
|
+
* loaded BY NAME through {@link wasmRuntime} (there is NO
|
|
11
11
|
* fw-local `ml_kem.wasm.js`; the bytes are colocated
|
|
12
12
|
* (`./ml_kem.{simd,scalar}.wasm`, vendored from the package build). Implements FIPS 203 (CRYSTALS-Kyber) for
|
|
13
13
|
* the three parameter sets ML-KEM-512 / 768 / 1024.
|
|
14
14
|
*
|
|
15
15
|
* Post-quantum KEM — NOT covered by WebCrypto. The large lattice / NTT inner
|
|
16
16
|
* loops are where WASM-SIMD beats pure JS, so this is the primary accelerator
|
|
17
|
-
* for the algorithm
|
|
17
|
+
* for the algorithm.
|
|
18
18
|
*
|
|
19
19
|
* ─── No-throw async contract ───
|
|
20
20
|
*
|
|
Binary file
|
|
Binary file
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
* Public surface of `wasmPbkdf2.factory()`.
|
|
49
49
|
* @typedef {object} WasmPbkdf2API
|
|
50
50
|
* @property {() => boolean} isAvailable Whether `WebAssembly` is present.
|
|
51
|
-
* @property {(password: Uint8Array, salt: Uint8Array,
|
|
52
|
-
* Derive `
|
|
51
|
+
* @property {(password: Uint8Array, salt: Uint8Array, lengthBits: number, iterations?: number, hash?: 256|384|512) => Promise<Uint8Array|false>} deriveBits
|
|
52
|
+
* Derive `lengthBits / 8` bytes via PBKDF2-HMAC-SHA-{256|384|512}. Resolves
|
|
53
53
|
* `false` on invalid params, load failure, or WASM error — never rejects.
|
|
54
54
|
*/
|
|
55
55
|
|
|
@@ -118,12 +118,13 @@ export const wasmPbkdf2 = {
|
|
|
118
118
|
*
|
|
119
119
|
* @param {Uint8Array} password Passphrase bytes (empty is valid).
|
|
120
120
|
* @param {Uint8Array} salt Salt bytes (empty is valid; ≥ 16 recommended).
|
|
121
|
-
* @param {number}
|
|
121
|
+
* @param {number} lengthBits Derived key length in **bits**, a positive
|
|
122
|
+
* multiple of 8 — the unit of the pure and WebCrypto tiers (D9 G5).
|
|
122
123
|
* @param {number} [iterations] Iteration count ≥ 1 (default: 600000).
|
|
123
124
|
* @param {256|384|512} [hash] PRF selector (default: 256 = HMAC-SHA-256).
|
|
124
125
|
* @returns {Promise<Uint8Array|false>}
|
|
125
126
|
*/
|
|
126
|
-
async function deriveBits(password, salt,
|
|
127
|
+
async function deriveBits(password, salt, lengthBits, iterations, hash) {
|
|
127
128
|
|
|
128
129
|
// ── parameter validation ─────────────────────────────────────────
|
|
129
130
|
if (!(password instanceof Uint8Array)) {
|
|
@@ -143,10 +144,11 @@ export const wasmPbkdf2 = {
|
|
|
143
144
|
return false;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
if (typeof
|
|
147
|
-
console.error('[crypto] INVALID: wasmPbkdf2:
|
|
147
|
+
if (typeof lengthBits !== 'number' || !Number.isInteger(lengthBits) || lengthBits < 8 || lengthBits % 8 !== 0) {
|
|
148
|
+
console.error('[crypto] INVALID: wasmPbkdf2: lengthBits must be a positive multiple of 8');
|
|
148
149
|
return false;
|
|
149
150
|
}
|
|
151
|
+
const dkLen = lengthBits / 8;
|
|
150
152
|
|
|
151
153
|
const hashId = (hash === undefined || hash === null) ? 256 : hash;
|
|
152
154
|
if (!_VALID_HASH_IDS.includes(hashId)) {
|
|
Binary file
|
package/src/crypto/wasm/rsa.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* A thin, opt-in wrapper over the colocated `rsa` binary (vendored from
|
|
10
10
|
* `@awacloud/fw-wasm-crypto`: BearSSL i31 + an EMSA-PSS padding layer), loaded BY
|
|
11
|
-
* NAME through the fw `wasmRuntime` adapter (
|
|
12
|
-
*
|
|
11
|
+
* NAME through the fw `wasmRuntime` adapter (no fw-local `.wasm.js`,
|
|
12
|
+
* dependency on `wasmRuntime` only). WebCrypto covers RSA in
|
|
13
13
|
* hardware; this module only matters where `crypto.subtle` is absent
|
|
14
14
|
* (non-secure-context, locked-down workers). Pure-JS `crypto/pkc/rsa` stays
|
|
15
15
|
* the universal default. Async, `Uint8Array`, no-throw.
|
|
@@ -123,13 +123,13 @@ export const wasmRsa = {
|
|
|
123
123
|
/** Supported SHA-2 digest sizes → WebCrypto algorithm name. */
|
|
124
124
|
const _HASH = { 256: 'SHA-256', 384: 'SHA-384', 512: 'SHA-512' };
|
|
125
125
|
|
|
126
|
-
/** Default digest
|
|
126
|
+
/** Default digest. */
|
|
127
127
|
const _DEFAULT_HASH = 256;
|
|
128
128
|
|
|
129
129
|
/** Supported modulus sizes (bits). */
|
|
130
130
|
const _MODULI = { 2048: true, 3072: true, 4096: true };
|
|
131
131
|
|
|
132
|
-
/** Default modulus
|
|
132
|
+
/** Default modulus. */
|
|
133
133
|
const _DEFAULT_BITS = 2048;
|
|
134
134
|
|
|
135
135
|
/** Public exponent the keygen ABI uses (fixed F4). */
|
|
@@ -468,7 +468,8 @@ export const wasmRsa = {
|
|
|
468
468
|
lenBuf.ptr,
|
|
469
469
|
]);
|
|
470
470
|
if (rc !== 0) {
|
|
471
|
-
|
|
471
|
+
// OAEP decoding failure: an expected outcome, warn level.
|
|
472
|
+
console.warn(`[crypto] CORRUPT: wasmRsa.decrypt: decryption failed (rc=${rc})`);
|
|
472
473
|
return false;
|
|
473
474
|
}
|
|
474
475
|
const ptLen = _readI32(loaded, lenBuf.ptr);
|
|
Binary file
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @fileoverview `wasmRuntime` — the shared fw adapter every `crypto/wasm/*`
|
|
7
7
|
* wrapper loads its binary through.
|
|
8
8
|
*
|
|
9
|
-
* ARCHITECTURE (2026-06-22
|
|
10
|
-
*
|
|
9
|
+
* ARCHITECTURE (2026-06-22; it replaced a "thin adapter over
|
|
10
|
+
* @awacloud/fw-wasm-crypto" model): the `.wasm` binaries are
|
|
11
11
|
* **colocated assets** committed next to this module
|
|
12
12
|
* (`<wasmModule>.{simd,scalar}.wasm`), copied from `@awacloud/fw-wasm-crypto`'s
|
|
13
13
|
* `dist/`. fw is **self-contained at runtime** — it fetches the colocated asset
|
|
@@ -53,6 +53,21 @@
|
|
|
53
53
|
* Worker-safe: pure factory; `WebAssembly` exists in workers; binary bytes are
|
|
54
54
|
* fetched by name (resolved from `import.meta.url`), not closed over from the
|
|
55
55
|
* main thread.
|
|
56
|
+
*
|
|
57
|
+
* ─── Asset base ───
|
|
58
|
+
*
|
|
59
|
+
* The binaries are fetched from this module's own directory by default. A
|
|
60
|
+
* build that inlines the factory elsewhere, a CDN or a Worker served from
|
|
61
|
+
* another place names the directory instead: `configure({ baseUrl })` for
|
|
62
|
+
* every later load (the algorithm wrappers included), or `{ baseUrl }` on one
|
|
63
|
+
* `load`. The base is an absolute URL; it is a place to fetch from, never
|
|
64
|
+
* bytes, so it stays open under `lockdown()`.
|
|
65
|
+
*
|
|
66
|
+
* Every `load` fetches and compiles afresh. A compile memo was measured and
|
|
67
|
+
* withheld: under JavaScriptCore, `chacha20poly1305.simd.wasm` returns a wrong
|
|
68
|
+
* Poly1305 tag from the 7th call on one `WebAssembly.Module` (V8 is correct;
|
|
69
|
+
* `wasm/chacha-simd-jsc.test.js` pins it), and a fresh module per load never
|
|
70
|
+
* reaches that state.
|
|
56
71
|
*/
|
|
57
72
|
|
|
58
73
|
/**
|
|
@@ -79,6 +94,9 @@
|
|
|
79
94
|
* Per-call load options.
|
|
80
95
|
* @typedef {object} WasmLoadOptions
|
|
81
96
|
* @property {"simd" | "scalar"} [variant] force a variant; default = runtime selection
|
|
97
|
+
* @property {string | URL} [baseUrl] absolute URL of the directory holding the
|
|
98
|
+
* binaries, for this call (default: the `configure` base, else this module's
|
|
99
|
+
* directory)
|
|
82
100
|
* @property {(wasmModule: string, variant: string) => Promise<Uint8Array>} [fetchBytes]
|
|
83
101
|
* injectable byte source (test seam); default fetches the colocated
|
|
84
102
|
* `<wasmModule>.<variant>.wasm` relative to this module.
|
|
@@ -98,6 +116,9 @@
|
|
|
98
116
|
* @property {(loaded: WasmLoaded, fnName: string, args: number[]) => number} run
|
|
99
117
|
* Call an export and return its `i32` status. A throw propagates to the
|
|
100
118
|
* caller's try/catch (the per-algo wrapper's no-throw boundary).
|
|
119
|
+
* @property {(opts: { baseUrl: string | URL | null }) => void} configure
|
|
120
|
+
* Set the asset base every later `load` uses (`null` restores this module's
|
|
121
|
+
* directory). Throws `TypeError` when the base is not an absolute URL.
|
|
101
122
|
*/
|
|
102
123
|
|
|
103
124
|
export const wasmRuntime = {
|
|
@@ -131,6 +152,41 @@ export const wasmRuntime = {
|
|
|
131
152
|
/** @type {boolean|undefined} memoized simd128 support. */
|
|
132
153
|
let _simd;
|
|
133
154
|
|
|
155
|
+
/** @type {string|null} the `configure` base (`null` = this module's directory). */
|
|
156
|
+
let _base = null;
|
|
157
|
+
|
|
158
|
+
/** A module name selects a binary; it never carries a path. */
|
|
159
|
+
const NAME_RE = /^[a-z0-9_]+$/;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Normalise an asset base: an absolute URL naming a directory.
|
|
163
|
+
* @param {unknown} baseUrl
|
|
164
|
+
* @returns {string} the href, ending with `/`
|
|
165
|
+
* @throws {TypeError} when `baseUrl` is not an absolute URL
|
|
166
|
+
*/
|
|
167
|
+
function _absoluteBase(baseUrl) {
|
|
168
|
+
if (typeof baseUrl !== 'string' && !(baseUrl instanceof URL)) {
|
|
169
|
+
throw new TypeError('wasmRuntime: baseUrl must be an absolute URL');
|
|
170
|
+
}
|
|
171
|
+
let href;
|
|
172
|
+
try {
|
|
173
|
+
href = new URL(String(baseUrl)).href;
|
|
174
|
+
} catch {
|
|
175
|
+
throw new TypeError('wasmRuntime: baseUrl must be an absolute URL, got "' + String(baseUrl) + '"');
|
|
176
|
+
}
|
|
177
|
+
return href.endsWith('/') ? href : href + '/';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Set (or, with `null`, clear) the asset base every later `load` uses.
|
|
182
|
+
* @param {{ baseUrl: string | URL | null }} opts
|
|
183
|
+
* @returns {void}
|
|
184
|
+
*/
|
|
185
|
+
function configure(opts) {
|
|
186
|
+
const b = opts ? opts.baseUrl : undefined;
|
|
187
|
+
_base = b === null || b === undefined ? null : _absoluteBase(b);
|
|
188
|
+
}
|
|
189
|
+
|
|
134
190
|
/**
|
|
135
191
|
* Lazy, memoised handle to the fw wasm capability seam
|
|
136
192
|
* (`sanity/wasm-gate.js`). A dynamic `import()` INSIDE the factory
|
|
@@ -209,18 +265,25 @@ export const wasmRuntime = {
|
|
|
209
265
|
}
|
|
210
266
|
|
|
211
267
|
/**
|
|
212
|
-
* Fetch
|
|
213
|
-
* (resolved via `import.meta.url`, like
|
|
214
|
-
* `URL` build — browser/worker safe, no
|
|
268
|
+
* Fetch `<wasmModule>.<variant>.wasm` from `base`, or next to this
|
|
269
|
+
* module when `base` is `null` (resolved via `import.meta.url`, like
|
|
270
|
+
* `brotli_dict_words.js`). Pure `URL` build — browser/worker safe, no
|
|
271
|
+
* `node:*`.
|
|
215
272
|
* @param {string} wasmModule
|
|
216
273
|
* @param {string} variant
|
|
274
|
+
* @param {string|null} base absolute directory URL, or `null`
|
|
217
275
|
* @returns {Promise<Uint8Array>}
|
|
218
276
|
*/
|
|
219
|
-
async function _fetchBytes(wasmModule, variant) {
|
|
220
|
-
|
|
221
|
-
'
|
|
222
|
-
|
|
223
|
-
|
|
277
|
+
async function _fetchBytes(wasmModule, variant, base) {
|
|
278
|
+
if (!NAME_RE.test(wasmModule)) {
|
|
279
|
+
throw new Error('invalid module name "' + wasmModule + '"');
|
|
280
|
+
}
|
|
281
|
+
// The default keeps the literal `import.meta.url` form: static
|
|
282
|
+
// asset scanners (site-kit's dist module graph) find the binaries
|
|
283
|
+
// through exactly this call shape.
|
|
284
|
+
const url = base
|
|
285
|
+
? new URL(wasmModule + '.' + variant + '.wasm', base)
|
|
286
|
+
: new URL('./' + wasmModule + '.' + variant + '.wasm', import.meta.url);
|
|
224
287
|
const res = await fetch(url);
|
|
225
288
|
if (!res || !res.ok) {
|
|
226
289
|
const status = res ? res.status : 'no-response';
|
|
@@ -244,7 +307,7 @@ export const wasmRuntime = {
|
|
|
244
307
|
* Compile / instantiate / module-reflection are routed through the fw
|
|
245
308
|
* wasm capability seam (`sanity/wasm-gate.js`) — the only path left open
|
|
246
309
|
* once `lockdown()` poisons the ambient `WebAssembly` evaluators (the
|
|
247
|
-
* async four, and, since
|
|
310
|
+
* async four, and, since 2026-07, the synchronous `Module`/
|
|
248
311
|
* `Instance` constructors too), so this loader keeps working under
|
|
249
312
|
* lockdown while caller-supplied bytes still have no route in.
|
|
250
313
|
* `opts.fetchBytes` is a documented test seam before `lockdown()`; the
|
|
@@ -269,8 +332,12 @@ export const wasmRuntime = {
|
|
|
269
332
|
gate.assertByteSource(opts);
|
|
270
333
|
|
|
271
334
|
const variant = _selectVariant(opts);
|
|
272
|
-
const
|
|
273
|
-
|
|
335
|
+
const base = opts && opts.baseUrl !== undefined && opts.baseUrl !== null
|
|
336
|
+
? _absoluteBase(opts.baseUrl)
|
|
337
|
+
: _base;
|
|
338
|
+
const bytes = opts && opts.fetchBytes
|
|
339
|
+
? await opts.fetchBytes(wasmModule, variant)
|
|
340
|
+
: await _fetchBytes(wasmModule, variant, base);
|
|
274
341
|
|
|
275
342
|
const module = await gate.compile(cap, bytes);
|
|
276
343
|
|
|
@@ -286,9 +353,9 @@ export const wasmRuntime = {
|
|
|
286
353
|
const result = await gate.instantiate(cap, module, {});
|
|
287
354
|
// Post-lockdown, the global `WebAssembly.Instance` is a throwing
|
|
288
355
|
// shim (`poisonSyncConstructors`), so `instanceof` would silently
|
|
289
|
-
// return false rather than throw (
|
|
290
|
-
//
|
|
291
|
-
//
|
|
356
|
+
// return false rather than throw (the gate exposes no captured
|
|
357
|
+
// `Instance`: its export surface is frozen at 8). Test the SHAPE
|
|
358
|
+
// instead: a
|
|
292
359
|
// `{module, instance}` source carries a truthy `.instance`; a bare
|
|
293
360
|
// `Instance` does not.
|
|
294
361
|
const instance = result.instance ? result.instance : result;
|
|
@@ -395,6 +462,6 @@ export const wasmRuntime = {
|
|
|
395
462
|
return fn(...(args || []));
|
|
396
463
|
}
|
|
397
464
|
|
|
398
|
-
return { isAvailable, hasSimd, load, withBytes, readBytes, run };
|
|
465
|
+
return { isAvailable, hasSimd, load, withBytes, readBytes, run, configure };
|
|
399
466
|
},
|
|
400
467
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (`slh_dsa_{sha2,shake}_{128,192,256}{f,s}`) so the two surfaces are
|
|
14
14
|
* interchangeable — see {@link SUPPORTED}.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* The binary is the colocated
|
|
17
17
|
* `./slh_dsa.scalar.wasm` (vendored from `@awacloud/fw-wasm-crypto`), loaded BY NAME via
|
|
18
18
|
* `wasmRuntime.load('slh_dsa', …)`. There is NO fw-local `slh_dsa.wasm.js`.
|
|
19
19
|
* SLH-DSA is hash-bound (`simd:false` in the package manifest), so only the
|
|
Binary file
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* A thin, opt-in accelerator over the colocated `x25519` binary (vendored from
|
|
11
11
|
* `@awacloud/fw-wasm-crypto`: libsodium curve25519 ref10 closure, impl-struct-direct,
|
|
12
12
|
* no runtime dispatcher), loaded BY NAME through the fw `wasmRuntime` adapter
|
|
13
|
-
* (
|
|
13
|
+
* (no fw-local `.wasm.js`). Provides keygen + X25519 scalar
|
|
14
14
|
* multiplication (shared secret derivation) over `Uint8Array`, async, no-throw.
|
|
15
15
|
*
|
|
16
16
|
* This is the **Tier-2 fallback** for environments where `crypto.subtle` is
|
|
Binary file
|
|
@@ -93,6 +93,12 @@ export const webcryptoAes = {
|
|
|
93
93
|
*/
|
|
94
94
|
function _fail(method, e) {
|
|
95
95
|
const msg = e instanceof Error ? e.message : String(e);
|
|
96
|
+
if (method.startsWith('decrypt') && e && /** @type {{name?: string}} */ (e).name === 'OperationError') {
|
|
97
|
+
// WebCrypto rejects a failed authentication with OperationError:
|
|
98
|
+
// an expected outcome, reported at warn level (logging policy).
|
|
99
|
+
console.warn('[crypto] CORRUPT: webcryptoAes.' + method + ': authentication failed');
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
96
102
|
console.error('[crypto] FAIL: webcryptoAes.' + method + ': ' + msg);
|
|
97
103
|
return false;
|
|
98
104
|
}
|
|
@@ -114,7 +120,7 @@ export const webcryptoAes = {
|
|
|
114
120
|
*
|
|
115
121
|
* @param {'GCM'|'CBC'|'CTR'} mode AES mode.
|
|
116
122
|
* @param {128|192|256} [lengthBits=256] Key length in bits.
|
|
117
|
-
* @param {boolean} [extractable=
|
|
123
|
+
* @param {boolean} [extractable=false] Whether the key can be exported.
|
|
118
124
|
* @returns {Promise<CryptoKey|false>}
|
|
119
125
|
*/
|
|
120
126
|
async function generateKey(mode, lengthBits, extractable) {
|
|
@@ -124,7 +130,7 @@ export const webcryptoAes = {
|
|
|
124
130
|
if (length !== 128 && length !== 192 && length !== 256) {
|
|
125
131
|
return _invalid('invalid key length ' + length + ' (must be 128, 192, or 256)');
|
|
126
132
|
}
|
|
127
|
-
const isExtractable = extractable ??
|
|
133
|
+
const isExtractable = extractable ?? false;
|
|
128
134
|
try {
|
|
129
135
|
return await crypto.subtle.generateKey(
|
|
130
136
|
{ name: 'AES-' + mode, length },
|
|
@@ -63,10 +63,10 @@ export const webcryptoAesKw = {
|
|
|
63
63
|
* Generate a new AES-KW key-encryption key.
|
|
64
64
|
*
|
|
65
65
|
* @param {128|192|256} [lengthBits=256] KEK size in bits.
|
|
66
|
-
* @param {boolean} [extractable=
|
|
66
|
+
* @param {boolean} [extractable=false] Whether the CryptoKey may be exported.
|
|
67
67
|
* @returns {Promise<CryptoKey|false>}
|
|
68
68
|
*/
|
|
69
|
-
async function generateKek(lengthBits = 256, extractable =
|
|
69
|
+
async function generateKek(lengthBits = 256, extractable = false) {
|
|
70
70
|
if (!_hasSubtle) {
|
|
71
71
|
console.error('[crypto] NOT READY: crypto.subtle unavailable');
|
|
72
72
|
return false;
|
|
@@ -175,6 +175,11 @@ export const webcryptoAesKw = {
|
|
|
175
175
|
usages
|
|
176
176
|
);
|
|
177
177
|
} catch (e) {
|
|
178
|
+
if (e && e.name === 'OperationError') {
|
|
179
|
+
// Integrity failure of the wrapped key: an expected outcome.
|
|
180
|
+
console.warn('[crypto] CORRUPT: webcryptoAesKw.unwrapKey: integrity check failed');
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
178
183
|
console.error('[crypto] FAIL: webcryptoAesKw.unwrapKey: ' + (e && e.message));
|
|
179
184
|
return false;
|
|
180
185
|
}
|
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
* @property {(data: Uint8Array) => Promise<Uint8Array|false>} sha256 SHA-256 shorthand.
|
|
29
29
|
* @property {(data: Uint8Array) => Promise<Uint8Array|false>} sha384 SHA-384 shorthand.
|
|
30
30
|
* @property {(data: Uint8Array) => Promise<Uint8Array|false>} sha512 SHA-512 shorthand.
|
|
31
|
-
* @property {(data: Uint8Array) => Promise<Uint8Array|false>} sha1
|
|
32
|
-
* SHA-1 shorthand — emits a deprecation warning; use SHA-256+ for new code.
|
|
33
31
|
*/
|
|
34
32
|
|
|
35
33
|
export const webcryptoDigest = {
|
|
@@ -119,18 +117,6 @@ export const webcryptoDigest = {
|
|
|
119
117
|
return digest('SHA-512', data);
|
|
120
118
|
}
|
|
121
119
|
|
|
122
|
-
|
|
123
|
-
* SHA-1 digest of `data`.
|
|
124
|
-
*
|
|
125
|
-
* @deprecated SHA-1 is cryptographically broken; use SHA-256+ for new code.
|
|
126
|
-
* @param {Uint8Array} data
|
|
127
|
-
* @returns {Promise<Uint8Array|false>}
|
|
128
|
-
*/
|
|
129
|
-
function sha1(data) {
|
|
130
|
-
console.warn('[crypto] DEPRECATED: SHA-1 is broken; use SHA-256+');
|
|
131
|
-
return digest('SHA-1', data);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return { isAvailable, digest, sha256, sha384, sha512, sha1 };
|
|
120
|
+
return { isAvailable, digest, sha256, sha384, sha512 };
|
|
135
121
|
}
|
|
136
122
|
};
|
|
@@ -103,10 +103,10 @@ export const webcryptoEcc = {
|
|
|
103
103
|
*
|
|
104
104
|
* @param {'ECDSA'|'ECDH'} kind
|
|
105
105
|
* @param {'P-256'|'P-384'|'P-521'} [curve='P-256']
|
|
106
|
-
* @param {boolean} [extractable=
|
|
106
|
+
* @param {boolean} [extractable=false]
|
|
107
107
|
* @returns {Promise<CryptoKeyPair|false>}
|
|
108
108
|
*/
|
|
109
|
-
async function generateKey(kind, curve = 'P-256', extractable =
|
|
109
|
+
async function generateKey(kind, curve = 'P-256', extractable = false) {
|
|
110
110
|
if (!_ready()) return false;
|
|
111
111
|
if (!_KINDS.has(kind)) {
|
|
112
112
|
console.error(`[crypto] INVALID: webcryptoEcc.generateKey: unsupported kind '${kind}'`);
|
|
@@ -69,10 +69,10 @@ export const webcryptoEd25519 = {
|
|
|
69
69
|
* - `crypto.subtle` is unavailable
|
|
70
70
|
* - The runtime does not support `'Ed25519'` (subtle rejects → caught → false)
|
|
71
71
|
*
|
|
72
|
-
* @param {boolean} [extractable=
|
|
72
|
+
* @param {boolean} [extractable=false]
|
|
73
73
|
* @returns {Promise<CryptoKeyPair|false>}
|
|
74
74
|
*/
|
|
75
|
-
async function generateKey(extractable =
|
|
75
|
+
async function generateKey(extractable = false) {
|
|
76
76
|
if (!_hasSubtle) {
|
|
77
77
|
console.error('[crypto] NOT READY: crypto.subtle unavailable');
|
|
78
78
|
return false;
|
|
@@ -115,10 +115,10 @@ export const webcryptoHmac = {
|
|
|
115
115
|
*
|
|
116
116
|
* @param {string} [hash='SHA-256']
|
|
117
117
|
* @param {number} [lengthBits] Optional key length in bits (platform default when omitted).
|
|
118
|
-
* @param {boolean} [extractable=
|
|
118
|
+
* @param {boolean} [extractable=false]
|
|
119
119
|
* @returns {Promise<CryptoKey|false>}
|
|
120
120
|
*/
|
|
121
|
-
async function generateKey(hash = 'SHA-256', lengthBits, extractable =
|
|
121
|
+
async function generateKey(hash = 'SHA-256', lengthBits, extractable = false) {
|
|
122
122
|
if (!_hasSubtle) {
|
|
123
123
|
console.error('[crypto] NOT READY: crypto.subtle unavailable');
|
|
124
124
|
return false;
|
|
@@ -104,10 +104,10 @@ export const webcryptoRsa = {
|
|
|
104
104
|
* @param {'OAEP'|'PSS'|'PKCS1'} scheme
|
|
105
105
|
* @param {number} [modulusBits=2048]
|
|
106
106
|
* @param {string} [hash='SHA-256']
|
|
107
|
-
* @param {boolean} [extractable=
|
|
107
|
+
* @param {boolean} [extractable=false]
|
|
108
108
|
* @returns {Promise<CryptoKeyPair|false>}
|
|
109
109
|
*/
|
|
110
|
-
async function generateKey(scheme, modulusBits = 2048, hash = 'SHA-256', extractable =
|
|
110
|
+
async function generateKey(scheme, modulusBits = 2048, hash = 'SHA-256', extractable = false) {
|
|
111
111
|
if (!_hasSubtle) {
|
|
112
112
|
console.error('[crypto] NOT READY: crypto.subtle unavailable');
|
|
113
113
|
return false;
|
|
@@ -220,6 +220,11 @@ export const webcryptoRsa = {
|
|
|
220
220
|
const buf = await crypto.subtle.decrypt(algorithm, privateKey, /** @type {BufferSource} */ (ct));
|
|
221
221
|
return new Uint8Array(buf);
|
|
222
222
|
} catch (e) {
|
|
223
|
+
if (e && e.name === 'OperationError') {
|
|
224
|
+
// OAEP decoding failure: an expected outcome, warn level.
|
|
225
|
+
console.warn('[crypto] CORRUPT: webcryptoRsa.decrypt: decryption failed');
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
223
228
|
console.error('[crypto] FAIL: webcryptoRsa.decrypt: ' + (e && e.message));
|
|
224
229
|
return false;
|
|
225
230
|
}
|
|
@@ -74,10 +74,10 @@ export const webcryptoX25519 = {
|
|
|
74
74
|
* - `crypto.subtle` is unavailable
|
|
75
75
|
* - the runtime does not support `'X25519'` (subtle rejects)
|
|
76
76
|
*
|
|
77
|
-
* @param {boolean} [extractable=
|
|
77
|
+
* @param {boolean} [extractable=false]
|
|
78
78
|
* @returns {Promise<CryptoKeyPair|false>}
|
|
79
79
|
*/
|
|
80
|
-
async function generateKey(extractable =
|
|
80
|
+
async function generateKey(extractable = false) {
|
|
81
81
|
if (!_hasSubtle) return _notReady();
|
|
82
82
|
try {
|
|
83
83
|
// X25519 generateKey always yields a key pair (asymmetric scheme).
|
package/src/dom/fs/download.js
CHANGED