xypriss 1.0.0 → 1.0.1
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/README.md +2 -0
- package/dist/cjs/ServerFactory.js +195 -0
- package/dist/cjs/ServerFactory.js.map +1 -0
- package/dist/cjs/cache/CacheFactory.js +406 -0
- package/dist/cjs/cache/CacheFactory.js.map +1 -0
- package/dist/cjs/cache/SecureCacheAdapter.js +1227 -0
- package/dist/cjs/cache/SecureCacheAdapter.js.map +1 -0
- package/dist/cjs/cluster/cluster-manager.js +1011 -0
- package/dist/cjs/cluster/cluster-manager.js.map +1 -0
- package/dist/cjs/cluster/index.js +343 -0
- package/dist/cjs/cluster/index.js.map +1 -0
- package/dist/cjs/cluster/modules/AutoScaler.js +532 -0
- package/dist/cjs/cluster/modules/AutoScaler.js.map +1 -0
- package/dist/cjs/cluster/modules/ClusterFactory.js +518 -0
- package/dist/cjs/cluster/modules/ClusterFactory.js.map +1 -0
- package/dist/cjs/cluster/modules/ClusterPersistenceManager.js +436 -0
- package/dist/cjs/cluster/modules/ClusterPersistenceManager.js.map +1 -0
- package/dist/cjs/cluster/modules/HealthMonitor.js +461 -0
- package/dist/cjs/cluster/modules/HealthMonitor.js.map +1 -0
- package/dist/cjs/cluster/modules/IPCManager.js +781 -0
- package/dist/cjs/cluster/modules/IPCManager.js.map +1 -0
- package/dist/cjs/cluster/modules/LoadBalancer.js +1123 -0
- package/dist/cjs/cluster/modules/LoadBalancer.js.map +1 -0
- package/dist/cjs/cluster/modules/MetricsCollector.js +559 -0
- package/dist/cjs/cluster/modules/MetricsCollector.js.map +1 -0
- package/dist/cjs/cluster/modules/WorkerManager.js +1187 -0
- package/dist/cjs/cluster/modules/WorkerManager.js.map +1 -0
- package/dist/cjs/encryption/EncryptionService.js +399 -0
- package/dist/cjs/encryption/EncryptionService.js.map +1 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/middleware/safe-json-middleware.js +159 -0
- package/dist/cjs/middleware/safe-json-middleware.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/algorithms/hash-algorithms.js +727 -0
- package/dist/cjs/mods/toolkit/src/algorithms/hash-algorithms.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/algorithms/registry.js +83 -0
- package/dist/cjs/mods/toolkit/src/algorithms/registry.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/attestation.js +1065 -0
- package/dist/cjs/mods/toolkit/src/components/attestation.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/FastLRU.js +323 -0
- package/dist/cjs/mods/toolkit/src/components/cache/FastLRU.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/UFSIMC.js +1131 -0
- package/dist/cjs/mods/toolkit/src/components/cache/UFSIMC.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/cacheSys.js +624 -0
- package/dist/cjs/mods/toolkit/src/components/cache/cacheSys.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/cacheSys.utils.js +136 -0
- package/dist/cjs/mods/toolkit/src/components/cache/cacheSys.utils.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/config/cache.config.js +39 -0
- package/dist/cjs/mods/toolkit/src/components/cache/config/cache.config.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/index.js +459 -0
- package/dist/cjs/mods/toolkit/src/components/cache/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/cache/useCache.js +243 -0
- package/dist/cjs/mods/toolkit/src/components/cache/useCache.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/canary-tokens.js +351 -0
- package/dist/cjs/mods/toolkit/src/components/canary-tokens.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/entropy-augmentation.js +478 -0
- package/dist/cjs/mods/toolkit/src/components/entropy-augmentation.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-allocator.js +338 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-allocator.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-cache.js +536 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-cache.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-engine.js +631 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-engine.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/const/exec.const.js +18 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/const/exec.const.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/fortified-config.js +356 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/fortified-config.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/fortified-function-core.js +520 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/fortified-function-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/fortified-logger.js +246 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/fortified-logger.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/api-manager.js +189 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/api-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/cache-manager.js +107 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/cache-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/execution-context.js +105 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/execution-context.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/execution-engine.js +127 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/execution-engine.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/execution-router.js +93 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/execution-router.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/memory-manager.js +147 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/memory-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/security-manager.js +102 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/security-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/stats-manager.js +159 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/stats-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/timing-manager.js +125 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/core/mods/timing-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/engines/analytics-engine.js +370 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/engines/analytics-engine.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/engines/execution-engine.js +402 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/engines/execution-engine.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/index.js +172 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/performance/performance-monitor.js +240 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/performance/performance-monitor.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/performance/performance-timer.js +188 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/performance/performance-timer.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/security/security-handler.js +253 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/security/security-handler.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/serializer/safe-serializer.js +350 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/serializer/safe-serializer.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/smart-cache.js +693 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/smart-cache.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/types/types.js +16 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/types/types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/utils/utils.js +68 -0
- package/dist/cjs/mods/toolkit/src/components/fortified-function/utils/utils.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/memory-hard.js +922 -0
- package/dist/cjs/mods/toolkit/src/components/memory-hard.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/post-quantum.js +323 -0
- package/dist/cjs/mods/toolkit/src/components/post-quantum.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/runtime-verification.js +645 -0
- package/dist/cjs/mods/toolkit/src/components/runtime-verification.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/core/secure-array-core.js +1572 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/core/secure-array-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/crypto/ArrayCryptoHandler.js +330 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/crypto/ArrayCryptoHandler.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/events/event-manager.js +270 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/events/event-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/index.js +66 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/metadata/metadata-manager.js +331 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/metadata/metadata-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/serialization/ArraySerializationHandler.js +390 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/serialization/ArraySerializationHandler.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/types/index.js +87 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/types/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/utils/id-generator.js +80 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/utils/id-generator.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/utils/validation.js +275 -0
- package/dist/cjs/mods/toolkit/src/components/secure-array/utils/validation.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-memory.js +906 -0
- package/dist/cjs/mods/toolkit/src/components/secure-memory.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/core/secure-object-core.js +1605 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/core/secure-object-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/encryption/crypto-handler.js +362 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/encryption/crypto-handler.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/encryption/sensitive-keys.js +206 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/encryption/sensitive-keys.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/events/event-manager.js +197 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/events/event-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/index.js +67 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/metadata/metadata-manager.js +183 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/metadata/metadata-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/serialization/serialization-handler.js +197 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/serialization/serialization-handler.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/utils/id-generator.js +64 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/utils/id-generator.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/utils/validation.js +239 -0
- package/dist/cjs/mods/toolkit/src/components/secure-object/utils/validation.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-serialization.js +772 -0
- package/dist/cjs/mods/toolkit/src/components/secure-serialization.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/advanced/entropy-analyzer.js +308 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/advanced/entropy-analyzer.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/advanced/performance-monitor.js +335 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/advanced/performance-monitor.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/advanced/quantum-safe.js +245 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/advanced/quantum-safe.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/buffer/buffer-manager.js +205 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/buffer/buffer-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/core/secure-string-core.js +788 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/core/secure-string-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/crypto/crypto-operations.js +319 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/crypto/crypto-operations.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/operations/comparison-operations.js +221 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/operations/comparison-operations.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/operations/string-operations.js +234 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/operations/string-operations.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/types/index.js +41 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/types/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/validation/string-validator.js +334 -0
- package/dist/cjs/mods/toolkit/src/components/secure-string/validation/string-validator.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/side-channel.js +146 -0
- package/dist/cjs/mods/toolkit/src/components/side-channel.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/components/tamper-evident-logging.js +391 -0
- package/dist/cjs/mods/toolkit/src/components/tamper-evident-logging.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/const/buffer.const.js +15 -0
- package/dist/cjs/mods/toolkit/src/const/buffer.const.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/crypto.js +722 -0
- package/dist/cjs/mods/toolkit/src/core/crypto.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-advanced.js +388 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-advanced.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-core.js +376 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-entropy.js +307 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-entropy.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-security.js +372 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-security.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-types.js +16 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-utils.js +328 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-utils.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-validator.js +312 -0
- package/dist/cjs/mods/toolkit/src/core/hash/hash-validator.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/hash.js +25 -0
- package/dist/cjs/mods/toolkit/src/core/hash.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/algorithms/mods/Argon2Algo.js +135 -0
- package/dist/cjs/mods/toolkit/src/core/keys/algorithms/mods/Argon2Algo.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/algorithms/mods/PBKDF2Algo.js +293 -0
- package/dist/cjs/mods/toolkit/src/core/keys/algorithms/mods/PBKDF2Algo.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/algorithms/mods/ScryptAlgo.js +317 -0
- package/dist/cjs/mods/toolkit/src/core/keys/algorithms/mods/ScryptAlgo.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-core.js +201 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-logger.js +234 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-logger.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-types.js +65 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-utils.js +322 -0
- package/dist/cjs/mods/toolkit/src/core/keys/keys-utils.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/keys.js +136 -0
- package/dist/cjs/mods/toolkit/src/core/keys.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/index.js +122 -0
- package/dist/cjs/mods/toolkit/src/core/password/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-algorithms.js +397 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-algorithms.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-core.js +294 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-generator.js +365 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-generator.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-migration.js +237 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-migration.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-security.js +534 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-security.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-types.js +39 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-utils.js +651 -0
- package/dist/cjs/mods/toolkit/src/core/password/password-utils.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/password/swlist.js +1122 -0
- package/dist/cjs/mods/toolkit/src/core/password/swlist.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-core.js +328 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-core.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-crypto.js +339 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-crypto.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-entropy.js +388 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-entropy.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-generators.js +344 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-generators.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-sources.js +426 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-sources.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-tokens.js +309 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-tokens.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-types.js +36 -0
- package/dist/cjs/mods/toolkit/src/core/random/random-types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/core/validators.js +200 -0
- package/dist/cjs/mods/toolkit/src/core/validators.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/helpers/Uint8Array.js +335 -0
- package/dist/cjs/mods/toolkit/src/helpers/Uint8Array.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/helpers/createEnu.js +27 -0
- package/dist/cjs/mods/toolkit/src/helpers/createEnu.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/index.js +417 -0
- package/dist/cjs/mods/toolkit/src/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/types/global.js +51 -0
- package/dist/cjs/mods/toolkit/src/types/global.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/types/secure-mem.type.js +100 -0
- package/dist/cjs/mods/toolkit/src/types/secure-mem.type.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/types/secure-memory.js +20 -0
- package/dist/cjs/mods/toolkit/src/types/secure-memory.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/types.js +63 -0
- package/dist/cjs/mods/toolkit/src/types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/CryptoAlgorithmUtils.js +71 -0
- package/dist/cjs/mods/toolkit/src/utils/CryptoAlgorithmUtils.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/constants.js +111 -0
- package/dist/cjs/mods/toolkit/src/utils/constants.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/dataConverter.js +74 -0
- package/dist/cjs/mods/toolkit/src/utils/dataConverter.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/encoding.js +290 -0
- package/dist/cjs/mods/toolkit/src/utils/encoding.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/errorHandler.js +140 -0
- package/dist/cjs/mods/toolkit/src/utils/errorHandler.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/config-manager.js +282 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/config-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/event-manager.js +277 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/event-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/index.js +162 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/index.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/memory-manager.js +888 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/memory-manager.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/memory-pool.js +356 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/memory-pool.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/reference-tracker.js +376 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/reference-tracker.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/types.js +56 -0
- package/dist/cjs/mods/toolkit/src/utils/memory/types.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/patterns.js +127 -0
- package/dist/cjs/mods/toolkit/src/utils/patterns.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/performanceMonitor.js +249 -0
- package/dist/cjs/mods/toolkit/src/utils/performanceMonitor.js.map +1 -0
- package/dist/cjs/mods/toolkit/src/utils/stats.js +182 -0
- package/dist/cjs/mods/toolkit/src/utils/stats.js.map +1 -0
- package/dist/cjs/performance-monitor.js +162 -0
- package/dist/cjs/performance-monitor.js.map +1 -0
- package/dist/cjs/plugins/plugin-manager.js +151 -0
- package/dist/cjs/plugins/plugin-manager.js.map +1 -0
- package/dist/cjs/plugins/route-optimization-plugin.js +413 -0
- package/dist/cjs/plugins/route-optimization-plugin.js.map +1 -0
- package/dist/cjs/plugins/server-maintenance-plugin.js +510 -0
- package/dist/cjs/plugins/server-maintenance-plugin.js.map +1 -0
- package/dist/cjs/quick-start.js +47 -0
- package/dist/cjs/quick-start.js.map +1 -0
- package/dist/cjs/security-middleware.js +415 -0
- package/dist/cjs/security-middleware.js.map +1 -0
- package/dist/cjs/server/FastServer.js +988 -0
- package/dist/cjs/server/FastServer.js.map +1 -0
- package/dist/cjs/server/components/fastapi/CacheManager.js +245 -0
- package/dist/cjs/server/components/fastapi/CacheManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/ClusterManagerComponent.js +327 -0
- package/dist/cjs/server/components/fastapi/ClusterManagerComponent.js.map +1 -0
- package/dist/cjs/server/components/fastapi/FileWatcherManager.js +493 -0
- package/dist/cjs/server/components/fastapi/FileWatcherManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/MonitoringManager.js +307 -0
- package/dist/cjs/server/components/fastapi/MonitoringManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/PerformanceManager.js +297 -0
- package/dist/cjs/server/components/fastapi/PerformanceManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/PluginManager.js +312 -0
- package/dist/cjs/server/components/fastapi/PluginManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/RedirectManager.js +492 -0
- package/dist/cjs/server/components/fastapi/RedirectManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/RequestProcessor.js +213 -0
- package/dist/cjs/server/components/fastapi/RequestProcessor.js.map +1 -0
- package/dist/cjs/server/components/fastapi/RouteManager.js +272 -0
- package/dist/cjs/server/components/fastapi/RouteManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/UltraFastRequestProcessor.js +668 -0
- package/dist/cjs/server/components/fastapi/UltraFastRequestProcessor.js.map +1 -0
- package/dist/cjs/server/components/fastapi/console/ConsoleInterceptor.js +812 -0
- package/dist/cjs/server/components/fastapi/console/ConsoleInterceptor.js.map +1 -0
- package/dist/cjs/server/components/fastapi/console/encryption/ConsoleEncryption.js +216 -0
- package/dist/cjs/server/components/fastapi/console/encryption/ConsoleEncryption.js.map +1 -0
- package/dist/cjs/server/components/fastapi/console/types.js +163 -0
- package/dist/cjs/server/components/fastapi/console/types.js.map +1 -0
- package/dist/cjs/server/components/fastapi/middlewares/MiddlewareAPI.js +347 -0
- package/dist/cjs/server/components/fastapi/middlewares/MiddlewareAPI.js.map +1 -0
- package/dist/cjs/server/components/fastapi/middlewares/MiddlewareMethodsManager.js +204 -0
- package/dist/cjs/server/components/fastapi/middlewares/MiddlewareMethodsManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/middlewares/middlewareManager.js +953 -0
- package/dist/cjs/server/components/fastapi/middlewares/middlewareManager.js.map +1 -0
- package/dist/cjs/server/components/fastapi/modules/UFRP/WorkerPool.js +56 -0
- package/dist/cjs/server/components/fastapi/modules/UFRP/WorkerPool.js.map +1 -0
- package/dist/cjs/server/components/fastapi/templates/redirectTemp.js +101 -0
- package/dist/cjs/server/components/fastapi/templates/redirectTemp.js.map +1 -0
- package/dist/cjs/server/components/fastapi/typescript/TypeScriptChecker.js +373 -0
- package/dist/cjs/server/components/fastapi/typescript/TypeScriptChecker.js.map +1 -0
- package/dist/cjs/server/const/Cluster.config.js +72 -0
- package/dist/cjs/server/const/Cluster.config.js.map +1 -0
- package/dist/cjs/server/const/ExecutionPredictor_EP.const.js +73 -0
- package/dist/cjs/server/const/ExecutionPredictor_EP.const.js.map +1 -0
- package/dist/cjs/server/const/FileWatcher.config.js +98 -0
- package/dist/cjs/server/const/FileWatcher.config.js.map +1 -0
- package/dist/cjs/server/const/default.js +122 -0
- package/dist/cjs/server/const/default.js.map +1 -0
- package/dist/cjs/server/optimization/ExecutionPredictor.js +218 -0
- package/dist/cjs/server/optimization/ExecutionPredictor.js.map +1 -0
- package/dist/cjs/server/optimization/PerformanceProfiler.js +234 -0
- package/dist/cjs/server/optimization/PerformanceProfiler.js.map +1 -0
- package/dist/cjs/server/optimization/RequestPreCompiler.js +708 -0
- package/dist/cjs/server/optimization/RequestPreCompiler.js.map +1 -0
- package/dist/cjs/server/optimization/UltraFastOptimizer.js +400 -0
- package/dist/cjs/server/optimization/UltraFastOptimizer.js.map +1 -0
- package/dist/cjs/server/plugins/PluginEngine.js +378 -0
- package/dist/cjs/server/plugins/PluginEngine.js.map +1 -0
- package/dist/cjs/server/plugins/PluginRegistry.js +339 -0
- package/dist/cjs/server/plugins/PluginRegistry.js.map +1 -0
- package/dist/cjs/server/plugins/builtin/JWTAuthPlugin.js +591 -0
- package/dist/cjs/server/plugins/builtin/JWTAuthPlugin.js.map +1 -0
- package/dist/cjs/server/plugins/builtin/ResponseTimePlugin.js +413 -0
- package/dist/cjs/server/plugins/builtin/ResponseTimePlugin.js.map +1 -0
- package/dist/cjs/server/plugins/builtin/SmartCachePlugin.js +843 -0
- package/dist/cjs/server/plugins/builtin/SmartCachePlugin.js.map +1 -0
- package/dist/cjs/server/plugins/core/CachePlugin.js +1975 -0
- package/dist/cjs/server/plugins/core/CachePlugin.js.map +1 -0
- package/dist/cjs/server/plugins/core/PerformancePlugin.js +894 -0
- package/dist/cjs/server/plugins/core/PerformancePlugin.js.map +1 -0
- package/dist/cjs/server/plugins/core/SecurityPlugin.js +799 -0
- package/dist/cjs/server/plugins/core/SecurityPlugin.js.map +1 -0
- package/dist/cjs/server/plugins/types/PluginTypes.js +47 -0
- package/dist/cjs/server/plugins/types/PluginTypes.js.map +1 -0
- package/dist/cjs/server/service/Reload/FileWatcher.js +756 -0
- package/dist/cjs/server/service/Reload/FileWatcher.js.map +1 -0
- package/dist/cjs/server/service/Reload/HotReloader.js +738 -0
- package/dist/cjs/server/service/Reload/HotReloader.js.map +1 -0
- package/dist/cjs/server/service/Reload/exec/TypeScriptExecutor.js +342 -0
- package/dist/cjs/server/service/Reload/exec/TypeScriptExecutor.js.map +1 -0
- package/dist/cjs/server/utils/ConfigLoader.js +209 -0
- package/dist/cjs/server/utils/ConfigLoader.js.map +1 -0
- package/dist/cjs/server/utils/Logger.js +238 -0
- package/dist/cjs/server/utils/Logger.js.map +1 -0
- package/dist/cjs/server/utils/PortManager.js +157 -0
- package/dist/cjs/server/utils/PortManager.js.map +1 -0
- package/dist/cjs/server/utils/forceClosePort.js +126 -0
- package/dist/cjs/server/utils/forceClosePort.js.map +1 -0
- package/dist/cjs/smart-routes.js +347 -0
- package/dist/cjs/smart-routes.js.map +1 -0
- package/dist/esm/ServerFactory.js +184 -0
- package/dist/esm/ServerFactory.js.map +1 -0
- package/dist/esm/cache/CacheFactory.js +402 -0
- package/dist/esm/cache/CacheFactory.js.map +1 -0
- package/dist/esm/cache/SecureCacheAdapter.js +1225 -0
- package/dist/esm/cache/SecureCacheAdapter.js.map +1 -0
- package/dist/esm/cluster/cluster-manager.js +990 -0
- package/dist/esm/cluster/cluster-manager.js.map +1 -0
- package/dist/esm/cluster/index.js +321 -0
- package/dist/esm/cluster/index.js.map +1 -0
- package/dist/esm/cluster/modules/AutoScaler.js +530 -0
- package/dist/esm/cluster/modules/AutoScaler.js.map +1 -0
- package/dist/esm/cluster/modules/ClusterFactory.js +490 -0
- package/dist/esm/cluster/modules/ClusterFactory.js.map +1 -0
- package/dist/esm/cluster/modules/ClusterPersistenceManager.js +434 -0
- package/dist/esm/cluster/modules/ClusterPersistenceManager.js.map +1 -0
- package/dist/esm/cluster/modules/HealthMonitor.js +440 -0
- package/dist/esm/cluster/modules/HealthMonitor.js.map +1 -0
- package/dist/esm/cluster/modules/IPCManager.js +759 -0
- package/dist/esm/cluster/modules/IPCManager.js.map +1 -0
- package/dist/esm/cluster/modules/LoadBalancer.js +1102 -0
- package/dist/esm/cluster/modules/LoadBalancer.js.map +1 -0
- package/dist/esm/cluster/modules/MetricsCollector.js +538 -0
- package/dist/esm/cluster/modules/MetricsCollector.js.map +1 -0
- package/dist/esm/cluster/modules/WorkerManager.js +1165 -0
- package/dist/esm/cluster/modules/WorkerManager.js.map +1 -0
- package/dist/esm/encryption/EncryptionService.js +378 -0
- package/dist/esm/encryption/EncryptionService.js.map +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/middleware/safe-json-middleware.js +153 -0
- package/dist/esm/middleware/safe-json-middleware.js.map +1 -0
- package/dist/esm/mods/toolkit/src/algorithms/hash-algorithms.js +705 -0
- package/dist/esm/mods/toolkit/src/algorithms/hash-algorithms.js.map +1 -0
- package/dist/esm/mods/toolkit/src/algorithms/registry.js +81 -0
- package/dist/esm/mods/toolkit/src/algorithms/registry.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/attestation.js +1059 -0
- package/dist/esm/mods/toolkit/src/components/attestation.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/FastLRU.js +320 -0
- package/dist/esm/mods/toolkit/src/components/cache/FastLRU.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/UFSIMC.js +1109 -0
- package/dist/esm/mods/toolkit/src/components/cache/UFSIMC.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/cacheSys.js +622 -0
- package/dist/esm/mods/toolkit/src/components/cache/cacheSys.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/cacheSys.utils.js +111 -0
- package/dist/esm/mods/toolkit/src/components/cache/cacheSys.utils.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/config/cache.config.js +36 -0
- package/dist/esm/mods/toolkit/src/components/cache/config/cache.config.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/index.js +449 -0
- package/dist/esm/mods/toolkit/src/components/cache/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/cache/useCache.js +240 -0
- package/dist/esm/mods/toolkit/src/components/cache/useCache.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/canary-tokens.js +346 -0
- package/dist/esm/mods/toolkit/src/components/canary-tokens.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/entropy-augmentation.js +476 -0
- package/dist/esm/mods/toolkit/src/components/entropy-augmentation.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-allocator.js +336 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-allocator.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-cache.js +534 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-cache.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-engine.js +629 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/UFA/ultra-fast-engine.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/const/exec.const.js +11 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/const/exec.const.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/fortified-config.js +351 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/fortified-config.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/fortified-function-core.js +518 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/fortified-function-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/fortified-logger.js +243 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/fortified-logger.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/api-manager.js +187 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/api-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/cache-manager.js +105 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/cache-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/execution-context.js +103 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/execution-context.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/execution-engine.js +125 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/execution-engine.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/execution-router.js +91 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/execution-router.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/memory-manager.js +145 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/memory-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/security-manager.js +100 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/security-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/stats-manager.js +157 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/stats-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/timing-manager.js +123 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/core/mods/timing-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/engines/analytics-engine.js +368 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/engines/analytics-engine.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/engines/execution-engine.js +400 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/engines/execution-engine.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/index.js +165 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/performance/performance-monitor.js +238 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/performance/performance-monitor.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/performance/performance-timer.js +186 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/performance/performance-timer.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/security/security-handler.js +251 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/security/security-handler.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/serializer/safe-serializer.js +344 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/serializer/safe-serializer.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/smart-cache.js +691 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/smart-cache.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/types/types.js +14 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/types/types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/utils/utils.js +66 -0
- package/dist/esm/mods/toolkit/src/components/fortified-function/utils/utils.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/memory-hard.js +919 -0
- package/dist/esm/mods/toolkit/src/components/memory-hard.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/post-quantum.js +316 -0
- package/dist/esm/mods/toolkit/src/components/post-quantum.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/runtime-verification.js +643 -0
- package/dist/esm/mods/toolkit/src/components/runtime-verification.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/core/secure-array-core.js +1570 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/core/secure-array-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/crypto/ArrayCryptoHandler.js +328 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/crypto/ArrayCryptoHandler.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/events/event-manager.js +268 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/events/event-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/index.js +61 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/metadata/metadata-manager.js +329 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/metadata/metadata-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/serialization/ArraySerializationHandler.js +388 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/serialization/ArraySerializationHandler.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/types/index.js +84 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/types/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/utils/id-generator.js +78 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/utils/id-generator.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/utils/validation.js +273 -0
- package/dist/esm/mods/toolkit/src/components/secure-array/utils/validation.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-memory.js +884 -0
- package/dist/esm/mods/toolkit/src/components/secure-memory.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/core/secure-object-core.js +1603 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/core/secure-object-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/encryption/crypto-handler.js +360 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/encryption/crypto-handler.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/encryption/sensitive-keys.js +203 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/encryption/sensitive-keys.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/events/event-manager.js +195 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/events/event-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/index.js +63 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/metadata/metadata-manager.js +181 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/metadata/metadata-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/serialization/serialization-handler.js +195 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/serialization/serialization-handler.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/utils/id-generator.js +62 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/utils/id-generator.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/utils/validation.js +237 -0
- package/dist/esm/mods/toolkit/src/components/secure-object/utils/validation.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-serialization.js +769 -0
- package/dist/esm/mods/toolkit/src/components/secure-serialization.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/advanced/entropy-analyzer.js +306 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/advanced/entropy-analyzer.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/advanced/performance-monitor.js +333 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/advanced/performance-monitor.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/advanced/quantum-safe.js +243 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/advanced/quantum-safe.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/buffer/buffer-manager.js +203 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/buffer/buffer-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/core/secure-string-core.js +786 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/core/secure-string-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/crypto/crypto-operations.js +298 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/crypto/crypto-operations.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/operations/comparison-operations.js +219 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/operations/comparison-operations.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/operations/string-operations.js +232 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/operations/string-operations.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/types/index.js +37 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/types/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/validation/string-validator.js +332 -0
- package/dist/esm/mods/toolkit/src/components/secure-string/validation/string-validator.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/side-channel.js +142 -0
- package/dist/esm/mods/toolkit/src/components/side-channel.js.map +1 -0
- package/dist/esm/mods/toolkit/src/components/tamper-evident-logging.js +389 -0
- package/dist/esm/mods/toolkit/src/components/tamper-evident-logging.js.map +1 -0
- package/dist/esm/mods/toolkit/src/const/buffer.const.js +13 -0
- package/dist/esm/mods/toolkit/src/const/buffer.const.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/crypto.js +720 -0
- package/dist/esm/mods/toolkit/src/core/crypto.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-advanced.js +367 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-advanced.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-core.js +355 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-entropy.js +286 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-entropy.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-security.js +351 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-security.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-types.js +16 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-utils.js +307 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-utils.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-validator.js +310 -0
- package/dist/esm/mods/toolkit/src/core/hash/hash-validator.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/hash.js +9 -0
- package/dist/esm/mods/toolkit/src/core/hash.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/algorithms/mods/Argon2Algo.js +133 -0
- package/dist/esm/mods/toolkit/src/core/keys/algorithms/mods/Argon2Algo.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/algorithms/mods/PBKDF2Algo.js +272 -0
- package/dist/esm/mods/toolkit/src/core/keys/algorithms/mods/PBKDF2Algo.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/algorithms/mods/ScryptAlgo.js +296 -0
- package/dist/esm/mods/toolkit/src/core/keys/algorithms/mods/ScryptAlgo.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-core.js +199 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-logger.js +231 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-logger.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-types.js +63 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-utils.js +316 -0
- package/dist/esm/mods/toolkit/src/core/keys/keys-utils.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/keys.js +134 -0
- package/dist/esm/mods/toolkit/src/core/keys.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/index.js +110 -0
- package/dist/esm/mods/toolkit/src/core/password/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-algorithms.js +395 -0
- package/dist/esm/mods/toolkit/src/core/password/password-algorithms.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-core.js +292 -0
- package/dist/esm/mods/toolkit/src/core/password/password-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-generator.js +363 -0
- package/dist/esm/mods/toolkit/src/core/password/password-generator.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-migration.js +235 -0
- package/dist/esm/mods/toolkit/src/core/password/password-migration.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-security.js +532 -0
- package/dist/esm/mods/toolkit/src/core/password/password-security.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-types.js +34 -0
- package/dist/esm/mods/toolkit/src/core/password/password-types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/password-utils.js +630 -0
- package/dist/esm/mods/toolkit/src/core/password/password-utils.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/password/swlist.js +1120 -0
- package/dist/esm/mods/toolkit/src/core/password/swlist.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-core.js +326 -0
- package/dist/esm/mods/toolkit/src/core/random/random-core.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-crypto.js +337 -0
- package/dist/esm/mods/toolkit/src/core/random/random-crypto.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-entropy.js +367 -0
- package/dist/esm/mods/toolkit/src/core/random/random-entropy.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-generators.js +323 -0
- package/dist/esm/mods/toolkit/src/core/random/random-generators.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-sources.js +405 -0
- package/dist/esm/mods/toolkit/src/core/random/random-sources.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-tokens.js +307 -0
- package/dist/esm/mods/toolkit/src/core/random/random-tokens.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/random/random-types.js +27 -0
- package/dist/esm/mods/toolkit/src/core/random/random-types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/core/validators.js +198 -0
- package/dist/esm/mods/toolkit/src/core/validators.js.map +1 -0
- package/dist/esm/mods/toolkit/src/helpers/Uint8Array.js +333 -0
- package/dist/esm/mods/toolkit/src/helpers/Uint8Array.js.map +1 -0
- package/dist/esm/mods/toolkit/src/helpers/createEnu.js +25 -0
- package/dist/esm/mods/toolkit/src/helpers/createEnu.js.map +1 -0
- package/dist/esm/mods/toolkit/src/index.js +373 -0
- package/dist/esm/mods/toolkit/src/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/types/global.js +49 -0
- package/dist/esm/mods/toolkit/src/types/global.js.map +1 -0
- package/dist/esm/mods/toolkit/src/types/secure-mem.type.js +96 -0
- package/dist/esm/mods/toolkit/src/types/secure-mem.type.js.map +1 -0
- package/dist/esm/mods/toolkit/src/types/secure-memory.js +20 -0
- package/dist/esm/mods/toolkit/src/types/secure-memory.js.map +1 -0
- package/dist/esm/mods/toolkit/src/types.js +63 -0
- package/dist/esm/mods/toolkit/src/types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/CryptoAlgorithmUtils.js +69 -0
- package/dist/esm/mods/toolkit/src/utils/CryptoAlgorithmUtils.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/constants.js +105 -0
- package/dist/esm/mods/toolkit/src/utils/constants.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/dataConverter.js +72 -0
- package/dist/esm/mods/toolkit/src/utils/dataConverter.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/encoding.js +279 -0
- package/dist/esm/mods/toolkit/src/utils/encoding.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/errorHandler.js +137 -0
- package/dist/esm/mods/toolkit/src/utils/errorHandler.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/config-manager.js +280 -0
- package/dist/esm/mods/toolkit/src/utils/memory/config-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/event-manager.js +275 -0
- package/dist/esm/mods/toolkit/src/utils/memory/event-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/index.js +141 -0
- package/dist/esm/mods/toolkit/src/utils/memory/index.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/memory-manager.js +886 -0
- package/dist/esm/mods/toolkit/src/utils/memory/memory-manager.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/memory-pool.js +354 -0
- package/dist/esm/mods/toolkit/src/utils/memory/memory-pool.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/reference-tracker.js +374 -0
- package/dist/esm/mods/toolkit/src/utils/memory/reference-tracker.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/memory/types.js +56 -0
- package/dist/esm/mods/toolkit/src/utils/memory/types.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/patterns.js +124 -0
- package/dist/esm/mods/toolkit/src/utils/patterns.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/performanceMonitor.js +246 -0
- package/dist/esm/mods/toolkit/src/utils/performanceMonitor.js.map +1 -0
- package/dist/esm/mods/toolkit/src/utils/stats.js +180 -0
- package/dist/esm/mods/toolkit/src/utils/stats.js.map +1 -0
- package/dist/esm/performance-monitor.js +160 -0
- package/dist/esm/performance-monitor.js.map +1 -0
- package/dist/esm/plugins/plugin-manager.js +149 -0
- package/dist/esm/plugins/plugin-manager.js.map +1 -0
- package/dist/esm/plugins/route-optimization-plugin.js +411 -0
- package/dist/esm/plugins/route-optimization-plugin.js.map +1 -0
- package/dist/esm/plugins/server-maintenance-plugin.js +488 -0
- package/dist/esm/plugins/server-maintenance-plugin.js.map +1 -0
- package/dist/esm/quick-start.js +45 -0
- package/dist/esm/quick-start.js.map +1 -0
- package/dist/esm/security-middleware.js +413 -0
- package/dist/esm/security-middleware.js.map +1 -0
- package/dist/esm/server/FastServer.js +985 -0
- package/dist/esm/server/FastServer.js.map +1 -0
- package/dist/esm/server/components/fastapi/CacheManager.js +243 -0
- package/dist/esm/server/components/fastapi/CacheManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/ClusterManagerComponent.js +325 -0
- package/dist/esm/server/components/fastapi/ClusterManagerComponent.js.map +1 -0
- package/dist/esm/server/components/fastapi/FileWatcherManager.js +491 -0
- package/dist/esm/server/components/fastapi/FileWatcherManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/MonitoringManager.js +305 -0
- package/dist/esm/server/components/fastapi/MonitoringManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/PerformanceManager.js +295 -0
- package/dist/esm/server/components/fastapi/PerformanceManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/PluginManager.js +310 -0
- package/dist/esm/server/components/fastapi/PluginManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/RedirectManager.js +490 -0
- package/dist/esm/server/components/fastapi/RedirectManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/RequestProcessor.js +211 -0
- package/dist/esm/server/components/fastapi/RequestProcessor.js.map +1 -0
- package/dist/esm/server/components/fastapi/RouteManager.js +270 -0
- package/dist/esm/server/components/fastapi/RouteManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/UltraFastRequestProcessor.js +647 -0
- package/dist/esm/server/components/fastapi/UltraFastRequestProcessor.js.map +1 -0
- package/dist/esm/server/components/fastapi/console/ConsoleInterceptor.js +810 -0
- package/dist/esm/server/components/fastapi/console/ConsoleInterceptor.js.map +1 -0
- package/dist/esm/server/components/fastapi/console/encryption/ConsoleEncryption.js +214 -0
- package/dist/esm/server/components/fastapi/console/encryption/ConsoleEncryption.js.map +1 -0
- package/dist/esm/server/components/fastapi/console/types.js +160 -0
- package/dist/esm/server/components/fastapi/console/types.js.map +1 -0
- package/dist/esm/server/components/fastapi/middlewares/MiddlewareAPI.js +345 -0
- package/dist/esm/server/components/fastapi/middlewares/MiddlewareAPI.js.map +1 -0
- package/dist/esm/server/components/fastapi/middlewares/MiddlewareMethodsManager.js +202 -0
- package/dist/esm/server/components/fastapi/middlewares/MiddlewareMethodsManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/middlewares/middlewareManager.js +951 -0
- package/dist/esm/server/components/fastapi/middlewares/middlewareManager.js.map +1 -0
- package/dist/esm/server/components/fastapi/modules/UFRP/WorkerPool.js +54 -0
- package/dist/esm/server/components/fastapi/modules/UFRP/WorkerPool.js.map +1 -0
- package/dist/esm/server/components/fastapi/templates/redirectTemp.js +99 -0
- package/dist/esm/server/components/fastapi/templates/redirectTemp.js.map +1 -0
- package/dist/esm/server/components/fastapi/typescript/TypeScriptChecker.js +351 -0
- package/dist/esm/server/components/fastapi/typescript/TypeScriptChecker.js.map +1 -0
- package/dist/esm/server/const/Cluster.config.js +70 -0
- package/dist/esm/server/const/Cluster.config.js.map +1 -0
- package/dist/esm/server/const/ExecutionPredictor_EP.const.js +62 -0
- package/dist/esm/server/const/ExecutionPredictor_EP.const.js.map +1 -0
- package/dist/esm/server/const/FileWatcher.config.js +96 -0
- package/dist/esm/server/const/FileWatcher.config.js.map +1 -0
- package/dist/esm/server/const/default.js +120 -0
- package/dist/esm/server/const/default.js.map +1 -0
- package/dist/esm/server/optimization/ExecutionPredictor.js +216 -0
- package/dist/esm/server/optimization/ExecutionPredictor.js.map +1 -0
- package/dist/esm/server/optimization/PerformanceProfiler.js +232 -0
- package/dist/esm/server/optimization/PerformanceProfiler.js.map +1 -0
- package/dist/esm/server/optimization/RequestPreCompiler.js +706 -0
- package/dist/esm/server/optimization/RequestPreCompiler.js.map +1 -0
- package/dist/esm/server/optimization/UltraFastOptimizer.js +398 -0
- package/dist/esm/server/optimization/UltraFastOptimizer.js.map +1 -0
- package/dist/esm/server/plugins/PluginEngine.js +376 -0
- package/dist/esm/server/plugins/PluginEngine.js.map +1 -0
- package/dist/esm/server/plugins/PluginRegistry.js +337 -0
- package/dist/esm/server/plugins/PluginRegistry.js.map +1 -0
- package/dist/esm/server/plugins/builtin/JWTAuthPlugin.js +589 -0
- package/dist/esm/server/plugins/builtin/JWTAuthPlugin.js.map +1 -0
- package/dist/esm/server/plugins/builtin/ResponseTimePlugin.js +411 -0
- package/dist/esm/server/plugins/builtin/ResponseTimePlugin.js.map +1 -0
- package/dist/esm/server/plugins/builtin/SmartCachePlugin.js +841 -0
- package/dist/esm/server/plugins/builtin/SmartCachePlugin.js.map +1 -0
- package/dist/esm/server/plugins/core/CachePlugin.js +1973 -0
- package/dist/esm/server/plugins/core/CachePlugin.js.map +1 -0
- package/dist/esm/server/plugins/core/PerformancePlugin.js +872 -0
- package/dist/esm/server/plugins/core/PerformancePlugin.js.map +1 -0
- package/dist/esm/server/plugins/core/SecurityPlugin.js +797 -0
- package/dist/esm/server/plugins/core/SecurityPlugin.js.map +1 -0
- package/dist/esm/server/plugins/types/PluginTypes.js +47 -0
- package/dist/esm/server/plugins/types/PluginTypes.js.map +1 -0
- package/dist/esm/server/service/Reload/FileWatcher.js +734 -0
- package/dist/esm/server/service/Reload/FileWatcher.js.map +1 -0
- package/dist/esm/server/service/Reload/HotReloader.js +735 -0
- package/dist/esm/server/service/Reload/HotReloader.js.map +1 -0
- package/dist/esm/server/service/Reload/exec/TypeScriptExecutor.js +339 -0
- package/dist/esm/server/service/Reload/exec/TypeScriptExecutor.js.map +1 -0
- package/dist/esm/server/utils/ConfigLoader.js +207 -0
- package/dist/esm/server/utils/ConfigLoader.js.map +1 -0
- package/dist/esm/server/utils/Logger.js +234 -0
- package/dist/esm/server/utils/Logger.js.map +1 -0
- package/dist/esm/server/utils/PortManager.js +155 -0
- package/dist/esm/server/utils/PortManager.js.map +1 -0
- package/dist/esm/server/utils/forceClosePort.js +124 -0
- package/dist/esm/server/utils/forceClosePort.js.map +1 -0
- package/dist/esm/smart-routes.js +345 -0
- package/dist/esm/smart-routes.js.map +1 -0
- package/package.json +5 -6
|
@@ -0,0 +1,1059 @@
|
|
|
1
|
+
import { SecureRandom } from '../core/random/random-core.js';
|
|
2
|
+
import '../core/random/random-types.js';
|
|
3
|
+
import 'crypto';
|
|
4
|
+
import '../core/random/random-sources.js';
|
|
5
|
+
import 'nehonix-uri-processor';
|
|
6
|
+
import { bufferToHex, bufferToBase64, base64ToBuffer, hexToBuffer } from '../utils/encoding.js';
|
|
7
|
+
import '../utils/memory/index.js';
|
|
8
|
+
import '../types.js';
|
|
9
|
+
import { Hash } from '../core/hash/hash-core.js';
|
|
10
|
+
import '../core/hash/hash-types.js';
|
|
11
|
+
import '../core/hash/hash-security.js';
|
|
12
|
+
import '../core/hash/hash-advanced.js';
|
|
13
|
+
import '../algorithms/hash-algorithms.js';
|
|
14
|
+
import { constantTimeEqual } from './side-channel.js';
|
|
15
|
+
|
|
16
|
+
/* ---------------------------------------------------------------------------------------------
|
|
17
|
+
* Copyright (c) NEHONIX INC. All rights reserved.
|
|
18
|
+
* Licensed under the MIT License. See LICENSE in the project root for license information.
|
|
19
|
+
* -------------------------------------------------------------------------------------------
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Cryptographic Attestation Module
|
|
23
|
+
*
|
|
24
|
+
* This module provides functionality for creating and verifying cryptographic
|
|
25
|
+
* attestations, which are signed statements that can prove the authenticity
|
|
26
|
+
* and integrity of data or the environment.
|
|
27
|
+
*
|
|
28
|
+
* Attestations can be used to verify the integrity of the library itself,
|
|
29
|
+
* prove the authenticity of generated tokens, or validate the security
|
|
30
|
+
* of the runtime environment.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Generates a key pair for attestation using asymmetric cryptography
|
|
34
|
+
*
|
|
35
|
+
* @returns Object containing public and private keys
|
|
36
|
+
*/
|
|
37
|
+
function generateAttestationKey() {
|
|
38
|
+
try {
|
|
39
|
+
// Try to use Node.js crypto module if available
|
|
40
|
+
if (typeof require === "function") {
|
|
41
|
+
try {
|
|
42
|
+
const crypto = require("crypto");
|
|
43
|
+
// Generate an RSA key pair
|
|
44
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", {
|
|
45
|
+
modulusLength: 2048,
|
|
46
|
+
publicKeyEncoding: {
|
|
47
|
+
type: "spki",
|
|
48
|
+
format: "pem",
|
|
49
|
+
},
|
|
50
|
+
privateKeyEncoding: {
|
|
51
|
+
type: "pkcs8",
|
|
52
|
+
format: "pem",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
publicKey,
|
|
57
|
+
privateKey,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
console.warn("Node.js crypto generateKeyPairSync not available:", e);
|
|
62
|
+
// Fall back to browser implementation or other fallbacks
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Try to use Web Crypto API if available (browser environment)
|
|
66
|
+
if (typeof window !== "undefined" &&
|
|
67
|
+
window.crypto &&
|
|
68
|
+
window.crypto.subtle) {
|
|
69
|
+
// Since Web Crypto API is async and our API is sync, we need to use a workaround
|
|
70
|
+
// This is not ideal but allows us to maintain compatibility
|
|
71
|
+
// Create a synchronous wrapper around the async Web Crypto API
|
|
72
|
+
const generateKeyPairSync = () => {
|
|
73
|
+
// Use a synchronous XMLHttpRequest to block until we have a result
|
|
74
|
+
const xhr = new XMLHttpRequest();
|
|
75
|
+
let result = null;
|
|
76
|
+
let error = null;
|
|
77
|
+
// Generate the key pair
|
|
78
|
+
window.crypto.subtle
|
|
79
|
+
.generateKey({
|
|
80
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
81
|
+
modulusLength: 2048,
|
|
82
|
+
publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // 65537
|
|
83
|
+
hash: { name: "SHA-256" },
|
|
84
|
+
}, true, // extractable
|
|
85
|
+
["sign", "verify"])
|
|
86
|
+
.then((keyPair) => {
|
|
87
|
+
// Export the public key
|
|
88
|
+
return window.crypto.subtle
|
|
89
|
+
.exportKey("spki", keyPair.publicKey)
|
|
90
|
+
.then((publicKeyBuffer) => {
|
|
91
|
+
// Convert to base64
|
|
92
|
+
const publicKeyBase64 = bufferToBase64(new Uint8Array(publicKeyBuffer));
|
|
93
|
+
const publicKeyPem = `-----BEGIN PUBLIC KEY-----\n${publicKeyBase64}\n-----END PUBLIC KEY-----`;
|
|
94
|
+
// Export the private key
|
|
95
|
+
return window.crypto.subtle
|
|
96
|
+
.exportKey("pkcs8", keyPair.privateKey)
|
|
97
|
+
.then((privateKeyBuffer) => {
|
|
98
|
+
// Convert to base64
|
|
99
|
+
const privateKeyBase64 = bufferToBase64(new Uint8Array(privateKeyBuffer));
|
|
100
|
+
const privateKeyPem = `-----BEGIN PRIVATE KEY-----\n${privateKeyBase64}\n-----END PRIVATE KEY-----`;
|
|
101
|
+
result = {
|
|
102
|
+
publicKey: publicKeyPem,
|
|
103
|
+
privateKey: privateKeyPem,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
})
|
|
108
|
+
.catch((err) => {
|
|
109
|
+
error = err;
|
|
110
|
+
});
|
|
111
|
+
// Wait for the result (blocking)
|
|
112
|
+
xhr.open("GET", "data:text/plain;charset=utf-8,", false);
|
|
113
|
+
const startTime = Date.now();
|
|
114
|
+
const maxWaitTime = 10000; // 10 seconds timeout
|
|
115
|
+
while (result === null && error === null) {
|
|
116
|
+
// Check for timeout
|
|
117
|
+
if (Date.now() - startTime > maxWaitTime) {
|
|
118
|
+
throw new Error("Key generation timed out");
|
|
119
|
+
}
|
|
120
|
+
// Poll every 100ms
|
|
121
|
+
try {
|
|
122
|
+
xhr.send(null);
|
|
123
|
+
}
|
|
124
|
+
catch (e) {
|
|
125
|
+
// Ignore errors from the XHR
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Check for errors
|
|
129
|
+
if (error) {
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
// Return the result
|
|
133
|
+
if (result) {
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
throw new Error("Key generation failed with no result");
|
|
137
|
+
};
|
|
138
|
+
// Call our synchronous wrapper
|
|
139
|
+
return generateKeyPairSync();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
console.warn("Asymmetric key generation failed:", e);
|
|
144
|
+
// Fall back to a simpler implementation
|
|
145
|
+
}
|
|
146
|
+
// Fallback to a simpler implementation using HMAC-like approach
|
|
147
|
+
console.warn("Using fallback symmetric key generation (less secure)");
|
|
148
|
+
const keyBytes = SecureRandom.getRandomBytes(32);
|
|
149
|
+
const key = bufferToHex(keyBytes);
|
|
150
|
+
return {
|
|
151
|
+
publicKey: key,
|
|
152
|
+
privateKey: key,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Creates an attestation for the given data
|
|
157
|
+
*
|
|
158
|
+
* @param data - Data to attest
|
|
159
|
+
* @param options - Attestation options
|
|
160
|
+
* @returns Attestation string
|
|
161
|
+
*/
|
|
162
|
+
function createAttestation(data, options = {}) {
|
|
163
|
+
// Generate or use provided key
|
|
164
|
+
const key = options.key || generateAttestationKey().privateKey;
|
|
165
|
+
// Prepare the data
|
|
166
|
+
let dataString;
|
|
167
|
+
if (typeof data === "string") {
|
|
168
|
+
dataString = data;
|
|
169
|
+
}
|
|
170
|
+
else if (data instanceof Uint8Array) {
|
|
171
|
+
dataString = bufferToHex(data);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
dataString = JSON.stringify(data);
|
|
175
|
+
}
|
|
176
|
+
// Create the attestation payload
|
|
177
|
+
const payload = {
|
|
178
|
+
data: dataString,
|
|
179
|
+
iat: Date.now(),
|
|
180
|
+
nonce: bufferToHex(SecureRandom.getRandomBytes(16)),
|
|
181
|
+
};
|
|
182
|
+
// Add expiration if provided
|
|
183
|
+
if (options.expiresIn) {
|
|
184
|
+
payload.exp = payload.iat + options.expiresIn;
|
|
185
|
+
}
|
|
186
|
+
// Add claims if provided
|
|
187
|
+
if (options.claims) {
|
|
188
|
+
payload.claims = options.claims;
|
|
189
|
+
}
|
|
190
|
+
// Add environment information if enabled
|
|
191
|
+
if (options.includeEnvironment !== false) {
|
|
192
|
+
payload.env = getEnvironmentInfo();
|
|
193
|
+
}
|
|
194
|
+
// Serialize the payload
|
|
195
|
+
const serializedPayload = JSON.stringify(payload);
|
|
196
|
+
// Sign the payload
|
|
197
|
+
const signature = signPayload(serializedPayload, key);
|
|
198
|
+
// Combine payload and signature
|
|
199
|
+
const attestation = {
|
|
200
|
+
payload: bufferToBase64(new TextEncoder().encode(serializedPayload)),
|
|
201
|
+
signature,
|
|
202
|
+
};
|
|
203
|
+
return JSON.stringify(attestation);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Verifies an attestation
|
|
207
|
+
*
|
|
208
|
+
* @param attestation - Attestation to verify
|
|
209
|
+
* @param options - Verification options
|
|
210
|
+
* @returns Verification result
|
|
211
|
+
*/
|
|
212
|
+
function verifyAttestation(attestation, options) {
|
|
213
|
+
try {
|
|
214
|
+
// Parse the attestation
|
|
215
|
+
const parsed = JSON.parse(attestation);
|
|
216
|
+
if (!parsed.payload || !parsed.signature) {
|
|
217
|
+
return {
|
|
218
|
+
valid: false,
|
|
219
|
+
reason: "Invalid attestation format",
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
// Decode the payload
|
|
223
|
+
const payloadBytes = base64ToBuffer(parsed.payload);
|
|
224
|
+
const serializedPayload = new TextDecoder().decode(payloadBytes);
|
|
225
|
+
const payload = JSON.parse(serializedPayload);
|
|
226
|
+
// Verify the signature
|
|
227
|
+
const signatureValid = verifySignature(serializedPayload, parsed.signature, options.key);
|
|
228
|
+
if (!signatureValid) {
|
|
229
|
+
return {
|
|
230
|
+
valid: false,
|
|
231
|
+
reason: "Invalid signature",
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
// Verify expiration if enabled
|
|
235
|
+
if (options.verifyExpiration !== false && payload.exp) {
|
|
236
|
+
if (Date.now() > payload.exp) {
|
|
237
|
+
return {
|
|
238
|
+
valid: false,
|
|
239
|
+
reason: "Attestation expired",
|
|
240
|
+
claims: payload.claims,
|
|
241
|
+
environment: payload.env,
|
|
242
|
+
expiresAt: payload.exp,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Verify environment if enabled
|
|
247
|
+
if (options.verifyEnvironment && payload.env) {
|
|
248
|
+
const currentEnv = getEnvironmentInfo();
|
|
249
|
+
// Check critical environment properties
|
|
250
|
+
if (payload.env.userAgent !== currentEnv.userAgent) {
|
|
251
|
+
return {
|
|
252
|
+
valid: false,
|
|
253
|
+
reason: "Environment mismatch: userAgent",
|
|
254
|
+
claims: payload.claims,
|
|
255
|
+
environment: payload.env,
|
|
256
|
+
expiresAt: payload.exp,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
if (payload.env.platform !== currentEnv.platform) {
|
|
260
|
+
return {
|
|
261
|
+
valid: false,
|
|
262
|
+
reason: "Environment mismatch: platform",
|
|
263
|
+
claims: payload.claims,
|
|
264
|
+
environment: payload.env,
|
|
265
|
+
expiresAt: payload.exp,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// Verify required claims if provided
|
|
270
|
+
if (options.requiredClaims && payload.claims) {
|
|
271
|
+
for (const [key, value] of Object.entries(options.requiredClaims)) {
|
|
272
|
+
if (!payload.claims[key] ||
|
|
273
|
+
!deepEqual(payload.claims[key], value)) {
|
|
274
|
+
return {
|
|
275
|
+
valid: false,
|
|
276
|
+
reason: `Required claim mismatch: ${key}`,
|
|
277
|
+
claims: payload.claims,
|
|
278
|
+
environment: payload.env,
|
|
279
|
+
expiresAt: payload.exp,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// All verifications passed
|
|
285
|
+
return {
|
|
286
|
+
valid: true,
|
|
287
|
+
claims: payload.claims,
|
|
288
|
+
environment: payload.env,
|
|
289
|
+
expiresAt: payload.exp,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
catch (e) {
|
|
293
|
+
return {
|
|
294
|
+
valid: false,
|
|
295
|
+
reason: `Verification error: ${e.message}`,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Creates an attestation for the library itself
|
|
301
|
+
* This can be used to verify the integrity of the library
|
|
302
|
+
*
|
|
303
|
+
* @param options - Attestation options
|
|
304
|
+
* @returns Attestation string
|
|
305
|
+
*/
|
|
306
|
+
function createLibraryAttestation(options = {}) {
|
|
307
|
+
// Get library information
|
|
308
|
+
const libraryInfo = {
|
|
309
|
+
name: "XyPrissSecurity",
|
|
310
|
+
version: "1.0.0",
|
|
311
|
+
buildId: "20250520-1",
|
|
312
|
+
hash: getLibraryHash(),
|
|
313
|
+
};
|
|
314
|
+
// Create attestation with library info as claims
|
|
315
|
+
return createAttestation("library-attestation", {
|
|
316
|
+
...options,
|
|
317
|
+
claims: {
|
|
318
|
+
...options.claims,
|
|
319
|
+
library: libraryInfo,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Verifies a library attestation
|
|
325
|
+
*
|
|
326
|
+
* @param attestation - Attestation to verify
|
|
327
|
+
* @param options - Verification options
|
|
328
|
+
* @returns Verification result
|
|
329
|
+
*/
|
|
330
|
+
function verifyLibraryAttestation(attestation, options) {
|
|
331
|
+
// Verify the attestation
|
|
332
|
+
const result = verifyAttestation(attestation, options);
|
|
333
|
+
if (!result.valid) {
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
// Check that it's a library attestation
|
|
337
|
+
if (!result.claims?.library) {
|
|
338
|
+
return {
|
|
339
|
+
valid: false,
|
|
340
|
+
reason: "Not a library attestation",
|
|
341
|
+
claims: result.claims,
|
|
342
|
+
environment: result.environment,
|
|
343
|
+
expiresAt: result.expiresAt,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
// Verify the library hash if possible
|
|
347
|
+
const currentHash = getLibraryHash();
|
|
348
|
+
if (currentHash &&
|
|
349
|
+
result.claims.library.hash &&
|
|
350
|
+
currentHash !== result.claims.library.hash) {
|
|
351
|
+
return {
|
|
352
|
+
valid: false,
|
|
353
|
+
reason: "Library hash mismatch",
|
|
354
|
+
claims: result.claims,
|
|
355
|
+
environment: result.environment,
|
|
356
|
+
expiresAt: result.expiresAt,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Signs a payload using the provided key
|
|
363
|
+
*
|
|
364
|
+
* @param payload - Payload to sign
|
|
365
|
+
* @param key - Key to use for signing (private key for asymmetric, or symmetric key)
|
|
366
|
+
* @returns Signature
|
|
367
|
+
*/
|
|
368
|
+
function signPayload(payload, key) {
|
|
369
|
+
// Convert payload to bytes
|
|
370
|
+
const payloadBytes = new TextEncoder().encode(payload);
|
|
371
|
+
try {
|
|
372
|
+
// Check if the key looks like a PEM-encoded private key (asymmetric)
|
|
373
|
+
const isPemKey = key.includes("-----BEGIN") && key.includes("KEY-----");
|
|
374
|
+
if (isPemKey) {
|
|
375
|
+
// Try to use Node.js crypto module if available
|
|
376
|
+
if (typeof require === "function") {
|
|
377
|
+
try {
|
|
378
|
+
const crypto = require("crypto");
|
|
379
|
+
// Create a sign object
|
|
380
|
+
const sign = crypto.createSign("SHA256");
|
|
381
|
+
// Update with the payload
|
|
382
|
+
sign.update(payloadBytes);
|
|
383
|
+
// Sign the payload
|
|
384
|
+
const signature = sign.sign(key, "hex");
|
|
385
|
+
return signature;
|
|
386
|
+
}
|
|
387
|
+
catch (e) {
|
|
388
|
+
console.warn("Node.js crypto signing failed:", e);
|
|
389
|
+
// Fall back to browser implementation or other fallbacks
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// Try to use Web Crypto API if available (browser environment)
|
|
393
|
+
if (typeof window !== "undefined" &&
|
|
394
|
+
window.crypto &&
|
|
395
|
+
window.crypto.subtle) {
|
|
396
|
+
// Since Web Crypto API is async and our API is sync, we need to use a workaround
|
|
397
|
+
// Create a synchronous wrapper around the async Web Crypto API
|
|
398
|
+
const signSync = (data, privateKey) => {
|
|
399
|
+
// Use a synchronous XMLHttpRequest to block until we have a result
|
|
400
|
+
const xhr = new XMLHttpRequest();
|
|
401
|
+
let result = null;
|
|
402
|
+
let error = null;
|
|
403
|
+
// Parse the PEM private key
|
|
404
|
+
const pemHeader = "-----BEGIN PRIVATE KEY-----";
|
|
405
|
+
const pemFooter = "-----END PRIVATE KEY-----";
|
|
406
|
+
const pemContents = privateKey
|
|
407
|
+
.substring(privateKey.indexOf(pemHeader) + pemHeader.length, privateKey.indexOf(pemFooter))
|
|
408
|
+
.replace(/\s/g, "");
|
|
409
|
+
// Convert from base64 to binary
|
|
410
|
+
const binaryDerString = atob(pemContents);
|
|
411
|
+
const binaryDer = new Uint8Array(binaryDerString.length);
|
|
412
|
+
for (let i = 0; i < binaryDerString.length; i++) {
|
|
413
|
+
binaryDer[i] = binaryDerString.charCodeAt(i);
|
|
414
|
+
}
|
|
415
|
+
// Import the private key
|
|
416
|
+
window.crypto.subtle
|
|
417
|
+
.importKey("pkcs8", binaryDer, {
|
|
418
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
419
|
+
hash: { name: "SHA-256" },
|
|
420
|
+
}, false, ["sign"])
|
|
421
|
+
.then((cryptoKey) => {
|
|
422
|
+
// Sign the data
|
|
423
|
+
// Create a proper ArrayBuffer to avoid type issues
|
|
424
|
+
const buffer = new ArrayBuffer(data.length);
|
|
425
|
+
const view = new Uint8Array(buffer);
|
|
426
|
+
view.set(data);
|
|
427
|
+
return window.crypto.subtle.sign({ name: "RSASSA-PKCS1-v1_5" }, cryptoKey, buffer);
|
|
428
|
+
})
|
|
429
|
+
.then((signatureBuffer) => {
|
|
430
|
+
// Convert to hex
|
|
431
|
+
result = bufferToHex(new Uint8Array(signatureBuffer));
|
|
432
|
+
})
|
|
433
|
+
.catch((err) => {
|
|
434
|
+
error = err;
|
|
435
|
+
});
|
|
436
|
+
// Wait for the result (blocking)
|
|
437
|
+
xhr.open("GET", "data:text/plain;charset=utf-8,", false);
|
|
438
|
+
const startTime = Date.now();
|
|
439
|
+
const maxWaitTime = 10000; // 10 seconds timeout
|
|
440
|
+
while (result === null && error === null) {
|
|
441
|
+
// Check for timeout
|
|
442
|
+
if (Date.now() - startTime > maxWaitTime) {
|
|
443
|
+
throw new Error("Signing operation timed out");
|
|
444
|
+
}
|
|
445
|
+
// Poll every 100ms
|
|
446
|
+
try {
|
|
447
|
+
xhr.send(null);
|
|
448
|
+
}
|
|
449
|
+
catch (e) {
|
|
450
|
+
// Ignore errors from the XHR
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
// Check for errors
|
|
454
|
+
if (error) {
|
|
455
|
+
throw error;
|
|
456
|
+
}
|
|
457
|
+
// Return the result
|
|
458
|
+
if (result) {
|
|
459
|
+
return result;
|
|
460
|
+
}
|
|
461
|
+
throw new Error("Signing operation failed with no result");
|
|
462
|
+
};
|
|
463
|
+
// Call our synchronous wrapper
|
|
464
|
+
return signSync(payloadBytes, key);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
catch (e) {
|
|
469
|
+
console.warn("Asymmetric signing failed:", e);
|
|
470
|
+
// Fall back to a simpler implementation
|
|
471
|
+
}
|
|
472
|
+
// Fallback to a simpler implementation using HMAC-like approach
|
|
473
|
+
console.warn("Using fallback symmetric signing (less secure)");
|
|
474
|
+
// Convert key to bytes if it's a string
|
|
475
|
+
const keyBytes = typeof key === "string" ? hexToBuffer(key) : key;
|
|
476
|
+
// Create a signature using a keyed hash
|
|
477
|
+
const signature = Hash.create(payloadBytes, {
|
|
478
|
+
salt: keyBytes,
|
|
479
|
+
algorithm: "sha256",
|
|
480
|
+
iterations: 1000,
|
|
481
|
+
outputFormat: "hex",
|
|
482
|
+
});
|
|
483
|
+
return signature;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Verifies a signature
|
|
487
|
+
*
|
|
488
|
+
* @param payload - Payload that was signed
|
|
489
|
+
* @param signature - Signature to verify
|
|
490
|
+
* @param key - Key to use for verification (public key for asymmetric, or symmetric key)
|
|
491
|
+
* @returns True if the signature is valid
|
|
492
|
+
*/
|
|
493
|
+
function verifySignature(payload, signature, key) {
|
|
494
|
+
// Convert payload to bytes
|
|
495
|
+
const payloadBytes = new TextEncoder().encode(payload);
|
|
496
|
+
try {
|
|
497
|
+
// Check if the key looks like a PEM-encoded public key (asymmetric)
|
|
498
|
+
const isPemKey = key.includes("-----BEGIN") && key.includes("KEY-----");
|
|
499
|
+
if (isPemKey) {
|
|
500
|
+
// Try to use Node.js crypto module if available
|
|
501
|
+
if (typeof require === "function") {
|
|
502
|
+
try {
|
|
503
|
+
const crypto = require("crypto");
|
|
504
|
+
// Create a verify object
|
|
505
|
+
const verify = crypto.createVerify("SHA256");
|
|
506
|
+
// Update with the payload
|
|
507
|
+
verify.update(payloadBytes);
|
|
508
|
+
// Verify the signature
|
|
509
|
+
return verify.verify(key, signature, "hex");
|
|
510
|
+
}
|
|
511
|
+
catch (e) {
|
|
512
|
+
console.warn("Node.js crypto verification failed:", e);
|
|
513
|
+
// Fall back to browser implementation or other fallbacks
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
// Try to use Web Crypto API if available (browser environment)
|
|
517
|
+
if (typeof window !== "undefined" &&
|
|
518
|
+
window.crypto &&
|
|
519
|
+
window.crypto.subtle) {
|
|
520
|
+
// Since Web Crypto API is async and our API is sync, we need to use a workaround
|
|
521
|
+
// Create a synchronous wrapper around the async Web Crypto API
|
|
522
|
+
const verifySync = (data, sig, publicKey) => {
|
|
523
|
+
// Use a synchronous XMLHttpRequest to block until we have a result
|
|
524
|
+
const xhr = new XMLHttpRequest();
|
|
525
|
+
let result = null;
|
|
526
|
+
let error = null;
|
|
527
|
+
// Parse the PEM public key
|
|
528
|
+
const pemHeader = "-----BEGIN PUBLIC KEY-----";
|
|
529
|
+
const pemFooter = "-----END PUBLIC KEY-----";
|
|
530
|
+
const pemContents = publicKey
|
|
531
|
+
.substring(publicKey.indexOf(pemHeader) + pemHeader.length, publicKey.indexOf(pemFooter))
|
|
532
|
+
.replace(/\s/g, "");
|
|
533
|
+
// Convert from base64 to binary
|
|
534
|
+
const binaryDerString = atob(pemContents);
|
|
535
|
+
const binaryDer = new Uint8Array(binaryDerString.length);
|
|
536
|
+
for (let i = 0; i < binaryDerString.length; i++) {
|
|
537
|
+
binaryDer[i] = binaryDerString.charCodeAt(i);
|
|
538
|
+
}
|
|
539
|
+
// Convert signature from hex to binary
|
|
540
|
+
const signatureBytes = hexToBuffer(sig);
|
|
541
|
+
// Create a proper ArrayBuffer for the signature to avoid type issues
|
|
542
|
+
const signatureBuffer = new ArrayBuffer(signatureBytes.length);
|
|
543
|
+
const signatureView = new Uint8Array(signatureBuffer);
|
|
544
|
+
signatureView.set(signatureBytes);
|
|
545
|
+
// Import the public key
|
|
546
|
+
window.crypto.subtle
|
|
547
|
+
.importKey("spki", binaryDer, {
|
|
548
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
549
|
+
hash: { name: "SHA-256" },
|
|
550
|
+
}, false, ["verify"])
|
|
551
|
+
.then((cryptoKey) => {
|
|
552
|
+
// Create a proper ArrayBuffer to avoid type issues
|
|
553
|
+
const buffer = new ArrayBuffer(data.length);
|
|
554
|
+
const view = new Uint8Array(buffer);
|
|
555
|
+
view.set(data);
|
|
556
|
+
// Verify the signature
|
|
557
|
+
return window.crypto.subtle.verify({ name: "RSASSA-PKCS1-v1_5" }, cryptoKey, signatureBuffer, buffer);
|
|
558
|
+
})
|
|
559
|
+
.then((isValid) => {
|
|
560
|
+
result = isValid;
|
|
561
|
+
})
|
|
562
|
+
.catch((err) => {
|
|
563
|
+
error = err;
|
|
564
|
+
});
|
|
565
|
+
// Wait for the result (blocking)
|
|
566
|
+
xhr.open("GET", "data:text/plain;charset=utf-8,", false);
|
|
567
|
+
const startTime = Date.now();
|
|
568
|
+
const maxWaitTime = 10000; // 10 seconds timeout
|
|
569
|
+
while (result === null && error === null) {
|
|
570
|
+
// Check for timeout
|
|
571
|
+
if (Date.now() - startTime > maxWaitTime) {
|
|
572
|
+
throw new Error("Verification operation timed out");
|
|
573
|
+
}
|
|
574
|
+
// Poll every 100ms
|
|
575
|
+
try {
|
|
576
|
+
xhr.send(null);
|
|
577
|
+
}
|
|
578
|
+
catch (e) {
|
|
579
|
+
// Ignore errors from the XHR
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
// Check for errors
|
|
583
|
+
if (error) {
|
|
584
|
+
console.warn("Web Crypto verification error:", error);
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
// Return the result
|
|
588
|
+
return result === true;
|
|
589
|
+
};
|
|
590
|
+
// Call our synchronous wrapper
|
|
591
|
+
return verifySync(payloadBytes, signature, key);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
catch (e) {
|
|
596
|
+
console.warn("Asymmetric verification failed:", e);
|
|
597
|
+
// Fall back to a simpler implementation
|
|
598
|
+
}
|
|
599
|
+
// Fallback to a simpler implementation using HMAC-like approach
|
|
600
|
+
console.warn("Using fallback symmetric verification (less secure)");
|
|
601
|
+
// Compute the expected signature
|
|
602
|
+
const expectedSignature = signPayload(payload, key);
|
|
603
|
+
// Compare in constant time to prevent timing attacks
|
|
604
|
+
return constantTimeEqual(signature, expectedSignature);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Gets information about the current environment
|
|
608
|
+
*
|
|
609
|
+
* @returns Environment information
|
|
610
|
+
*/
|
|
611
|
+
function getEnvironmentInfo() {
|
|
612
|
+
const info = {
|
|
613
|
+
timestamp: Date.now(),
|
|
614
|
+
};
|
|
615
|
+
// Browser environment
|
|
616
|
+
if (typeof window !== "undefined") {
|
|
617
|
+
info.userAgent = window.navigator.userAgent;
|
|
618
|
+
// Use userAgentData instead of deprecated platform if available
|
|
619
|
+
info.platform =
|
|
620
|
+
window.navigator.userAgentData?.platform ||
|
|
621
|
+
// Fallback to derived info from userAgent
|
|
622
|
+
(window.navigator.userAgent.indexOf("Win") !== -1
|
|
623
|
+
? "Windows"
|
|
624
|
+
: window.navigator.userAgent.indexOf("Mac") !== -1
|
|
625
|
+
? "MacOS"
|
|
626
|
+
: window.navigator.userAgent.indexOf("Linux") !== -1
|
|
627
|
+
? "Linux"
|
|
628
|
+
: "Unknown");
|
|
629
|
+
info.language = window.navigator.language;
|
|
630
|
+
info.cookiesEnabled = window.navigator.cookieEnabled;
|
|
631
|
+
if (window.screen) {
|
|
632
|
+
info.screenWidth = window.screen.width;
|
|
633
|
+
info.screenHeight = window.screen.height;
|
|
634
|
+
info.colorDepth = window.screen.colorDepth;
|
|
635
|
+
}
|
|
636
|
+
info.timezoneOffset = new Date().getTimezoneOffset();
|
|
637
|
+
info.origin = window.location.origin;
|
|
638
|
+
}
|
|
639
|
+
// Node.js environment
|
|
640
|
+
if (typeof process !== "undefined") {
|
|
641
|
+
info.nodeVersion = process.version;
|
|
642
|
+
info.platform = process.platform;
|
|
643
|
+
info.arch = process.arch;
|
|
644
|
+
if (process.env) {
|
|
645
|
+
info.nodeEnv = process.env.NODE_ENV;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return info;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Gets a hash of the library code
|
|
652
|
+
* This computes a hash of the critical library components
|
|
653
|
+
*
|
|
654
|
+
* @returns Hash of the library code
|
|
655
|
+
*/
|
|
656
|
+
function getLibraryHash() {
|
|
657
|
+
try {
|
|
658
|
+
// Try to use Node.js fs module to read actual files if available
|
|
659
|
+
if (typeof require === "function") {
|
|
660
|
+
try {
|
|
661
|
+
const fs = require("fs");
|
|
662
|
+
const path = require("path");
|
|
663
|
+
const crypto = require("crypto");
|
|
664
|
+
// Define the core modules to hash
|
|
665
|
+
const coreModules = [
|
|
666
|
+
"core/crypto.ts",
|
|
667
|
+
"core/hash.ts",
|
|
668
|
+
"core/keys.ts",
|
|
669
|
+
"core/random.ts",
|
|
670
|
+
"core/validators.ts",
|
|
671
|
+
];
|
|
672
|
+
// Define the security modules to hash
|
|
673
|
+
const securityModules = [
|
|
674
|
+
"security/attestation.ts",
|
|
675
|
+
"security/canary-tokens.ts",
|
|
676
|
+
"security/entropy-augmentation.ts",
|
|
677
|
+
"security/memory-hard.ts",
|
|
678
|
+
"security/post-quantum.ts",
|
|
679
|
+
"security/secure-memory.ts",
|
|
680
|
+
"security/secure-serialization.ts",
|
|
681
|
+
"security/side-channel.ts",
|
|
682
|
+
];
|
|
683
|
+
// Define the utility modules to hash
|
|
684
|
+
const utilityModules = [
|
|
685
|
+
"utils/constants.ts",
|
|
686
|
+
"utils/encoding.ts",
|
|
687
|
+
"utils/stats.ts",
|
|
688
|
+
"utils/testing.ts",
|
|
689
|
+
];
|
|
690
|
+
// Combine all modules
|
|
691
|
+
const allModules = [
|
|
692
|
+
...coreModules,
|
|
693
|
+
...securityModules,
|
|
694
|
+
...utilityModules,
|
|
695
|
+
];
|
|
696
|
+
// Create a hash object
|
|
697
|
+
const hash = crypto.createHash("sha256");
|
|
698
|
+
// Try to find the src directory
|
|
699
|
+
let srcDir = "";
|
|
700
|
+
const possiblePaths = [
|
|
701
|
+
"src",
|
|
702
|
+
"../src",
|
|
703
|
+
"../../src",
|
|
704
|
+
path.resolve(__dirname, "../"),
|
|
705
|
+
path.resolve(__dirname, "../../src"),
|
|
706
|
+
path.resolve(process.cwd(), "src"),
|
|
707
|
+
];
|
|
708
|
+
for (const possiblePath of possiblePaths) {
|
|
709
|
+
try {
|
|
710
|
+
if (fs.existsSync(possiblePath) &&
|
|
711
|
+
fs.statSync(possiblePath).isDirectory()) {
|
|
712
|
+
// Check if this directory contains our expected files
|
|
713
|
+
if (fs.existsSync(path.join(possiblePath, "core")) ||
|
|
714
|
+
fs.existsSync(path.join(possiblePath, "security"))) {
|
|
715
|
+
srcDir = possiblePath;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
catch (e) {
|
|
721
|
+
// Ignore errors and try the next path
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
if (!srcDir) {
|
|
725
|
+
throw new Error("Could not find src directory");
|
|
726
|
+
}
|
|
727
|
+
// Read and hash each file
|
|
728
|
+
for (const module of allModules) {
|
|
729
|
+
try {
|
|
730
|
+
const filePath = path.join(srcDir, module);
|
|
731
|
+
if (fs.existsSync(filePath)) {
|
|
732
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
733
|
+
// Update the hash with the file content
|
|
734
|
+
hash.update(`${module}:${content}`);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
catch (e) {
|
|
738
|
+
console.warn(`Error reading file ${module}:`, e);
|
|
739
|
+
// Continue with other files
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
// Get the final hash
|
|
743
|
+
return hash.digest("hex");
|
|
744
|
+
}
|
|
745
|
+
catch (e) {
|
|
746
|
+
console.warn("Error using Node.js fs to compute library hash:", e);
|
|
747
|
+
// Fall back to the module hash approach
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
// If we can't read the actual files, use the module hash approach
|
|
751
|
+
// Create a buffer to hold the critical components
|
|
752
|
+
const components = [];
|
|
753
|
+
// Add core module hashes
|
|
754
|
+
components.push(getModuleHash("crypto"));
|
|
755
|
+
components.push(getModuleHash("hash"));
|
|
756
|
+
components.push(getModuleHash("keys"));
|
|
757
|
+
components.push(getModuleHash("random"));
|
|
758
|
+
components.push(getModuleHash("validators"));
|
|
759
|
+
// Add security module hashes
|
|
760
|
+
components.push(getModuleHash("attestation"));
|
|
761
|
+
components.push(getModuleHash("canary-tokens"));
|
|
762
|
+
components.push(getModuleHash("entropy-augmentation"));
|
|
763
|
+
components.push(getModuleHash("memory-hard"));
|
|
764
|
+
components.push(getModuleHash("post-quantum"));
|
|
765
|
+
components.push(getModuleHash("secure-memory"));
|
|
766
|
+
components.push(getModuleHash("secure-serialization"));
|
|
767
|
+
components.push(getModuleHash("side-channel"));
|
|
768
|
+
// Add utility module hashes
|
|
769
|
+
components.push(getModuleHash("constants"));
|
|
770
|
+
components.push(getModuleHash("encoding"));
|
|
771
|
+
components.push(getModuleHash("stats"));
|
|
772
|
+
components.push(getModuleHash("testing"));
|
|
773
|
+
// Combine all hashes
|
|
774
|
+
const combinedHash = Hash.create(components.join("|"), {
|
|
775
|
+
algorithm: "sha256",
|
|
776
|
+
outputFormat: "hex",
|
|
777
|
+
});
|
|
778
|
+
return combinedHash;
|
|
779
|
+
}
|
|
780
|
+
catch (e) {
|
|
781
|
+
console.warn("Error computing library hash:", e);
|
|
782
|
+
// Fallback to a fixed value if we can't compute the hash
|
|
783
|
+
return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Gets a hash of a specific module
|
|
788
|
+
*
|
|
789
|
+
* @param moduleName - Name of the module to hash
|
|
790
|
+
* @returns Hash of the module
|
|
791
|
+
*/
|
|
792
|
+
function getModuleHash(moduleName) {
|
|
793
|
+
try {
|
|
794
|
+
// Try to use Node.js fs module to read the actual module file if available
|
|
795
|
+
if (typeof require === "function") {
|
|
796
|
+
try {
|
|
797
|
+
const fs = require("fs");
|
|
798
|
+
const path = require("path");
|
|
799
|
+
const crypto = require("crypto");
|
|
800
|
+
// Map module name to file path
|
|
801
|
+
let filePath = "";
|
|
802
|
+
// Determine the file path based on the module name
|
|
803
|
+
if (["crypto", "hash", "keys", "random", "validators"].includes(moduleName)) {
|
|
804
|
+
filePath = `core/${moduleName}.ts`;
|
|
805
|
+
}
|
|
806
|
+
else if ([
|
|
807
|
+
"attestation",
|
|
808
|
+
"canary-tokens",
|
|
809
|
+
"entropy-augmentation",
|
|
810
|
+
"memory-hard",
|
|
811
|
+
"post-quantum",
|
|
812
|
+
"secure-memory",
|
|
813
|
+
"secure-serialization",
|
|
814
|
+
"side-channel",
|
|
815
|
+
].includes(moduleName)) {
|
|
816
|
+
filePath = `security/${moduleName}.ts`;
|
|
817
|
+
}
|
|
818
|
+
else if (["constants", "encoding", "stats", "testing"].includes(moduleName)) {
|
|
819
|
+
filePath = `utils/${moduleName}.ts`;
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
throw new Error(`Unknown module: ${moduleName}`);
|
|
823
|
+
}
|
|
824
|
+
// Try to find the src directory
|
|
825
|
+
let srcDir = "";
|
|
826
|
+
const possiblePaths = [
|
|
827
|
+
"src",
|
|
828
|
+
"../src",
|
|
829
|
+
"../../src",
|
|
830
|
+
path.resolve(__dirname, "../"),
|
|
831
|
+
path.resolve(__dirname, "../../src"),
|
|
832
|
+
path.resolve(process.cwd(), "src"),
|
|
833
|
+
];
|
|
834
|
+
for (const possiblePath of possiblePaths) {
|
|
835
|
+
try {
|
|
836
|
+
if (fs.existsSync(possiblePath) &&
|
|
837
|
+
fs.statSync(possiblePath).isDirectory()) {
|
|
838
|
+
// Check if this directory contains our expected files
|
|
839
|
+
if (fs.existsSync(path.join(possiblePath, "core")) ||
|
|
840
|
+
fs.existsSync(path.join(possiblePath, "security"))) {
|
|
841
|
+
srcDir = possiblePath;
|
|
842
|
+
break;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
catch (e) {
|
|
847
|
+
// Ignore errors and try the next path
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (!srcDir) {
|
|
851
|
+
throw new Error("Could not find src directory");
|
|
852
|
+
}
|
|
853
|
+
// Read the file
|
|
854
|
+
const fullPath = path.join(srcDir, filePath);
|
|
855
|
+
if (fs.existsSync(fullPath)) {
|
|
856
|
+
const content = fs.readFileSync(fullPath, "utf8");
|
|
857
|
+
// Create a hash of the file content
|
|
858
|
+
const hash = crypto.createHash("sha256");
|
|
859
|
+
hash.update(`${filePath}:${content}`);
|
|
860
|
+
return hash.digest("hex");
|
|
861
|
+
}
|
|
862
|
+
else {
|
|
863
|
+
throw new Error(`File not found: ${fullPath}`);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
catch (e) {
|
|
867
|
+
console.warn(`Error reading module file for ${moduleName}:`, e);
|
|
868
|
+
// Fall back to the simplified approach
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
// If we can't read the actual file, use a more sophisticated fallback approach
|
|
872
|
+
// that still provides some real information about the module
|
|
873
|
+
// Create a representation of the module based on its expected structure and features
|
|
874
|
+
let moduleRepresentation = "";
|
|
875
|
+
// Add module name
|
|
876
|
+
moduleRepresentation += `module:${moduleName};`;
|
|
877
|
+
// Add module version from package.json if available
|
|
878
|
+
let version = "1.0.0"; // Default version
|
|
879
|
+
if (typeof require === "function") {
|
|
880
|
+
try {
|
|
881
|
+
const path = require("path");
|
|
882
|
+
const fs = require("fs");
|
|
883
|
+
// Try to find package.json
|
|
884
|
+
const possiblePaths = [
|
|
885
|
+
"package.json",
|
|
886
|
+
"../package.json",
|
|
887
|
+
"../../package.json",
|
|
888
|
+
path.resolve(__dirname, "../package.json"),
|
|
889
|
+
path.resolve(__dirname, "../../package.json"),
|
|
890
|
+
path.resolve(process.cwd(), "package.json"),
|
|
891
|
+
];
|
|
892
|
+
for (const possiblePath of possiblePaths) {
|
|
893
|
+
try {
|
|
894
|
+
if (fs.existsSync(possiblePath)) {
|
|
895
|
+
const packageJson = JSON.parse(fs.readFileSync(possiblePath, "utf8"));
|
|
896
|
+
if (packageJson.version) {
|
|
897
|
+
version = packageJson.version;
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
catch (e) {
|
|
903
|
+
// Ignore errors and try the next path
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
catch (e) {
|
|
908
|
+
// Ignore errors and use default version
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
moduleRepresentation += `version:${version};`;
|
|
912
|
+
// Add a timestamp to detect changes
|
|
913
|
+
moduleRepresentation += `timestamp:${Date.now()};`;
|
|
914
|
+
// Add module-specific data based on our knowledge of the codebase
|
|
915
|
+
switch (moduleName) {
|
|
916
|
+
case "crypto":
|
|
917
|
+
moduleRepresentation +=
|
|
918
|
+
"class:XyPrissSecurity;methods:encrypt,decrypt,hash,sign,verify,generateSecureToken,generateAPIKey,generateJWTSecret,generateSessionToken,generateTOTPSecret,calculatePasswordStrength,runSecurityTests,getStats,middleware,constantTimeEqual,secureModPow,faultResistantEqual,deriveKeyMemoryHard,deriveKeyBalloon,generateQuantumResistantKeypair,quantumResistantSign,quantumResistantVerify,generateRingLweKeypair,ringLweEncrypt,ringLweDecrypt,createSecureBuffer,createSecureString,createSecureObject,secureWipe,createCanaryToken,createCanaryObject,createCanaryFunction,triggerCanaryToken,verifyRuntimeSecurity,createTamperEvidentLogger;";
|
|
919
|
+
break;
|
|
920
|
+
case "hash":
|
|
921
|
+
moduleRepresentation +=
|
|
922
|
+
"class:Hash;methods:secureHash,sha256,sha512,sha3,blake3,hmac,pbkdf2;algorithms:sha256,sha512,sha3-256,sha3-512,blake3;features:salt,pepper,iterations,outputFormat;";
|
|
923
|
+
break;
|
|
924
|
+
case "keys":
|
|
925
|
+
moduleRepresentation +=
|
|
926
|
+
"class:Keys;methods:deriveKey,pbkdf2,scrypt,argon2;algorithms:pbkdf2,scrypt,argon2;features:salt,iterations,keyLength,hashFunction;implementations:node-crypto,pbkdf2-lib,scrypt-js,argon2-package,pure-js;";
|
|
927
|
+
break;
|
|
928
|
+
case "random":
|
|
929
|
+
moduleRepresentation +=
|
|
930
|
+
"class:SecureRandom;methods:getRandomBytes,getRandomString,getRandomNumber,getRandomBits,getRandomInt,getRandomFloat,getRandomBoolean,getRandomElement,getRandomSubset,shuffle;entropy:high;sources:crypto.getRandomValues,crypto.randomBytes,Math.random;features:entropyPool,entropyCollection;";
|
|
931
|
+
break;
|
|
932
|
+
case "validators":
|
|
933
|
+
moduleRepresentation +=
|
|
934
|
+
"class:Validators;methods:validateString,validateNumber,validateInteger,validateBoolean,validateObject,validateArray,validateFunction,validateBuffer,validateAlgorithm,validateIterations,validateKeyLength,validateSalt;";
|
|
935
|
+
break;
|
|
936
|
+
case "attestation":
|
|
937
|
+
moduleRepresentation +=
|
|
938
|
+
"functions:generateAttestationKey,createAttestation,verifyAttestation,createLibraryAttestation,verifyLibraryAttestation,signPayload,verifySignature,getEnvironmentInfo,getLibraryHash,getModuleHash;features:asymmetricCrypto,environmentDetection,libraryIntegrity;";
|
|
939
|
+
break;
|
|
940
|
+
case "canary-tokens":
|
|
941
|
+
moduleRepresentation +=
|
|
942
|
+
"functions:createCanaryToken,triggerCanaryToken,createCanaryObject,createCanaryFunction;features:tokenGeneration,objectProxies,functionWrapping,callbackNotification,contextCollection;";
|
|
943
|
+
break;
|
|
944
|
+
case "entropy-augmentation":
|
|
945
|
+
moduleRepresentation +=
|
|
946
|
+
"class:EntropyAugmentation;methods:collectEntropy,addToEntropyPool,getEntropyBytes,collectSystemEntropy,collectBrowserEntropy,collectPerformanceEntropy,collectDeviceEntropy,collectNetworkEntropy;sources:system,browser,performance,device,network;";
|
|
947
|
+
break;
|
|
948
|
+
case "memory-hard":
|
|
949
|
+
moduleRepresentation +=
|
|
950
|
+
"functions:deriveKeyMemoryHard,deriveKeyBalloon;algorithms:argon2id,balloon;features:memoryCost,timeCost,parallelism;";
|
|
951
|
+
break;
|
|
952
|
+
case "post-quantum":
|
|
953
|
+
moduleRepresentation +=
|
|
954
|
+
"functions:lamportSign,lamportVerify,generateLamportKeyPair,ringLweEncrypt,ringLweDecrypt,generateRingLweKeyPair,kyberEncapsulate,kyberDecapsulate,generateKyberKeyPair;algorithms:lamport,ringLWE,kyber;features:hashBased,latticeBased,keyEncapsulation;";
|
|
955
|
+
break;
|
|
956
|
+
case "secure-memory":
|
|
957
|
+
moduleRepresentation +=
|
|
958
|
+
"classes:SecureBuffer,SecureString,SecureObject;methods:from,getBuffer,equals,destroy,toString,length,append,clear,set,get,getAll,setAll,has,delete;features:autoZeroing,explicitClearing,constantTimeComparison;";
|
|
959
|
+
break;
|
|
960
|
+
case "secure-serialization":
|
|
961
|
+
moduleRepresentation +=
|
|
962
|
+
"functions:secureSerialize,secureDeserialize,createSecureReviver,validateSchema,sanitizeObject;features:schemaValidation,typeChecking,prototypeProtection,circularReferenceHandling;";
|
|
963
|
+
break;
|
|
964
|
+
case "side-channel":
|
|
965
|
+
moduleRepresentation +=
|
|
966
|
+
"functions:constantTimeEqual,secureModPow,faultResistantEqual,maskedAccess,timeResistantCompare;features:timingAttackProtection,faultInjectionProtection,cacheSideChannelProtection;";
|
|
967
|
+
break;
|
|
968
|
+
case "constants":
|
|
969
|
+
moduleRepresentation +=
|
|
970
|
+
"constants:SECURITY_DEFAULTS,ERROR_MESSAGES,CHARSETS;values:PBKDF2_ITERATIONS,SCRYPT_COST,ARGON2_ITERATIONS,KEY_LENGTH,SALT_LENGTH,TOKEN_LENGTH,PASSWORD_MIN_LENGTH,PASSWORD_MIN_ENTROPY;";
|
|
971
|
+
break;
|
|
972
|
+
case "encoding":
|
|
973
|
+
moduleRepresentation +=
|
|
974
|
+
"functions:bufferToHex,hexToBuffer,bufferToBase64,base64ToBuffer,bufferToBase58,base58ToBuffer,bufferToUtf8,utf8ToBuffer;features:noDepencencies,browserCompatible;";
|
|
975
|
+
break;
|
|
976
|
+
case "stats":
|
|
977
|
+
moduleRepresentation +=
|
|
978
|
+
"class:StatsTracker;methods:getInstance,trackTokenGeneration,trackHashComputation,trackKeyDerivation,getStats,resetStats;features:singleton,operationCounting,timingMeasurement,entropyTracking;";
|
|
979
|
+
break;
|
|
980
|
+
case "testing":
|
|
981
|
+
moduleRepresentation +=
|
|
982
|
+
"functions:runSecurityTests,testTokenUniqueness,testDistribution,testHashConsistency;features:randomnessTests,hashingTests,timingAttackTests;";
|
|
983
|
+
break;
|
|
984
|
+
default:
|
|
985
|
+
moduleRepresentation += "type:unknown;";
|
|
986
|
+
}
|
|
987
|
+
// Add information about the module's dependencies
|
|
988
|
+
const dependencies = {
|
|
989
|
+
crypto: ["random", "hash", "keys", "validators"],
|
|
990
|
+
hash: ["encoding", "constants", "stats"],
|
|
991
|
+
keys: [
|
|
992
|
+
"random",
|
|
993
|
+
"hash",
|
|
994
|
+
"encoding",
|
|
995
|
+
"constants",
|
|
996
|
+
"stats",
|
|
997
|
+
"validators",
|
|
998
|
+
],
|
|
999
|
+
random: ["encoding", "constants", "stats"],
|
|
1000
|
+
validators: ["constants"],
|
|
1001
|
+
attestation: ["random", "hash", "encoding", "side-channel"],
|
|
1002
|
+
"canary-tokens": ["random", "hash"],
|
|
1003
|
+
"entropy-augmentation": ["random"],
|
|
1004
|
+
"memory-hard": ["random", "hash", "encoding"],
|
|
1005
|
+
"post-quantum": ["random", "hash", "encoding"],
|
|
1006
|
+
"secure-memory": ["random"],
|
|
1007
|
+
"secure-serialization": ["hash"],
|
|
1008
|
+
"side-channel": ["random"],
|
|
1009
|
+
constants: [],
|
|
1010
|
+
encoding: [],
|
|
1011
|
+
stats: ["constants"],
|
|
1012
|
+
testing: ["random", "hash", "stats"],
|
|
1013
|
+
};
|
|
1014
|
+
if (dependencies[moduleName]) {
|
|
1015
|
+
moduleRepresentation += `dependencies:${dependencies[moduleName].join(",")};`;
|
|
1016
|
+
}
|
|
1017
|
+
// Hash the module representation
|
|
1018
|
+
return Hash.create(moduleRepresentation, {
|
|
1019
|
+
algorithm: "sha256",
|
|
1020
|
+
outputFormat: "hex",
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
catch (e) {
|
|
1024
|
+
console.warn(`Error computing hash for module ${moduleName}:`, e);
|
|
1025
|
+
// Fallback to a fixed value if we can't compute the hash
|
|
1026
|
+
return `${moduleName}-default-hash-${Date.now()}`;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Deep equality check for objects
|
|
1031
|
+
*
|
|
1032
|
+
* @param a - First object
|
|
1033
|
+
* @param b - Second object
|
|
1034
|
+
* @returns True if the objects are deeply equal
|
|
1035
|
+
*/
|
|
1036
|
+
function deepEqual(a, b) {
|
|
1037
|
+
if (a === b)
|
|
1038
|
+
return true;
|
|
1039
|
+
if (typeof a !== "object" ||
|
|
1040
|
+
a === null ||
|
|
1041
|
+
typeof b !== "object" ||
|
|
1042
|
+
b === null) {
|
|
1043
|
+
return false;
|
|
1044
|
+
}
|
|
1045
|
+
const keysA = Object.keys(a);
|
|
1046
|
+
const keysB = Object.keys(b);
|
|
1047
|
+
if (keysA.length !== keysB.length)
|
|
1048
|
+
return false;
|
|
1049
|
+
for (const key of keysA) {
|
|
1050
|
+
if (!keysB.includes(key))
|
|
1051
|
+
return false;
|
|
1052
|
+
if (!deepEqual(a[key], b[key]))
|
|
1053
|
+
return false;
|
|
1054
|
+
}
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
export { createAttestation, createLibraryAttestation, generateAttestationKey, verifyAttestation, verifyLibraryAttestation };
|
|
1059
|
+
//# sourceMappingURL=attestation.js.map
|