react-native-quick-crypto 1.0.0-beta.20 → 1.0.0-beta.22
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/QuickCrypto.podspec +81 -8
- package/android/CMakeLists.txt +33 -1
- package/cpp/blake3/HybridBlake3.cpp +118 -0
- package/cpp/blake3/HybridBlake3.hpp +35 -0
- package/cpp/cipher/GCMCipher.cpp +68 -0
- package/cpp/cipher/GCMCipher.hpp +14 -0
- package/cpp/cipher/HybridCipherFactory.hpp +13 -0
- package/cpp/cipher/HybridRsaCipher.cpp +229 -0
- package/cpp/cipher/HybridRsaCipher.hpp +23 -0
- package/cpp/ec/HybridEcKeyPair.cpp +428 -0
- package/cpp/ec/HybridEcKeyPair.hpp +48 -0
- package/cpp/ed25519/HybridEdKeyPair.cpp +78 -4
- package/cpp/ed25519/HybridEdKeyPair.hpp +9 -2
- package/cpp/hash/HybridHash.cpp +37 -3
- package/cpp/hash/HybridHash.hpp +5 -3
- package/cpp/keys/HybridKeyObjectHandle.cpp +742 -0
- package/cpp/keys/HybridKeyObjectHandle.hpp +51 -0
- package/cpp/keys/KeyObjectData.cpp +226 -0
- package/cpp/keys/KeyObjectData.hpp +71 -0
- package/cpp/keys/node.h +5 -0
- package/cpp/rsa/HybridRsaKeyPair.cpp +154 -0
- package/cpp/rsa/HybridRsaKeyPair.hpp +43 -0
- package/cpp/utils/Macros.hpp +68 -0
- package/cpp/utils/Utils.hpp +27 -0
- package/cpp/utils/base64.h +309 -0
- package/deps/blake3/.cargo/config.toml +2 -0
- package/deps/blake3/.git-blame-ignore-revs +2 -0
- package/deps/blake3/.github/workflows/build_b3sum.py +38 -0
- package/deps/blake3/.github/workflows/ci.yml +491 -0
- package/deps/blake3/.github/workflows/tag.yml +43 -0
- package/deps/blake3/.github/workflows/upload_github_release_asset.py +73 -0
- package/deps/blake3/CONTRIBUTING.md +31 -0
- package/deps/blake3/Cargo.toml +135 -0
- package/deps/blake3/LICENSE_A2 +202 -0
- package/deps/blake3/LICENSE_A2LLVM +219 -0
- package/deps/blake3/LICENSE_CC0 +121 -0
- package/deps/blake3/README.md +229 -0
- package/deps/blake3/b3sum/Cargo.lock +513 -0
- package/deps/blake3/b3sum/Cargo.toml +26 -0
- package/deps/blake3/b3sum/README.md +72 -0
- package/deps/blake3/b3sum/src/main.rs +564 -0
- package/deps/blake3/b3sum/src/unit_tests.rs +235 -0
- package/deps/blake3/b3sum/tests/cli_tests.rs +680 -0
- package/deps/blake3/b3sum/what_does_check_do.md +176 -0
- package/deps/blake3/benches/bench.rs +623 -0
- package/deps/blake3/build.rs +389 -0
- package/deps/blake3/c/CMakeLists.txt +383 -0
- package/deps/blake3/c/CMakePresets.json +73 -0
- package/deps/blake3/c/Makefile.testing +82 -0
- package/deps/blake3/c/README.md +403 -0
- package/deps/blake3/c/blake3-config.cmake.in +14 -0
- package/deps/blake3/c/blake3.c +650 -0
- package/deps/blake3/c/blake3.h +86 -0
- package/deps/blake3/c/blake3_avx2.c +326 -0
- package/deps/blake3/c/blake3_avx2_x86-64_unix.S +1815 -0
- package/deps/blake3/c/blake3_avx2_x86-64_windows_gnu.S +1817 -0
- package/deps/blake3/c/blake3_avx2_x86-64_windows_msvc.asm +1828 -0
- package/deps/blake3/c/blake3_avx512.c +1388 -0
- package/deps/blake3/c/blake3_avx512_x86-64_unix.S +4824 -0
- package/deps/blake3/c/blake3_avx512_x86-64_windows_gnu.S +2615 -0
- package/deps/blake3/c/blake3_avx512_x86-64_windows_msvc.asm +2634 -0
- package/deps/blake3/c/blake3_c_rust_bindings/Cargo.toml +32 -0
- package/deps/blake3/c/blake3_c_rust_bindings/README.md +4 -0
- package/deps/blake3/c/blake3_c_rust_bindings/benches/bench.rs +477 -0
- package/deps/blake3/c/blake3_c_rust_bindings/build.rs +253 -0
- package/deps/blake3/c/blake3_c_rust_bindings/cross_test.sh +31 -0
- package/deps/blake3/c/blake3_c_rust_bindings/src/lib.rs +333 -0
- package/deps/blake3/c/blake3_c_rust_bindings/src/test.rs +696 -0
- package/deps/blake3/c/blake3_dispatch.c +332 -0
- package/deps/blake3/c/blake3_impl.h +333 -0
- package/deps/blake3/c/blake3_neon.c +366 -0
- package/deps/blake3/c/blake3_portable.c +160 -0
- package/deps/blake3/c/blake3_sse2.c +566 -0
- package/deps/blake3/c/blake3_sse2_x86-64_unix.S +2291 -0
- package/deps/blake3/c/blake3_sse2_x86-64_windows_gnu.S +2332 -0
- package/deps/blake3/c/blake3_sse2_x86-64_windows_msvc.asm +2350 -0
- package/deps/blake3/c/blake3_sse41.c +560 -0
- package/deps/blake3/c/blake3_sse41_x86-64_unix.S +2028 -0
- package/deps/blake3/c/blake3_sse41_x86-64_windows_gnu.S +2069 -0
- package/deps/blake3/c/blake3_sse41_x86-64_windows_msvc.asm +2089 -0
- package/deps/blake3/c/blake3_tbb.cpp +37 -0
- package/deps/blake3/c/dependencies/CMakeLists.txt +3 -0
- package/deps/blake3/c/dependencies/tbb/CMakeLists.txt +28 -0
- package/deps/blake3/c/example.c +36 -0
- package/deps/blake3/c/example_tbb.c +57 -0
- package/deps/blake3/c/libblake3.pc.in +12 -0
- package/deps/blake3/c/main.c +166 -0
- package/deps/blake3/c/test.py +97 -0
- package/deps/blake3/media/B3.svg +70 -0
- package/deps/blake3/media/BLAKE3.svg +85 -0
- package/deps/blake3/media/speed.svg +1474 -0
- package/deps/blake3/reference_impl/Cargo.toml +8 -0
- package/deps/blake3/reference_impl/README.md +14 -0
- package/deps/blake3/reference_impl/reference_impl.rs +374 -0
- package/deps/blake3/src/ffi_avx2.rs +65 -0
- package/deps/blake3/src/ffi_avx512.rs +169 -0
- package/deps/blake3/src/ffi_neon.rs +82 -0
- package/deps/blake3/src/ffi_sse2.rs +126 -0
- package/deps/blake3/src/ffi_sse41.rs +126 -0
- package/deps/blake3/src/guts.rs +60 -0
- package/deps/blake3/src/hazmat.rs +704 -0
- package/deps/blake3/src/io.rs +64 -0
- package/deps/blake3/src/join.rs +92 -0
- package/deps/blake3/src/lib.rs +1835 -0
- package/deps/blake3/src/platform.rs +587 -0
- package/deps/blake3/src/portable.rs +198 -0
- package/deps/blake3/src/rust_avx2.rs +474 -0
- package/deps/blake3/src/rust_sse2.rs +775 -0
- package/deps/blake3/src/rust_sse41.rs +766 -0
- package/deps/blake3/src/test.rs +1049 -0
- package/deps/blake3/src/traits.rs +227 -0
- package/deps/blake3/src/wasm32_simd.rs +794 -0
- package/deps/blake3/test_vectors/Cargo.toml +19 -0
- package/deps/blake3/test_vectors/cross_test.sh +25 -0
- package/deps/blake3/test_vectors/src/bin/generate.rs +4 -0
- package/deps/blake3/test_vectors/src/lib.rs +350 -0
- package/deps/blake3/test_vectors/test_vectors.json +217 -0
- package/deps/blake3/tools/compiler_version/Cargo.toml +7 -0
- package/deps/blake3/tools/compiler_version/build.rs +6 -0
- package/deps/blake3/tools/compiler_version/src/main.rs +27 -0
- package/deps/blake3/tools/instruction_set_support/Cargo.toml +6 -0
- package/deps/blake3/tools/instruction_set_support/src/main.rs +10 -0
- package/deps/blake3/tools/release.md +16 -0
- package/deps/ncrypto/ncrypto.cc +4679 -0
- package/deps/ncrypto/ncrypto.h +1625 -0
- package/lib/commonjs/blake3.js +98 -0
- package/lib/commonjs/blake3.js.map +1 -0
- package/lib/commonjs/ec.js +412 -0
- package/lib/commonjs/ec.js.map +1 -0
- package/lib/commonjs/ed.js +143 -0
- package/lib/commonjs/ed.js.map +1 -1
- package/lib/commonjs/expo-plugin/withXCode.js +3 -3
- package/lib/commonjs/hash.js +48 -1
- package/lib/commonjs/hash.js.map +1 -1
- package/lib/commonjs/index.js +54 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/keys/classes.js +111 -52
- package/lib/commonjs/keys/classes.js.map +1 -1
- package/lib/commonjs/keys/generateKeyPair.js +98 -144
- package/lib/commonjs/keys/generateKeyPair.js.map +1 -1
- package/lib/commonjs/keys/index.js +27 -0
- package/lib/commonjs/keys/index.js.map +1 -1
- package/lib/commonjs/keys/utils.js +18 -13
- package/lib/commonjs/keys/utils.js.map +1 -1
- package/lib/commonjs/rsa.js +129 -0
- package/lib/commonjs/rsa.js.map +1 -0
- package/lib/commonjs/specs/blake3.nitro.js +6 -0
- package/lib/commonjs/specs/blake3.nitro.js.map +1 -0
- package/lib/commonjs/specs/ecKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/ecKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/specs/rsaCipher.nitro.js +6 -0
- package/lib/commonjs/specs/rsaCipher.nitro.js.map +1 -0
- package/lib/commonjs/specs/rsaKeyPair.nitro.js +6 -0
- package/lib/commonjs/specs/rsaKeyPair.nitro.js.map +1 -0
- package/lib/commonjs/subtle.js +768 -0
- package/lib/commonjs/subtle.js.map +1 -0
- package/lib/commonjs/utils/conversion.js +26 -3
- package/lib/commonjs/utils/conversion.js.map +1 -1
- package/lib/commonjs/utils/hashnames.js +2 -1
- package/lib/commonjs/utils/hashnames.js.map +1 -1
- package/lib/commonjs/utils/index.js +11 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/noble.js +82 -0
- package/lib/commonjs/utils/noble.js.map +1 -0
- package/lib/commonjs/utils/types.js +28 -16
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/commonjs/utils/validation.js +74 -1
- package/lib/commonjs/utils/validation.js.map +1 -1
- package/lib/module/blake3.js +90 -0
- package/lib/module/blake3.js.map +1 -0
- package/lib/module/ec.js +404 -0
- package/lib/module/ec.js.map +1 -0
- package/lib/module/ed.js +141 -0
- package/lib/module/ed.js.map +1 -1
- package/lib/module/expo-plugin/withXCode.js +3 -3
- package/lib/module/hash.js +47 -2
- package/lib/module/hash.js.map +1 -1
- package/lib/module/index.js +9 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/keys/classes.js +108 -49
- package/lib/module/keys/classes.js.map +1 -1
- package/lib/module/keys/generateKeyPair.js +91 -143
- package/lib/module/keys/generateKeyPair.js.map +1 -1
- package/lib/module/keys/index.js +9 -6
- package/lib/module/keys/index.js.map +1 -1
- package/lib/module/keys/utils.js +16 -12
- package/lib/module/keys/utils.js.map +1 -1
- package/lib/module/rsa.js +123 -0
- package/lib/module/rsa.js.map +1 -0
- package/lib/module/specs/blake3.nitro.js +4 -0
- package/lib/module/specs/blake3.nitro.js.map +1 -0
- package/lib/module/specs/ecKeyPair.nitro.js +4 -0
- package/lib/module/specs/ecKeyPair.nitro.js.map +1 -0
- package/lib/module/specs/rsaCipher.nitro.js +4 -0
- package/lib/module/specs/rsaCipher.nitro.js.map +1 -0
- package/lib/module/specs/rsaKeyPair.nitro.js +4 -0
- package/lib/module/specs/rsaKeyPair.nitro.js.map +1 -0
- package/lib/module/subtle.js +763 -0
- package/lib/module/subtle.js.map +1 -0
- package/lib/module/utils/conversion.js +8 -3
- package/lib/module/utils/conversion.js.map +1 -1
- package/lib/module/utils/hashnames.js +2 -1
- package/lib/module/utils/hashnames.js.map +1 -1
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/noble.js +76 -0
- package/lib/module/utils/noble.js.map +1 -0
- package/lib/module/utils/types.js +26 -17
- package/lib/module/utils/types.js.map +1 -1
- package/lib/module/utils/validation.js +69 -1
- package/lib/module/utils/validation.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/blake3.d.ts +33 -0
- package/lib/typescript/blake3.d.ts.map +1 -0
- package/lib/typescript/ec.d.ts +13 -0
- package/lib/typescript/ec.d.ts.map +1 -0
- package/lib/typescript/ed.d.ts +27 -1
- package/lib/typescript/ed.d.ts.map +1 -1
- package/lib/typescript/hash.d.ts +14 -1
- package/lib/typescript/hash.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +45 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/keys/classes.d.ts +49 -8
- package/lib/typescript/keys/classes.d.ts.map +1 -1
- package/lib/typescript/keys/generateKeyPair.d.ts +5 -0
- package/lib/typescript/keys/generateKeyPair.d.ts.map +1 -1
- package/lib/typescript/keys/index.d.ts +5 -2
- package/lib/typescript/keys/index.d.ts.map +1 -1
- package/lib/typescript/keys/utils.d.ts +3 -1
- package/lib/typescript/keys/utils.d.ts.map +1 -1
- package/lib/typescript/rsa.d.ts +10 -0
- package/lib/typescript/rsa.d.ts.map +1 -0
- package/lib/typescript/specs/blake3.nitro.d.ts +15 -0
- package/lib/typescript/specs/blake3.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/ecKeyPair.nitro.d.ts +20 -0
- package/lib/typescript/specs/ecKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/edKeyPair.nitro.d.ts +1 -0
- package/lib/typescript/specs/edKeyPair.nitro.d.ts.map +1 -1
- package/lib/typescript/specs/hash.nitro.d.ts +1 -0
- package/lib/typescript/specs/hash.nitro.d.ts.map +1 -1
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts +1 -1
- package/lib/typescript/specs/keyObjectHandle.nitro.d.ts.map +1 -1
- package/lib/typescript/specs/rsaCipher.nitro.d.ts +26 -0
- package/lib/typescript/specs/rsaCipher.nitro.d.ts.map +1 -0
- package/lib/typescript/specs/rsaKeyPair.nitro.d.ts +20 -0
- package/lib/typescript/specs/rsaKeyPair.nitro.d.ts.map +1 -0
- package/lib/typescript/subtle.d.ts +17 -0
- package/lib/typescript/subtle.d.ts.map +1 -0
- package/lib/typescript/utils/cipher.d.ts +1 -1
- package/lib/typescript/utils/conversion.d.ts +1 -0
- package/lib/typescript/utils/conversion.d.ts.map +1 -1
- package/lib/typescript/utils/hashnames.d.ts +3 -1
- package/lib/typescript/utils/hashnames.d.ts.map +1 -1
- package/lib/typescript/utils/index.d.ts +1 -0
- package/lib/typescript/utils/index.d.ts.map +1 -1
- package/lib/typescript/utils/noble.d.ts +19 -0
- package/lib/typescript/utils/noble.d.ts.map +1 -0
- package/lib/typescript/utils/types.d.ts +102 -18
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/lib/typescript/utils/validation.d.ts +5 -0
- package/lib/typescript/utils/validation.d.ts.map +1 -1
- package/nitrogen/generated/.gitattributes +1 -1
- package/nitrogen/generated/android/QuickCrypto+autolinking.cmake +4 -0
- package/nitrogen/generated/android/QuickCryptoOnLoad.cpp +50 -0
- package/nitrogen/generated/ios/QuickCrypto-Swift-Cxx-Umbrella.hpp +2 -1
- package/nitrogen/generated/ios/QuickCryptoAutolinking.mm +50 -0
- package/nitrogen/generated/shared/c++/AsymmetricKeyType.hpp +104 -0
- package/nitrogen/generated/shared/c++/CipherArgs.hpp +4 -6
- package/nitrogen/generated/shared/c++/HybridBlake3Spec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridBlake3Spec.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridCipherFactorySpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridCipherSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridEcKeyPairSpec.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridEdKeyPairSpec.hpp +3 -2
- package/nitrogen/generated/shared/c++/HybridHashSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridHashSpec.hpp +2 -1
- package/nitrogen/generated/shared/c++/HybridKeyObjectHandleSpec.hpp +6 -6
- package/nitrogen/generated/shared/c++/HybridPbkdf2Spec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridRandomSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridRsaCipherSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridRsaKeyPairSpec.hpp +77 -0
- package/nitrogen/generated/shared/c++/JWK.hpp +15 -17
- package/nitrogen/generated/shared/c++/JWKkty.hpp +11 -13
- package/nitrogen/generated/shared/c++/JWKuse.hpp +7 -9
- package/nitrogen/generated/shared/c++/KFormatType.hpp +12 -14
- package/nitrogen/generated/shared/c++/KeyDetail.hpp +4 -6
- package/nitrogen/generated/shared/c++/KeyEncoding.hpp +13 -15
- package/nitrogen/generated/shared/c++/KeyObject.hpp +67 -0
- package/nitrogen/generated/shared/c++/KeyType.hpp +9 -11
- package/nitrogen/generated/shared/c++/KeyUsage.hpp +37 -23
- package/nitrogen/generated/shared/c++/NamedCurve.hpp +9 -11
- package/package.json +14 -11
- package/src/blake3.ts +123 -0
- package/src/ec.ts +534 -0
- package/src/ed.ts +179 -2
- package/src/expo-plugin/withXCode.ts +3 -3
- package/src/hash.ts +68 -2
- package/src/index.ts +8 -0
- package/src/keys/classes.ts +161 -55
- package/src/keys/generateKeyPair.ts +133 -134
- package/src/keys/index.ts +13 -3
- package/src/keys/utils.ts +24 -18
- package/src/rsa.ts +176 -0
- package/src/specs/blake3.nitro.ts +12 -0
- package/src/specs/ecKeyPair.nitro.ts +38 -0
- package/src/specs/edKeyPair.nitro.ts +2 -0
- package/src/specs/hash.nitro.ts +1 -0
- package/src/specs/keyObjectHandle.nitro.ts +1 -1
- package/src/specs/rsaCipher.nitro.ts +35 -0
- package/src/specs/rsaKeyPair.nitro.ts +33 -0
- package/src/subtle.ts +1119 -0
- package/src/utils/conversion.ts +10 -2
- package/src/utils/hashnames.ts +4 -2
- package/src/utils/index.ts +1 -0
- package/src/utils/noble.ts +85 -0
- package/src/utils/types.ts +148 -26
- package/src/utils/validation.ts +96 -1
- package/ios/libsodium-stable/.github/workflows/autocloser.yml +0 -12
- package/ios/libsodium-stable/.github/workflows/ci.yml +0 -180
- package/ios/libsodium-stable/.github/workflows/cifuzz.yml +0 -32
- package/ios/libsodium-stable/.github/workflows/codeql-analysis.yml +0 -48
- package/ios/libsodium-stable/.github/workflows/dotnet-core.yml +0 -388
- package/ios/libsodium-stable/AUTHORS +0 -144
- package/ios/libsodium-stable/CITATION.cff +0 -18
- package/ios/libsodium-stable/ChangeLog +0 -677
- package/ios/libsodium-stable/LICENSE +0 -18
- package/ios/libsodium-stable/Makefile.am +0 -23
- package/ios/libsodium-stable/README.markdown +0 -76
- package/ios/libsodium-stable/THANKS +0 -92
- package/ios/libsodium-stable/appveyor.yml +0 -24
- package/ios/libsodium-stable/autogen.sh +0 -117
- package/ios/libsodium-stable/azure-pipelines.yml +0 -122
- package/ios/libsodium-stable/build.zig +0 -281
- package/ios/libsodium-stable/builds/Makefile.am +0 -81
- package/ios/libsodium-stable/builds/msvc/build/buildall.bat +0 -18
- package/ios/libsodium-stable/builds/msvc/build/buildbase.bat +0 -132
- package/ios/libsodium-stable/builds/msvc/properties/ARM64.props +0 -23
- package/ios/libsodium-stable/builds/msvc/properties/Common.props +0 -21
- package/ios/libsodium-stable/builds/msvc/properties/DLL.props +0 -16
- package/ios/libsodium-stable/builds/msvc/properties/Debug.props +0 -29
- package/ios/libsodium-stable/builds/msvc/properties/DebugDEXE.props +0 -21
- package/ios/libsodium-stable/builds/msvc/properties/DebugDLL.props +0 -20
- package/ios/libsodium-stable/builds/msvc/properties/DebugLEXE.props +0 -20
- package/ios/libsodium-stable/builds/msvc/properties/DebugLIB.props +0 -21
- package/ios/libsodium-stable/builds/msvc/properties/DebugLTCG.props +0 -20
- package/ios/libsodium-stable/builds/msvc/properties/DebugSEXE.props +0 -21
- package/ios/libsodium-stable/builds/msvc/properties/EXE.props +0 -17
- package/ios/libsodium-stable/builds/msvc/properties/LIB.props +0 -16
- package/ios/libsodium-stable/builds/msvc/properties/LTCG.props +0 -13
- package/ios/libsodium-stable/builds/msvc/properties/Link.props +0 -21
- package/ios/libsodium-stable/builds/msvc/properties/Messages.props +0 -15
- package/ios/libsodium-stable/builds/msvc/properties/Output.props +0 -30
- package/ios/libsodium-stable/builds/msvc/properties/Release.props +0 -41
- package/ios/libsodium-stable/builds/msvc/properties/ReleaseDEXE.props +0 -20
- package/ios/libsodium-stable/builds/msvc/properties/ReleaseDLL.props +0 -19
- package/ios/libsodium-stable/builds/msvc/properties/ReleaseLEXE.props +0 -20
- package/ios/libsodium-stable/builds/msvc/properties/ReleaseLIB.props +0 -19
- package/ios/libsodium-stable/builds/msvc/properties/ReleaseLTCG.props +0 -19
- package/ios/libsodium-stable/builds/msvc/properties/ReleaseSEXE.props +0 -20
- package/ios/libsodium-stable/builds/msvc/properties/Win32.props +0 -23
- package/ios/libsodium-stable/builds/msvc/properties/x64.props +0 -26
- package/ios/libsodium-stable/builds/msvc/resource.h +0 -14
- package/ios/libsodium-stable/builds/msvc/resource.rc +0 -65
- package/ios/libsodium-stable/builds/msvc/version.h +0 -33
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium/libsodium.vcxproj +0 -346
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2010/libsodium.sln +0 -50
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium/libsodium.vcxproj +0 -346
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2012/libsodium.sln +0 -50
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium/libsodium.vcxproj +0 -346
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2013/libsodium.sln +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium/libsodium.vcxproj +0 -346
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2015/libsodium.sln +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium/libsodium.vcxproj +0 -346
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2017/libsodium.sln +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium/libsodium.vcxproj +0 -370
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2019/libsodium.sln +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium/libsodium.props +0 -48
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium/libsodium.vcxproj +0 -370
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium/libsodium.vcxproj.filters +0 -1088
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium/libsodium.xml +0 -15
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium.import.props +0 -52
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium.import.xml +0 -17
- package/ios/libsodium-stable/builds/msvc/vs2022/libsodium.sln +0 -70
- package/ios/libsodium-stable/ci/appveyor/libsodium.sln +0 -40
- package/ios/libsodium-stable/ci/appveyor/libsodium.vcxproj +0 -594
- package/ios/libsodium-stable/ci/appveyor/libsodium.vcxproj.filters +0 -813
- package/ios/libsodium-stable/ci/appveyor/msvc-scripts/process.bat +0 -5
- package/ios/libsodium-stable/ci/appveyor/msvc-scripts/rep.vbs +0 -12
- package/ios/libsodium-stable/ci/appveyor/msvc-scripts/sodium.props +0 -29
- package/ios/libsodium-stable/configure.ac +0 -1004
- package/ios/libsodium-stable/contrib/Findsodium.cmake +0 -297
- package/ios/libsodium-stable/contrib/Makefile.am +0 -3
- package/ios/libsodium-stable/dist-build/Makefile.am +0 -14
- package/ios/libsodium-stable/dist-build/android-aar.sh +0 -194
- package/ios/libsodium-stable/dist-build/android-armv7-a.sh +0 -5
- package/ios/libsodium-stable/dist-build/android-armv8-a.sh +0 -5
- package/ios/libsodium-stable/dist-build/android-build.sh +0 -95
- package/ios/libsodium-stable/dist-build/android-x86.sh +0 -5
- package/ios/libsodium-stable/dist-build/android-x86_64.sh +0 -5
- package/ios/libsodium-stable/dist-build/apple-xcframework.sh +0 -628
- package/ios/libsodium-stable/dist-build/emscripten-symbols.def +0 -651
- package/ios/libsodium-stable/dist-build/emscripten.sh +0 -206
- package/ios/libsodium-stable/dist-build/generate-emscripten-symbols.sh +0 -59
- package/ios/libsodium-stable/dist-build/macos.sh +0 -26
- package/ios/libsodium-stable/dist-build/msys2-win32.sh +0 -18
- package/ios/libsodium-stable/dist-build/msys2-win64.sh +0 -18
- package/ios/libsodium-stable/dist-build/wasm32-wasi.sh +0 -45
- package/ios/libsodium-stable/lgtm.yml +0 -6
- package/ios/libsodium-stable/libsodium-uninstalled.pc.in +0 -7
- package/ios/libsodium-stable/libsodium.pc.in +0 -12
- package/ios/libsodium-stable/logo.png +0 -0
- package/ios/libsodium-stable/m4/ax_add_fortify_source.m4 +0 -119
- package/ios/libsodium-stable/m4/ax_check_catchable_abrt.m4 +0 -57
- package/ios/libsodium-stable/m4/ax_check_catchable_segv.m4 +0 -47
- package/ios/libsodium-stable/m4/ax_check_compile_flag.m4 +0 -55
- package/ios/libsodium-stable/m4/ax_check_define.m4 +0 -73
- package/ios/libsodium-stable/m4/ax_check_gnu_make.m4 +0 -95
- package/ios/libsodium-stable/m4/ax_check_link_flag.m4 +0 -75
- package/ios/libsodium-stable/m4/ax_pthread.m4 +0 -522
- package/ios/libsodium-stable/m4/ax_tls.m4 +0 -71
- package/ios/libsodium-stable/m4/ax_valgrind_check.m4 +0 -239
- package/ios/libsodium-stable/m4/ld-output-def.m4 +0 -29
- package/ios/libsodium-stable/packaging/dotnet-core/libsodium.pkgproj +0 -49
- package/ios/libsodium-stable/packaging/dotnet-core/test.cs +0 -43
- package/ios/libsodium-stable/packaging/nuget/package.bat +0 -13
- package/ios/libsodium-stable/packaging/nuget/package.config +0 -4
- package/ios/libsodium-stable/packaging/nuget/package.gsl +0 -260
- package/ios/libsodium-stable/regen-msvc/libsodium.vcxproj +0 -326
- package/ios/libsodium-stable/regen-msvc/libsodium.vcxproj.filters +0 -23
- package/ios/libsodium-stable/regen-msvc/libsodium.vcxproj.filters.tpl +0 -35
- package/ios/libsodium-stable/regen-msvc/libsodium.vcxproj.tpl +0 -37
- package/ios/libsodium-stable/regen-msvc/regen-msvc.py +0 -240
- package/ios/libsodium-stable/regen-msvc/tl_libsodium.vcxproj.filters.tpl +0 -23
- package/ios/libsodium-stable/regen-msvc/tl_libsodium.vcxproj.tpl +0 -332
- package/ios/libsodium-stable/src/Makefile.am +0 -3
- package/ios/libsodium-stable/src/libsodium/Makefile.am +0 -314
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c +0 -159
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_aesni.c +0 -70
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_aesni.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_armcrypto.c +0 -72
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_armcrypto.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_common.h +0 -248
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_soft.c +0 -59
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/aegis128l_soft.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis128l/implementations.h +0 -17
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aead_aegis256.c +0 -158
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_aesni.c +0 -65
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_aesni.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_armcrypto.c +0 -70
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_armcrypto.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_common.h +0 -231
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_soft.c +0 -54
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/aegis256_soft.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aegis256/implementations.h +0 -17
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aes256gcm/aead_aes256gcm.c +0 -157
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c +0 -1015
- package/ios/libsodium-stable/src/libsodium/crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c +0 -1033
- package/ios/libsodium-stable/src/libsodium/crypto_aead/chacha20poly1305/aead_chacha20poly1305.c +0 -400
- package/ios/libsodium-stable/src/libsodium/crypto_aead/xchacha20poly1305/aead_xchacha20poly1305.c +0 -262
- package/ios/libsodium-stable/src/libsodium/crypto_auth/crypto_auth.c +0 -41
- package/ios/libsodium-stable/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c +0 -118
- package/ios/libsodium-stable/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c +0 -118
- package/ios/libsodium-stable/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c +0 -93
- package/ios/libsodium-stable/src/libsodium/crypto_box/crypto_box.c +0 -114
- package/ios/libsodium-stable/src/libsodium/crypto_box/crypto_box_easy.c +0 -115
- package/ios/libsodium-stable/src/libsodium/crypto_box/crypto_box_seal.c +0 -68
- package/ios/libsodium-stable/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c +0 -204
- package/ios/libsodium-stable/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c +0 -79
- package/ios/libsodium-stable/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c +0 -156
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/core_ed25519.c +0 -225
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/core_ristretto255.c +0 -156
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c +0 -2873
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/base.h +0 -1344
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/base2.h +0 -40
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/constants.h +0 -40
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_25_5/fe.h +0 -220
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_51/base.h +0 -1344
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_51/base2.h +0 -40
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_51/constants.h +0 -41
- package/ios/libsodium-stable/src/libsodium/crypto_core/ed25519/ref10/fe_51/fe.h +0 -116
- package/ios/libsodium-stable/src/libsodium/crypto_core/hchacha20/core_hchacha20.c +0 -93
- package/ios/libsodium-stable/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c +0 -21
- package/ios/libsodium-stable/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c +0 -95
- package/ios/libsodium-stable/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c +0 -195
- package/ios/libsodium-stable/src/libsodium/crypto_core/softaes/softaes.c +0 -340
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/generichash_blake2.c +0 -55
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2.h +0 -106
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c +0 -52
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.h +0 -142
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c +0 -93
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.c +0 -91
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-sse41.h +0 -106
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c +0 -95
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.h +0 -106
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-avx2.h +0 -340
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse2.h +0 -164
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-load-sse41.h +0 -307
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c +0 -438
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c +0 -116
- package/ios/libsodium-stable/src/libsodium/crypto_generichash/crypto_generichash.c +0 -91
- package/ios/libsodium-stable/src/libsodium/crypto_hash/crypto_hash.c +0 -20
- package/ios/libsodium-stable/src/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c +0 -256
- package/ios/libsodium-stable/src/libsodium/crypto_hash/sha256/hash_sha256.c +0 -13
- package/ios/libsodium-stable/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c +0 -284
- package/ios/libsodium-stable/src/libsodium/crypto_hash/sha512/hash_sha512.c +0 -13
- package/ios/libsodium-stable/src/libsodium/crypto_kdf/blake2b/kdf_blake2b.c +0 -52
- package/ios/libsodium-stable/src/libsodium/crypto_kdf/crypto_kdf.c +0 -49
- package/ios/libsodium-stable/src/libsodium/crypto_kdf/hkdf/kdf_hkdf_sha256.c +0 -123
- package/ios/libsodium-stable/src/libsodium/crypto_kdf/hkdf/kdf_hkdf_sha512.c +0 -123
- package/ios/libsodium-stable/src/libsodium/crypto_kx/crypto_kx.c +0 -143
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c +0 -71
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c +0 -124
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.h +0 -12
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna32.h +0 -235
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna64.h +0 -221
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c +0 -90
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.h +0 -21
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.c +0 -957
- package/ios/libsodium-stable/src/libsodium/crypto_onetimeauth/poly1305/sse2/poly1305_sse2.h +0 -12
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-core.c +0 -556
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-core.h +0 -271
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c +0 -306
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-encoding.h +0 -34
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx2.c +0 -243
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx512f.c +0 -251
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c +0 -234
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c +0 -244
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2.c +0 -283
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/argon2.h +0 -305
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/blake2b-long.c +0 -79
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/blake2b-long.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/blamka-round-avx2.h +0 -150
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/blamka-round-avx512f.h +0 -145
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/blamka-round-ref.h +0 -40
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/blamka-round-ssse3.h +0 -124
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c +0 -294
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/argon2/pwhash_argon2id.c +0 -238
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/crypto_pwhash.c +0 -212
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +0 -268
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt.h +0 -92
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c +0 -318
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c +0 -96
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.h +0 -45
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +0 -301
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c +0 -112
- package/ios/libsodium-stable/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +0 -406
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/crypto_scalarmult.c +0 -33
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c +0 -182
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.h +0 -10
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S +0 -25
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts_namespace.h +0 -20
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c +0 -71
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.h +0 -9
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe.h +0 -26
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51.h +0 -35
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c +0 -58
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S +0 -200
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_namespace.h +0 -16
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S +0 -174
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S +0 -228
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c +0 -78
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S +0 -1442
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.h +0 -18
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder_namespace.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S +0 -16
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c +0 -60
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.h +0 -11
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c +0 -121
- package/ios/libsodium-stable/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c +0 -63
- package/ios/libsodium-stable/src/libsodium/crypto_secretbox/crypto_secretbox.c +0 -67
- package/ios/libsodium-stable/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c +0 -145
- package/ios/libsodium-stable/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c +0 -177
- package/ios/libsodium-stable/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c +0 -89
- package/ios/libsodium-stable/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c +0 -313
- package/ios/libsodium-stable/src/libsodium/crypto_shorthash/crypto_shorthash.c +0 -34
- package/ios/libsodium-stable/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c +0 -71
- package/ios/libsodium-stable/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash_ref.h +0 -24
- package/ios/libsodium-stable/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c +0 -77
- package/ios/libsodium-stable/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c +0 -11
- package/ios/libsodium-stable/src/libsodium/crypto_shorthash/siphash24/shorthash_siphashx24.c +0 -11
- package/ios/libsodium-stable/src/libsodium/crypto_sign/crypto_sign.c +0 -115
- package/ios/libsodium-stable/src/libsodium/crypto_sign/ed25519/ref10/keypair.c +0 -84
- package/ios/libsodium-stable/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c +0 -118
- package/ios/libsodium-stable/src/libsodium/crypto_sign/ed25519/ref10/open.c +0 -98
- package/ios/libsodium-stable/src/libsodium/crypto_sign/ed25519/ref10/sign.c +0 -128
- package/ios/libsodium-stable/src/libsodium/crypto_sign/ed25519/ref10/sign_ed25519_ref10.h +0 -18
- package/ios/libsodium-stable/src/libsodium/crypto_sign/ed25519/sign_ed25519.c +0 -97
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c +0 -180
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c +0 -176
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/u0.h +0 -86
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/u1.h +0 -98
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/u4.h +0 -177
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/dolbeau/u8.h +0 -326
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c +0 -312
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/stream_chacha20.c +0 -184
- package/ios/libsodium-stable/src/libsodium/crypto_stream/chacha20/stream_chacha20.h +0 -22
- package/ios/libsodium-stable/src/libsodium/crypto_stream/crypto_stream.c +0 -49
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c +0 -120
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/stream_salsa20.c +0 -100
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/stream_salsa20.h +0 -16
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6-asm.S +0 -965
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c +0 -31
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c +0 -134
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c +0 -128
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.h +0 -8
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/u0.h +0 -195
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/u1.h +0 -207
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/u4.h +0 -547
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa20/xmm6int/u8.h +0 -477
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c +0 -106
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c +0 -26
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c +0 -106
- package/ios/libsodium-stable/src/libsodium/crypto_stream/salsa208/stream_salsa208.c +0 -26
- package/ios/libsodium-stable/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c +0 -69
- package/ios/libsodium-stable/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c +0 -66
- package/ios/libsodium-stable/src/libsodium/crypto_verify/verify.c +0 -103
- package/ios/libsodium-stable/src/libsodium/include/Makefile.am +0 -76
- package/ios/libsodium-stable/src/libsodium/include/sodium/core.h +0 -28
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_aead_aegis128l.h +0 -92
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_aead_aegis256.h +0 -92
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_aead_aes256gcm.h +0 -179
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_aead_chacha20poly1305.h +0 -180
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_aead_xchacha20poly1305.h +0 -100
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_auth.h +0 -46
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_auth_hmacsha256.h +0 -70
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_auth_hmacsha512.h +0 -68
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h +0 -65
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_box.h +0 -177
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_box_curve25519xchacha20poly1305.h +0 -164
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_box_curve25519xsalsa20poly1305.h +0 -112
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_ed25519.h +0 -100
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_hchacha20.h +0 -36
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_hsalsa20.h +0 -36
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_ristretto255.h +0 -100
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_salsa20.h +0 -36
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_salsa2012.h +0 -36
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_core_salsa208.h +0 -40
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_generichash.h +0 -84
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_generichash_blake2b.h +0 -122
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_hash.h +0 -40
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_hash_sha256.h +0 -60
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_hash_sha512.h +0 -60
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_kdf.h +0 -53
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_kdf_blake2b.h +0 -44
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_kdf_hkdf_sha256.h +0 -74
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_kdf_hkdf_sha512.h +0 -75
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_kx.h +0 -66
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_onetimeauth.h +0 -65
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_onetimeauth_poly1305.h +0 -72
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_pwhash.h +0 -147
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_pwhash_argon2i.h +0 -122
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_pwhash_argon2id.h +0 -122
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_pwhash_scryptsalsa208sha256.h +0 -120
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_scalarmult.h +0 -46
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_scalarmult_curve25519.h +0 -42
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_scalarmult_ed25519.h +0 -51
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_scalarmult_ristretto255.h +0 -43
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_secretbox.h +0 -93
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_secretbox_xchacha20poly1305.h +0 -70
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_secretbox_xsalsa20poly1305.h +0 -69
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_secretstream_xchacha20poly1305.h +0 -108
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_shorthash.h +0 -41
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_shorthash_siphash24.h +0 -50
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_sign.h +0 -107
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_sign_ed25519.h +0 -124
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_sign_edwards25519sha512batch.h +0 -55
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream.h +0 -59
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream_chacha20.h +0 -106
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream_salsa20.h +0 -61
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream_salsa2012.h +0 -53
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream_salsa208.h +0 -56
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream_xchacha20.h +0 -61
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_stream_xsalsa20.h +0 -61
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_verify_16.h +0 -23
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_verify_32.h +0 -23
- package/ios/libsodium-stable/src/libsodium/include/sodium/crypto_verify_64.h +0 -23
- package/ios/libsodium-stable/src/libsodium/include/sodium/export.h +0 -57
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/asm_cet.h +0 -11
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/chacha20_ietf_ext.h +0 -16
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/common.h +0 -296
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/ed25519_ref10.h +0 -142
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/ed25519_ref10_fe_25_5.h +0 -1030
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/ed25519_ref10_fe_51.h +0 -508
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/implementations.h +0 -13
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/mutex.h +0 -7
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/softaes.h +0 -56
- package/ios/libsodium-stable/src/libsodium/include/sodium/private/sse2_64_32.h +0 -50
- package/ios/libsodium-stable/src/libsodium/include/sodium/randombytes.h +0 -72
- package/ios/libsodium-stable/src/libsodium/include/sodium/randombytes_internal_random.h +0 -22
- package/ios/libsodium-stable/src/libsodium/include/sodium/randombytes_sysrandom.h +0 -19
- package/ios/libsodium-stable/src/libsodium/include/sodium/runtime.h +0 -55
- package/ios/libsodium-stable/src/libsodium/include/sodium/utils.h +0 -179
- package/ios/libsodium-stable/src/libsodium/include/sodium/version.h.in +0 -33
- package/ios/libsodium-stable/src/libsodium/include/sodium.h +0 -75
- package/ios/libsodium-stable/src/libsodium/randombytes/internal/randombytes_internal_random.c +0 -648
- package/ios/libsodium-stable/src/libsodium/randombytes/randombytes.c +0 -200
- package/ios/libsodium-stable/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c +0 -396
- package/ios/libsodium-stable/src/libsodium/sodium/codecs.c +0 -335
- package/ios/libsodium-stable/src/libsodium/sodium/core.c +0 -216
- package/ios/libsodium-stable/src/libsodium/sodium/runtime.c +0 -391
- package/ios/libsodium-stable/src/libsodium/sodium/utils.c +0 -809
- package/ios/libsodium-stable/src/libsodium/sodium/version.c +0 -30
- package/ios/libsodium-stable/test/Makefile.am +0 -5
- package/ios/libsodium-stable/test/constcheck.sh +0 -22
- package/ios/libsodium-stable/test/default/Makefile.am +0 -525
- package/ios/libsodium-stable/test/default/aead_aegis128l.c +0 -642
- package/ios/libsodium-stable/test/default/aead_aegis128l.exp +0 -1
- package/ios/libsodium-stable/test/default/aead_aegis256.c +0 -723
- package/ios/libsodium-stable/test/default/aead_aegis256.exp +0 -1
- package/ios/libsodium-stable/test/default/aead_aes256gcm.c +0 -3328
- package/ios/libsodium-stable/test/default/aead_aes256gcm.exp +0 -1
- package/ios/libsodium-stable/test/default/aead_aes256gcm2.c +0 -276
- package/ios/libsodium-stable/test/default/aead_aes256gcm2.exp +0 -1
- package/ios/libsodium-stable/test/default/aead_chacha20poly1305.c +0 -372
- package/ios/libsodium-stable/test/default/aead_chacha20poly1305.exp +0 -63
- package/ios/libsodium-stable/test/default/aead_chacha20poly13052.c +0 -1046
- package/ios/libsodium-stable/test/default/aead_chacha20poly13052.exp +0 -1
- package/ios/libsodium-stable/test/default/aead_xchacha20poly1305.c +0 -203
- package/ios/libsodium-stable/test/default/aead_xchacha20poly1305.exp +0 -51
- package/ios/libsodium-stable/test/default/auth.c +0 -141
- package/ios/libsodium-stable/test/default/auth.exp +0 -30
- package/ios/libsodium-stable/test/default/auth2.c +0 -34
- package/ios/libsodium-stable/test/default/auth2.exp +0 -4
- package/ios/libsodium-stable/test/default/auth3.c +0 -36
- package/ios/libsodium-stable/test/default/auth3.exp +0 -1
- package/ios/libsodium-stable/test/default/auth5.c +0 -41
- package/ios/libsodium-stable/test/default/auth5.exp +0 -0
- package/ios/libsodium-stable/test/default/auth6.c +0 -23
- package/ios/libsodium-stable/test/default/auth6.exp +0 -8
- package/ios/libsodium-stable/test/default/auth7.c +0 -41
- package/ios/libsodium-stable/test/default/auth7.exp +0 -0
- package/ios/libsodium-stable/test/default/box.c +0 -112
- package/ios/libsodium-stable/test/default/box.exp +0 -38
- package/ios/libsodium-stable/test/default/box2.c +0 -80
- package/ios/libsodium-stable/test/default/box2.exp +0 -34
- package/ios/libsodium-stable/test/default/box7.c +0 -50
- package/ios/libsodium-stable/test/default/box7.exp +0 -0
- package/ios/libsodium-stable/test/default/box8.c +0 -58
- package/ios/libsodium-stable/test/default/box8.exp +0 -0
- package/ios/libsodium-stable/test/default/box_easy.c +0 -72
- package/ios/libsodium-stable/test/default/box_easy.exp +0 -3
- package/ios/libsodium-stable/test/default/box_easy2.c +0 -149
- package/ios/libsodium-stable/test/default/box_easy2.exp +0 -7
- package/ios/libsodium-stable/test/default/box_seal.c +0 -165
- package/ios/libsodium-stable/test/default/box_seal.exp +0 -8
- package/ios/libsodium-stable/test/default/box_seed.c +0 -30
- package/ios/libsodium-stable/test/default/box_seed.exp +0 -8
- package/ios/libsodium-stable/test/default/chacha20.c +0 -186
- package/ios/libsodium-stable/test/default/chacha20.exp +0 -64
- package/ios/libsodium-stable/test/default/cmptest.h +0 -238
- package/ios/libsodium-stable/test/default/codecs.c +0 -251
- package/ios/libsodium-stable/test/default/codecs.exp +0 -30
- package/ios/libsodium-stable/test/default/core1.c +0 -41
- package/ios/libsodium-stable/test/default/core1.exp +0 -4
- package/ios/libsodium-stable/test/default/core2.c +0 -38
- package/ios/libsodium-stable/test/default/core2.exp +0 -4
- package/ios/libsodium-stable/test/default/core3.c +0 -115
- package/ios/libsodium-stable/test/default/core3.exp +0 -3
- package/ios/libsodium-stable/test/default/core4.c +0 -36
- package/ios/libsodium-stable/test/default/core4.exp +0 -8
- package/ios/libsodium-stable/test/default/core5.c +0 -33
- package/ios/libsodium-stable/test/default/core5.exp +0 -4
- package/ios/libsodium-stable/test/default/core6.c +0 -52
- package/ios/libsodium-stable/test/default/core6.exp +0 -4
- package/ios/libsodium-stable/test/default/core_ed25519.c +0 -545
- package/ios/libsodium-stable/test/default/core_ed25519.exp +0 -55
- package/ios/libsodium-stable/test/default/core_ristretto255.c +0 -271
- package/ios/libsodium-stable/test/default/core_ristretto255.exp +0 -8
- package/ios/libsodium-stable/test/default/ed25519_convert.c +0 -70
- package/ios/libsodium-stable/test/default/ed25519_convert.exp +0 -3
- package/ios/libsodium-stable/test/default/generichash.c +0 -1406
- package/ios/libsodium-stable/test/default/generichash.exp +0 -65
- package/ios/libsodium-stable/test/default/generichash2.c +0 -62
- package/ios/libsodium-stable/test/default/generichash2.exp +0 -64
- package/ios/libsodium-stable/test/default/generichash3.c +0 -176
- package/ios/libsodium-stable/test/default/generichash3.exp +0 -75
- package/ios/libsodium-stable/test/default/hash.c +0 -47
- package/ios/libsodium-stable/test/default/hash.exp +0 -4
- package/ios/libsodium-stable/test/default/hash3.c +0 -20
- package/ios/libsodium-stable/test/default/hash3.exp +0 -1
- package/ios/libsodium-stable/test/default/index.html.tpl +0 -98
- package/ios/libsodium-stable/test/default/kdf.c +0 -71
- package/ios/libsodium-stable/test/default/kdf.exp +0 -77
- package/ios/libsodium-stable/test/default/kdf_hkdf.c +0 -102
- package/ios/libsodium-stable/test/default/kdf_hkdf.exp +0 -205
- package/ios/libsodium-stable/test/default/keygen.c +0 -67
- package/ios/libsodium-stable/test/default/keygen.exp +0 -1
- package/ios/libsodium-stable/test/default/kx.c +0 -149
- package/ios/libsodium-stable/test/default/kx.exp +0 -7
- package/ios/libsodium-stable/test/default/metamorphic.c +0 -187
- package/ios/libsodium-stable/test/default/metamorphic.exp +0 -1
- package/ios/libsodium-stable/test/default/misuse.c +0 -187
- package/ios/libsodium-stable/test/default/misuse.exp +0 -0
- package/ios/libsodium-stable/test/default/onetimeauth.c +0 -63
- package/ios/libsodium-stable/test/default/onetimeauth.exp +0 -4
- package/ios/libsodium-stable/test/default/onetimeauth2.c +0 -33
- package/ios/libsodium-stable/test/default/onetimeauth2.exp +0 -1
- package/ios/libsodium-stable/test/default/onetimeauth7.c +0 -36
- package/ios/libsodium-stable/test/default/onetimeauth7.exp +0 -0
- package/ios/libsodium-stable/test/default/pre.js.inc +0 -22
- package/ios/libsodium-stable/test/default/pwhash_argon2i.c +0 -467
- package/ios/libsodium-stable/test/default/pwhash_argon2i.exp +0 -11
- package/ios/libsodium-stable/test/default/pwhash_argon2id.c +0 -517
- package/ios/libsodium-stable/test/default/pwhash_argon2id.exp +0 -14
- package/ios/libsodium-stable/test/default/pwhash_scrypt.c +0 -393
- package/ios/libsodium-stable/test/default/pwhash_scrypt.exp +0 -37
- package/ios/libsodium-stable/test/default/pwhash_scrypt_ll.c +0 -59
- package/ios/libsodium-stable/test/default/pwhash_scrypt_ll.exp +0 -15
- package/ios/libsodium-stable/test/default/randombytes.c +0 -164
- package/ios/libsodium-stable/test/default/randombytes.exp +0 -2
- package/ios/libsodium-stable/test/default/run.sh +0 -9
- package/ios/libsodium-stable/test/default/scalarmult.c +0 -77
- package/ios/libsodium-stable/test/default/scalarmult.exp +0 -5
- package/ios/libsodium-stable/test/default/scalarmult2.c +0 -22
- package/ios/libsodium-stable/test/default/scalarmult2.exp +0 -1
- package/ios/libsodium-stable/test/default/scalarmult5.c +0 -30
- package/ios/libsodium-stable/test/default/scalarmult5.exp +0 -1
- package/ios/libsodium-stable/test/default/scalarmult6.c +0 -54
- package/ios/libsodium-stable/test/default/scalarmult6.exp +0 -4
- package/ios/libsodium-stable/test/default/scalarmult7.c +0 -34
- package/ios/libsodium-stable/test/default/scalarmult7.exp +0 -1
- package/ios/libsodium-stable/test/default/scalarmult8.c +0 -580
- package/ios/libsodium-stable/test/default/scalarmult8.exp +0 -65
- package/ios/libsodium-stable/test/default/scalarmult_ed25519.c +0 -134
- package/ios/libsodium-stable/test/default/scalarmult_ed25519.exp +0 -1
- package/ios/libsodium-stable/test/default/scalarmult_ristretto255.c +0 -51
- package/ios/libsodium-stable/test/default/scalarmult_ristretto255.exp +0 -18
- package/ios/libsodium-stable/test/default/secretbox.c +0 -84
- package/ios/libsodium-stable/test/default/secretbox.exp +0 -38
- package/ios/libsodium-stable/test/default/secretbox2.c +0 -55
- package/ios/libsodium-stable/test/default/secretbox2.exp +0 -17
- package/ios/libsodium-stable/test/default/secretbox7.c +0 -36
- package/ios/libsodium-stable/test/default/secretbox7.exp +0 -0
- package/ios/libsodium-stable/test/default/secretbox8.c +0 -41
- package/ios/libsodium-stable/test/default/secretbox8.exp +0 -0
- package/ios/libsodium-stable/test/default/secretbox_easy.c +0 -124
- package/ios/libsodium-stable/test/default/secretbox_easy.exp +0 -9
- package/ios/libsodium-stable/test/default/secretbox_easy2.c +0 -72
- package/ios/libsodium-stable/test/default/secretbox_easy2.exp +0 -5
- package/ios/libsodium-stable/test/default/secretstream_xchacha20poly1305.c +0 -329
- package/ios/libsodium-stable/test/default/secretstream_xchacha20poly1305.exp +0 -1
- package/ios/libsodium-stable/test/default/shorthash.c +0 -35
- package/ios/libsodium-stable/test/default/shorthash.exp +0 -64
- package/ios/libsodium-stable/test/default/sign.c +0 -1324
- package/ios/libsodium-stable/test/default/sign.exp +0 -5
- package/ios/libsodium-stable/test/default/siphashx24.c +0 -33
- package/ios/libsodium-stable/test/default/siphashx24.exp +0 -64
- package/ios/libsodium-stable/test/default/sodium_core.c +0 -43
- package/ios/libsodium-stable/test/default/sodium_core.exp +0 -1
- package/ios/libsodium-stable/test/default/sodium_utils.c +0 -224
- package/ios/libsodium-stable/test/default/sodium_utils.exp +0 -25
- package/ios/libsodium-stable/test/default/sodium_utils2.c +0 -120
- package/ios/libsodium-stable/test/default/sodium_utils2.exp +0 -3
- package/ios/libsodium-stable/test/default/sodium_utils3.c +0 -90
- package/ios/libsodium-stable/test/default/sodium_utils3.exp +0 -2
- package/ios/libsodium-stable/test/default/sodium_version.c +0 -18
- package/ios/libsodium-stable/test/default/sodium_version.exp +0 -3
- package/ios/libsodium-stable/test/default/stream.c +0 -84
- package/ios/libsodium-stable/test/default/stream.exp +0 -83
- package/ios/libsodium-stable/test/default/stream2.c +0 -59
- package/ios/libsodium-stable/test/default/stream2.exp +0 -2
- package/ios/libsodium-stable/test/default/stream3.c +0 -32
- package/ios/libsodium-stable/test/default/stream3.exp +0 -4
- package/ios/libsodium-stable/test/default/stream4.c +0 -51
- package/ios/libsodium-stable/test/default/stream4.exp +0 -17
- package/ios/libsodium-stable/test/default/verify1.c +0 -76
- package/ios/libsodium-stable/test/default/verify1.exp +0 -2
- package/ios/libsodium-stable/test/default/wasi-test-wrapper.sh +0 -98
- package/ios/libsodium-stable/test/default/wintest.bat +0 -61
- package/ios/libsodium-stable/test/default/xchacha20.c +0 -428
- package/ios/libsodium-stable/test/default/xchacha20.exp +0 -5
- package/ios/libsodium-stable/test/quirks/quirks.h +0 -34
- package/nitrogen/generated/shared/c++/CFRGKeyPairType.hpp +0 -86
package/src/subtle.ts
ADDED
|
@@ -0,0 +1,1119 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import { Buffer as SBuffer } from 'safe-buffer';
|
|
3
|
+
import type {
|
|
4
|
+
SubtleAlgorithm,
|
|
5
|
+
KeyUsage,
|
|
6
|
+
BinaryLike,
|
|
7
|
+
BufferLike,
|
|
8
|
+
JWK,
|
|
9
|
+
AnyAlgorithm,
|
|
10
|
+
ImportFormat,
|
|
11
|
+
AesKeyGenParams,
|
|
12
|
+
EncryptDecryptParams,
|
|
13
|
+
Operation,
|
|
14
|
+
AesCtrParams,
|
|
15
|
+
AesCbcParams,
|
|
16
|
+
AesGcmParams,
|
|
17
|
+
RsaOaepParams,
|
|
18
|
+
} from './utils';
|
|
19
|
+
import {
|
|
20
|
+
CryptoKey,
|
|
21
|
+
KeyObject,
|
|
22
|
+
PublicKeyObject,
|
|
23
|
+
PrivateKeyObject,
|
|
24
|
+
SecretKeyObject,
|
|
25
|
+
} from './keys';
|
|
26
|
+
import type { CryptoKeyPair } from './utils/types';
|
|
27
|
+
import { bufferLikeToArrayBuffer } from './utils/conversion';
|
|
28
|
+
import { lazyDOMException } from './utils/errors';
|
|
29
|
+
import { normalizeHashName, HashContext } from './utils/hashnames';
|
|
30
|
+
import { validateMaxBufferLength } from './utils/validation';
|
|
31
|
+
import { asyncDigest } from './hash';
|
|
32
|
+
import { createSecretKey } from './keys';
|
|
33
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
34
|
+
import type { KeyObjectHandle } from './specs/keyObjectHandle.nitro';
|
|
35
|
+
import type { RsaCipher } from './specs/rsaCipher.nitro';
|
|
36
|
+
import type { CipherFactory } from './specs/cipher.nitro';
|
|
37
|
+
import { pbkdf2DeriveBits } from './pbkdf2';
|
|
38
|
+
import { ecImportKey, ecdsaSignVerify, ec_generateKeyPair } from './ec';
|
|
39
|
+
import { rsa_generateKeyPair } from './rsa';
|
|
40
|
+
import { getRandomValues } from './random';
|
|
41
|
+
// import { pbkdf2DeriveBits } from './pbkdf2';
|
|
42
|
+
// import { aesCipher, aesGenerateKey, aesImportKey, getAlgorithmName } from './aes';
|
|
43
|
+
// import { rsaCipher, rsaExportKey, rsaImportKey, rsaKeyGenerate } from './rsa';
|
|
44
|
+
// import { normalizeAlgorithm, type Operation } from './algorithms';
|
|
45
|
+
// import { hmacImportKey } from './mac';
|
|
46
|
+
|
|
47
|
+
// Temporary enums that need to be defined
|
|
48
|
+
|
|
49
|
+
enum KWebCryptoKeyFormat {
|
|
50
|
+
kWebCryptoKeyFormatRaw,
|
|
51
|
+
kWebCryptoKeyFormatSPKI,
|
|
52
|
+
kWebCryptoKeyFormatPKCS8,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
enum CipherOrWrapMode {
|
|
56
|
+
kWebCryptoCipherEncrypt,
|
|
57
|
+
kWebCryptoCipherDecrypt,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Placeholder functions that need to be implemented
|
|
61
|
+
function hasAnyNotIn(usages: KeyUsage[], allowed: KeyUsage[]): boolean {
|
|
62
|
+
return usages.some(usage => !allowed.includes(usage));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function normalizeAlgorithm(
|
|
66
|
+
algorithm: SubtleAlgorithm | AnyAlgorithm,
|
|
67
|
+
_operation: Operation,
|
|
68
|
+
): SubtleAlgorithm {
|
|
69
|
+
if (typeof algorithm === 'string') {
|
|
70
|
+
return { name: algorithm };
|
|
71
|
+
}
|
|
72
|
+
return algorithm as SubtleAlgorithm;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getAlgorithmName(name: string, length: number): string {
|
|
76
|
+
return `${name}${length}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Placeholder implementations for missing functions
|
|
80
|
+
function ecExportKey(key: CryptoKey, format: KWebCryptoKeyFormat): ArrayBuffer {
|
|
81
|
+
const keyObject = key.keyObject;
|
|
82
|
+
|
|
83
|
+
if (format === KWebCryptoKeyFormat.kWebCryptoKeyFormatSPKI) {
|
|
84
|
+
// Export public key in SPKI format
|
|
85
|
+
const exported = keyObject.export({ format: 'der', type: 'spki' });
|
|
86
|
+
return bufferLikeToArrayBuffer(exported);
|
|
87
|
+
} else if (format === KWebCryptoKeyFormat.kWebCryptoKeyFormatPKCS8) {
|
|
88
|
+
// Export private key in PKCS8 format
|
|
89
|
+
const exported = keyObject.export({ format: 'der', type: 'pkcs8' });
|
|
90
|
+
return bufferLikeToArrayBuffer(exported);
|
|
91
|
+
} else {
|
|
92
|
+
throw new Error(`Unsupported EC export format: ${format}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function rsaExportKey(
|
|
97
|
+
key: CryptoKey,
|
|
98
|
+
format: KWebCryptoKeyFormat,
|
|
99
|
+
): ArrayBuffer {
|
|
100
|
+
const keyObject = key.keyObject;
|
|
101
|
+
|
|
102
|
+
if (format === KWebCryptoKeyFormat.kWebCryptoKeyFormatSPKI) {
|
|
103
|
+
// Export public key in SPKI format
|
|
104
|
+
const exported = keyObject.export({ format: 'der', type: 'spki' });
|
|
105
|
+
return bufferLikeToArrayBuffer(exported);
|
|
106
|
+
} else if (format === KWebCryptoKeyFormat.kWebCryptoKeyFormatPKCS8) {
|
|
107
|
+
// Export private key in PKCS8 format
|
|
108
|
+
const exported = keyObject.export({ format: 'der', type: 'pkcs8' });
|
|
109
|
+
return bufferLikeToArrayBuffer(exported);
|
|
110
|
+
} else {
|
|
111
|
+
throw new Error(`Unsupported RSA export format: ${format}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function rsaCipher(
|
|
116
|
+
mode: CipherOrWrapMode,
|
|
117
|
+
key: CryptoKey,
|
|
118
|
+
data: ArrayBuffer,
|
|
119
|
+
algorithm: EncryptDecryptParams,
|
|
120
|
+
): Promise<ArrayBuffer> {
|
|
121
|
+
const rsaParams = algorithm as RsaOaepParams;
|
|
122
|
+
|
|
123
|
+
// Validate key type matches operation
|
|
124
|
+
const expectedType =
|
|
125
|
+
mode === CipherOrWrapMode.kWebCryptoCipherEncrypt ? 'public' : 'private';
|
|
126
|
+
if (key.type !== expectedType) {
|
|
127
|
+
throw lazyDOMException(
|
|
128
|
+
'The requested operation is not valid for the provided key',
|
|
129
|
+
'InvalidAccessError',
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Get hash algorithm from key
|
|
134
|
+
const hashAlgorithm = normalizeHashName(key.algorithm.hash);
|
|
135
|
+
|
|
136
|
+
// Prepare label (optional)
|
|
137
|
+
const label = rsaParams.label
|
|
138
|
+
? bufferLikeToArrayBuffer(rsaParams.label)
|
|
139
|
+
: undefined;
|
|
140
|
+
|
|
141
|
+
// Create RSA cipher instance
|
|
142
|
+
const rsaCipherModule =
|
|
143
|
+
NitroModules.createHybridObject<RsaCipher>('RsaCipher');
|
|
144
|
+
|
|
145
|
+
if (mode === CipherOrWrapMode.kWebCryptoCipherEncrypt) {
|
|
146
|
+
// Encrypt with public key
|
|
147
|
+
return rsaCipherModule.encrypt(
|
|
148
|
+
key.keyObject.handle,
|
|
149
|
+
data,
|
|
150
|
+
hashAlgorithm,
|
|
151
|
+
label,
|
|
152
|
+
);
|
|
153
|
+
} else {
|
|
154
|
+
// Decrypt with private key
|
|
155
|
+
return rsaCipherModule.decrypt(
|
|
156
|
+
key.keyObject.handle,
|
|
157
|
+
data,
|
|
158
|
+
hashAlgorithm,
|
|
159
|
+
label,
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function aesCipher(
|
|
165
|
+
mode: CipherOrWrapMode,
|
|
166
|
+
key: CryptoKey,
|
|
167
|
+
data: ArrayBuffer,
|
|
168
|
+
algorithm: EncryptDecryptParams,
|
|
169
|
+
): Promise<ArrayBuffer> {
|
|
170
|
+
const { name } = algorithm;
|
|
171
|
+
|
|
172
|
+
switch (name) {
|
|
173
|
+
case 'AES-CTR':
|
|
174
|
+
return aesCtrCipher(mode, key, data, algorithm as AesCtrParams);
|
|
175
|
+
case 'AES-CBC':
|
|
176
|
+
return aesCbcCipher(mode, key, data, algorithm as AesCbcParams);
|
|
177
|
+
case 'AES-GCM':
|
|
178
|
+
return aesGcmCipher(mode, key, data, algorithm as AesGcmParams);
|
|
179
|
+
default:
|
|
180
|
+
throw lazyDOMException(
|
|
181
|
+
`Unsupported AES algorithm: ${name}`,
|
|
182
|
+
'NotSupportedError',
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async function aesCtrCipher(
|
|
188
|
+
mode: CipherOrWrapMode,
|
|
189
|
+
key: CryptoKey,
|
|
190
|
+
data: ArrayBuffer,
|
|
191
|
+
algorithm: AesCtrParams,
|
|
192
|
+
): Promise<ArrayBuffer> {
|
|
193
|
+
// Validate counter and length
|
|
194
|
+
if (!algorithm.counter || algorithm.counter.byteLength !== 16) {
|
|
195
|
+
throw lazyDOMException(
|
|
196
|
+
'AES-CTR algorithm.counter must be 16 bytes',
|
|
197
|
+
'OperationError',
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (algorithm.length < 1 || algorithm.length > 128) {
|
|
202
|
+
throw lazyDOMException(
|
|
203
|
+
'AES-CTR algorithm.length must be between 1 and 128',
|
|
204
|
+
'OperationError',
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Get cipher type based on key length
|
|
209
|
+
const keyLength = (key.algorithm as { length: number }).length;
|
|
210
|
+
const cipherType = `aes-${keyLength}-ctr`;
|
|
211
|
+
|
|
212
|
+
// Create cipher
|
|
213
|
+
const factory =
|
|
214
|
+
NitroModules.createHybridObject<CipherFactory>('CipherFactory');
|
|
215
|
+
const cipher = factory.createCipher({
|
|
216
|
+
isCipher: mode === CipherOrWrapMode.kWebCryptoCipherEncrypt,
|
|
217
|
+
cipherType,
|
|
218
|
+
cipherKey: bufferLikeToArrayBuffer(key.keyObject.export()),
|
|
219
|
+
iv: bufferLikeToArrayBuffer(algorithm.counter),
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Process data
|
|
223
|
+
const updated = cipher.update(data);
|
|
224
|
+
const final = cipher.final();
|
|
225
|
+
|
|
226
|
+
// Concatenate results
|
|
227
|
+
const result = new Uint8Array(updated.byteLength + final.byteLength);
|
|
228
|
+
result.set(new Uint8Array(updated), 0);
|
|
229
|
+
result.set(new Uint8Array(final), updated.byteLength);
|
|
230
|
+
|
|
231
|
+
return result.buffer;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
async function aesCbcCipher(
|
|
235
|
+
mode: CipherOrWrapMode,
|
|
236
|
+
key: CryptoKey,
|
|
237
|
+
data: ArrayBuffer,
|
|
238
|
+
algorithm: AesCbcParams,
|
|
239
|
+
): Promise<ArrayBuffer> {
|
|
240
|
+
// Validate IV
|
|
241
|
+
const iv = bufferLikeToArrayBuffer(algorithm.iv);
|
|
242
|
+
if (iv.byteLength !== 16) {
|
|
243
|
+
throw lazyDOMException(
|
|
244
|
+
'algorithm.iv must contain exactly 16 bytes',
|
|
245
|
+
'OperationError',
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Get cipher type based on key length
|
|
250
|
+
const keyLength = (key.algorithm as { length: number }).length;
|
|
251
|
+
const cipherType = `aes-${keyLength}-cbc`;
|
|
252
|
+
|
|
253
|
+
// Create cipher
|
|
254
|
+
const factory =
|
|
255
|
+
NitroModules.createHybridObject<CipherFactory>('CipherFactory');
|
|
256
|
+
const cipher = factory.createCipher({
|
|
257
|
+
isCipher: mode === CipherOrWrapMode.kWebCryptoCipherEncrypt,
|
|
258
|
+
cipherType,
|
|
259
|
+
cipherKey: bufferLikeToArrayBuffer(key.keyObject.export()),
|
|
260
|
+
iv,
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Process data
|
|
264
|
+
const updated = cipher.update(data);
|
|
265
|
+
const final = cipher.final();
|
|
266
|
+
|
|
267
|
+
// Concatenate results
|
|
268
|
+
const result = new Uint8Array(updated.byteLength + final.byteLength);
|
|
269
|
+
result.set(new Uint8Array(updated), 0);
|
|
270
|
+
result.set(new Uint8Array(final), updated.byteLength);
|
|
271
|
+
|
|
272
|
+
return result.buffer;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async function aesGcmCipher(
|
|
276
|
+
mode: CipherOrWrapMode,
|
|
277
|
+
key: CryptoKey,
|
|
278
|
+
data: ArrayBuffer,
|
|
279
|
+
algorithm: AesGcmParams,
|
|
280
|
+
): Promise<ArrayBuffer> {
|
|
281
|
+
const { tagLength = 128 } = algorithm;
|
|
282
|
+
|
|
283
|
+
// Validate tag length
|
|
284
|
+
const validTagLengths = [32, 64, 96, 104, 112, 120, 128];
|
|
285
|
+
if (!validTagLengths.includes(tagLength)) {
|
|
286
|
+
throw lazyDOMException(
|
|
287
|
+
`${tagLength} is not a valid AES-GCM tag length`,
|
|
288
|
+
'OperationError',
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const tagByteLength = tagLength / 8;
|
|
293
|
+
|
|
294
|
+
// Get cipher type based on key length
|
|
295
|
+
const keyLength = (key.algorithm as { length: number }).length;
|
|
296
|
+
const cipherType = `aes-${keyLength}-gcm`;
|
|
297
|
+
|
|
298
|
+
// Create cipher
|
|
299
|
+
const factory =
|
|
300
|
+
NitroModules.createHybridObject<CipherFactory>('CipherFactory');
|
|
301
|
+
const cipher = factory.createCipher({
|
|
302
|
+
isCipher: mode === CipherOrWrapMode.kWebCryptoCipherEncrypt,
|
|
303
|
+
cipherType,
|
|
304
|
+
cipherKey: bufferLikeToArrayBuffer(key.keyObject.export()),
|
|
305
|
+
iv: bufferLikeToArrayBuffer(algorithm.iv),
|
|
306
|
+
authTagLen: tagByteLength,
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
let processData: ArrayBuffer;
|
|
310
|
+
let authTag: ArrayBuffer | undefined;
|
|
311
|
+
|
|
312
|
+
if (mode === CipherOrWrapMode.kWebCryptoCipherDecrypt) {
|
|
313
|
+
// For decryption, extract auth tag from end of data
|
|
314
|
+
const dataView = new Uint8Array(data);
|
|
315
|
+
|
|
316
|
+
if (dataView.byteLength < tagByteLength) {
|
|
317
|
+
throw lazyDOMException(
|
|
318
|
+
'The provided data is too small.',
|
|
319
|
+
'OperationError',
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Split data and tag
|
|
324
|
+
const ciphertextLength = dataView.byteLength - tagByteLength;
|
|
325
|
+
processData = dataView.slice(0, ciphertextLength).buffer;
|
|
326
|
+
authTag = dataView.slice(ciphertextLength).buffer;
|
|
327
|
+
|
|
328
|
+
// Set auth tag for verification
|
|
329
|
+
cipher.setAuthTag(authTag);
|
|
330
|
+
} else {
|
|
331
|
+
processData = data;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Set additional authenticated data if provided
|
|
335
|
+
if (algorithm.additionalData) {
|
|
336
|
+
cipher.setAAD(bufferLikeToArrayBuffer(algorithm.additionalData));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Process data
|
|
340
|
+
const updated = cipher.update(processData);
|
|
341
|
+
const final = cipher.final();
|
|
342
|
+
|
|
343
|
+
if (mode === CipherOrWrapMode.kWebCryptoCipherEncrypt) {
|
|
344
|
+
// For encryption, append auth tag to result
|
|
345
|
+
const tag = cipher.getAuthTag();
|
|
346
|
+
const result = new Uint8Array(
|
|
347
|
+
updated.byteLength + final.byteLength + tag.byteLength,
|
|
348
|
+
);
|
|
349
|
+
result.set(new Uint8Array(updated), 0);
|
|
350
|
+
result.set(new Uint8Array(final), updated.byteLength);
|
|
351
|
+
result.set(new Uint8Array(tag), updated.byteLength + final.byteLength);
|
|
352
|
+
return result.buffer;
|
|
353
|
+
} else {
|
|
354
|
+
// For decryption, just concatenate plaintext
|
|
355
|
+
const result = new Uint8Array(updated.byteLength + final.byteLength);
|
|
356
|
+
result.set(new Uint8Array(updated), 0);
|
|
357
|
+
result.set(new Uint8Array(final), updated.byteLength);
|
|
358
|
+
return result.buffer;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
async function aesGenerateKey(
|
|
363
|
+
algorithm: AesKeyGenParams,
|
|
364
|
+
extractable: boolean,
|
|
365
|
+
keyUsages: KeyUsage[],
|
|
366
|
+
): Promise<CryptoKey> {
|
|
367
|
+
const { length } = algorithm;
|
|
368
|
+
const name = algorithm.name;
|
|
369
|
+
|
|
370
|
+
if (!name) {
|
|
371
|
+
throw lazyDOMException('Algorithm name is required', 'OperationError');
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Validate key length
|
|
375
|
+
if (![128, 192, 256].includes(length)) {
|
|
376
|
+
throw lazyDOMException(
|
|
377
|
+
`Invalid AES key length: ${length}. Must be 128, 192, or 256.`,
|
|
378
|
+
'OperationError',
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Validate usages
|
|
383
|
+
const validUsages: KeyUsage[] = [
|
|
384
|
+
'encrypt',
|
|
385
|
+
'decrypt',
|
|
386
|
+
'wrapKey',
|
|
387
|
+
'unwrapKey',
|
|
388
|
+
];
|
|
389
|
+
if (hasAnyNotIn(keyUsages, validUsages)) {
|
|
390
|
+
throw lazyDOMException(`Unsupported key usage for ${name}`, 'SyntaxError');
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Generate random key bytes
|
|
394
|
+
const keyBytes = new Uint8Array(length / 8);
|
|
395
|
+
getRandomValues(keyBytes);
|
|
396
|
+
|
|
397
|
+
// Create secret key
|
|
398
|
+
const keyObject = createSecretKey(keyBytes);
|
|
399
|
+
|
|
400
|
+
// Construct algorithm object with guaranteed name
|
|
401
|
+
const keyAlgorithm: SubtleAlgorithm = { name, length };
|
|
402
|
+
|
|
403
|
+
return new CryptoKey(keyObject, keyAlgorithm, keyUsages, extractable);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function rsaImportKey(
|
|
407
|
+
format: ImportFormat,
|
|
408
|
+
data: BufferLike | JWK,
|
|
409
|
+
algorithm: SubtleAlgorithm,
|
|
410
|
+
extractable: boolean,
|
|
411
|
+
keyUsages: KeyUsage[],
|
|
412
|
+
): CryptoKey {
|
|
413
|
+
const { name } = algorithm;
|
|
414
|
+
|
|
415
|
+
// Validate usages
|
|
416
|
+
let checkSet: KeyUsage[];
|
|
417
|
+
switch (name) {
|
|
418
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
419
|
+
case 'RSA-PSS':
|
|
420
|
+
checkSet = ['sign', 'verify'];
|
|
421
|
+
break;
|
|
422
|
+
case 'RSA-OAEP':
|
|
423
|
+
checkSet = ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey'];
|
|
424
|
+
break;
|
|
425
|
+
default:
|
|
426
|
+
throw new Error(`Unsupported RSA algorithm: ${name}`);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
if (hasAnyNotIn(keyUsages, checkSet)) {
|
|
430
|
+
throw new Error(`Unsupported key usage for ${name}`);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let keyObject: KeyObject;
|
|
434
|
+
|
|
435
|
+
if (format === 'jwk') {
|
|
436
|
+
const jwk = data as JWK;
|
|
437
|
+
|
|
438
|
+
// Validate JWK
|
|
439
|
+
if (jwk.kty !== 'RSA') {
|
|
440
|
+
throw new Error('Invalid JWK format for RSA key');
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const handle =
|
|
444
|
+
NitroModules.createHybridObject<KeyObjectHandle>('KeyObjectHandle');
|
|
445
|
+
const keyType = handle.initJwk(jwk, undefined);
|
|
446
|
+
|
|
447
|
+
if (keyType === undefined) {
|
|
448
|
+
throw new Error('Failed to import RSA JWK');
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Create the appropriate KeyObject based on type
|
|
452
|
+
if (keyType === 1) {
|
|
453
|
+
keyObject = new PublicKeyObject(handle);
|
|
454
|
+
} else if (keyType === 2) {
|
|
455
|
+
keyObject = new PrivateKeyObject(handle);
|
|
456
|
+
} else {
|
|
457
|
+
throw new Error('Unexpected key type from RSA JWK import');
|
|
458
|
+
}
|
|
459
|
+
} else if (format === 'spki') {
|
|
460
|
+
const keyData = bufferLikeToArrayBuffer(data as BufferLike);
|
|
461
|
+
keyObject = KeyObject.createKeyObject('public', keyData, 'der', 'spki');
|
|
462
|
+
} else if (format === 'pkcs8') {
|
|
463
|
+
const keyData = bufferLikeToArrayBuffer(data as BufferLike);
|
|
464
|
+
keyObject = KeyObject.createKeyObject('private', keyData, 'der', 'pkcs8');
|
|
465
|
+
} else {
|
|
466
|
+
throw new Error(`Unsupported format for RSA import: ${format}`);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Get the modulus length from the key and add it to the algorithm
|
|
470
|
+
const keyDetails = (keyObject as PublicKeyObject | PrivateKeyObject)
|
|
471
|
+
.asymmetricKeyDetails;
|
|
472
|
+
|
|
473
|
+
// Convert publicExponent number to big-endian byte array
|
|
474
|
+
let publicExponentBytes: Uint8Array | undefined;
|
|
475
|
+
if (keyDetails?.publicExponent) {
|
|
476
|
+
const exp = keyDetails.publicExponent;
|
|
477
|
+
// Convert number to big-endian bytes
|
|
478
|
+
const bytes: number[] = [];
|
|
479
|
+
let value = exp;
|
|
480
|
+
while (value > 0) {
|
|
481
|
+
bytes.unshift(value & 0xff);
|
|
482
|
+
value = Math.floor(value / 256);
|
|
483
|
+
}
|
|
484
|
+
publicExponentBytes = new Uint8Array(bytes.length > 0 ? bytes : [0]);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
const algorithmWithDetails = {
|
|
488
|
+
...algorithm,
|
|
489
|
+
modulusLength: keyDetails?.modulusLength,
|
|
490
|
+
publicExponent: publicExponentBytes,
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
return new CryptoKey(keyObject, algorithmWithDetails, keyUsages, extractable);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
async function hmacImportKey(
|
|
497
|
+
algorithm: SubtleAlgorithm,
|
|
498
|
+
format: ImportFormat,
|
|
499
|
+
data: BufferLike | JWK,
|
|
500
|
+
extractable: boolean,
|
|
501
|
+
keyUsages: KeyUsage[],
|
|
502
|
+
): Promise<CryptoKey> {
|
|
503
|
+
// Validate usages
|
|
504
|
+
if (hasAnyNotIn(keyUsages, ['sign', 'verify'])) {
|
|
505
|
+
throw new Error('Unsupported key usage for an HMAC key');
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
let keyObject: KeyObject;
|
|
509
|
+
|
|
510
|
+
if (format === 'jwk') {
|
|
511
|
+
const jwk = data as JWK;
|
|
512
|
+
|
|
513
|
+
// Validate JWK
|
|
514
|
+
if (!jwk || typeof jwk !== 'object') {
|
|
515
|
+
throw new Error('Invalid keyData');
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (jwk.kty !== 'oct') {
|
|
519
|
+
throw new Error('Invalid JWK format for HMAC key');
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Validate key length if specified
|
|
523
|
+
if (algorithm.length !== undefined) {
|
|
524
|
+
if (!jwk.k) {
|
|
525
|
+
throw new Error('JWK missing key data');
|
|
526
|
+
}
|
|
527
|
+
// Decode to check length
|
|
528
|
+
const decoded = SBuffer.from(jwk.k, 'base64');
|
|
529
|
+
const keyBitLength = decoded.length * 8;
|
|
530
|
+
if (algorithm.length === 0) {
|
|
531
|
+
throw new Error('Zero-length key is not supported');
|
|
532
|
+
}
|
|
533
|
+
if (algorithm.length !== keyBitLength) {
|
|
534
|
+
throw new Error('Invalid key length');
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const handle =
|
|
539
|
+
NitroModules.createHybridObject<KeyObjectHandle>('KeyObjectHandle');
|
|
540
|
+
const keyType = handle.initJwk(jwk, undefined);
|
|
541
|
+
|
|
542
|
+
if (keyType === undefined || keyType !== 0) {
|
|
543
|
+
throw new Error('Failed to import HMAC JWK');
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
keyObject = new SecretKeyObject(handle);
|
|
547
|
+
} else if (format === 'raw') {
|
|
548
|
+
keyObject = createSecretKey(data as BinaryLike);
|
|
549
|
+
} else {
|
|
550
|
+
throw new Error(`Unable to import HMAC key with format ${format}`);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return new CryptoKey(
|
|
554
|
+
keyObject,
|
|
555
|
+
{ ...algorithm, name: 'HMAC' },
|
|
556
|
+
keyUsages,
|
|
557
|
+
extractable,
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
async function aesImportKey(
|
|
562
|
+
algorithm: SubtleAlgorithm,
|
|
563
|
+
format: ImportFormat,
|
|
564
|
+
data: BufferLike | JWK,
|
|
565
|
+
extractable: boolean,
|
|
566
|
+
keyUsages: KeyUsage[],
|
|
567
|
+
): Promise<CryptoKey> {
|
|
568
|
+
const { name, length } = algorithm;
|
|
569
|
+
|
|
570
|
+
// Validate usages
|
|
571
|
+
const validUsages: KeyUsage[] = [
|
|
572
|
+
'encrypt',
|
|
573
|
+
'decrypt',
|
|
574
|
+
'wrapKey',
|
|
575
|
+
'unwrapKey',
|
|
576
|
+
];
|
|
577
|
+
if (hasAnyNotIn(keyUsages, validUsages)) {
|
|
578
|
+
throw new Error(`Unsupported key usage for ${name}`);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
let keyObject: KeyObject;
|
|
582
|
+
let actualLength: number;
|
|
583
|
+
|
|
584
|
+
if (format === 'jwk') {
|
|
585
|
+
const jwk = data as JWK;
|
|
586
|
+
|
|
587
|
+
// Validate JWK
|
|
588
|
+
if (jwk.kty !== 'oct') {
|
|
589
|
+
throw new Error('Invalid JWK format for AES key');
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const handle =
|
|
593
|
+
NitroModules.createHybridObject<KeyObjectHandle>('KeyObjectHandle');
|
|
594
|
+
const keyType = handle.initJwk(jwk, undefined);
|
|
595
|
+
|
|
596
|
+
if (keyType === undefined || keyType !== 0) {
|
|
597
|
+
throw new Error('Failed to import AES JWK');
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
keyObject = new SecretKeyObject(handle);
|
|
601
|
+
|
|
602
|
+
// Get actual key length from imported key
|
|
603
|
+
const exported = keyObject.export();
|
|
604
|
+
actualLength = exported.byteLength * 8;
|
|
605
|
+
} else if (format === 'raw') {
|
|
606
|
+
const keyData = bufferLikeToArrayBuffer(data as BufferLike);
|
|
607
|
+
actualLength = keyData.byteLength * 8;
|
|
608
|
+
|
|
609
|
+
// Validate key length
|
|
610
|
+
if (![128, 192, 256].includes(actualLength)) {
|
|
611
|
+
throw new Error('Invalid AES key length');
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
keyObject = createSecretKey(keyData);
|
|
615
|
+
} else {
|
|
616
|
+
throw new Error(`Unsupported format for AES import: ${format}`);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// Validate length if specified
|
|
620
|
+
if (length !== undefined && length !== actualLength) {
|
|
621
|
+
throw new Error(
|
|
622
|
+
`Key length mismatch: expected ${length}, got ${actualLength}`,
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return new CryptoKey(
|
|
627
|
+
keyObject,
|
|
628
|
+
{ name, length: actualLength },
|
|
629
|
+
keyUsages,
|
|
630
|
+
extractable,
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
const exportKeySpki = async (
|
|
635
|
+
key: CryptoKey,
|
|
636
|
+
): Promise<ArrayBuffer | unknown> => {
|
|
637
|
+
switch (key.algorithm.name) {
|
|
638
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
639
|
+
// Fall through
|
|
640
|
+
case 'RSA-PSS':
|
|
641
|
+
// Fall through
|
|
642
|
+
case 'RSA-OAEP':
|
|
643
|
+
if (key.type === 'public') {
|
|
644
|
+
return rsaExportKey(key, KWebCryptoKeyFormat.kWebCryptoKeyFormatSPKI);
|
|
645
|
+
}
|
|
646
|
+
break;
|
|
647
|
+
case 'ECDSA':
|
|
648
|
+
// Fall through
|
|
649
|
+
case 'ECDH':
|
|
650
|
+
if (key.type === 'public') {
|
|
651
|
+
return ecExportKey(key, KWebCryptoKeyFormat.kWebCryptoKeyFormatSPKI);
|
|
652
|
+
}
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
throw new Error(
|
|
657
|
+
`Unable to export a spki ${key.algorithm.name} ${key.type} key`,
|
|
658
|
+
);
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
const exportKeyPkcs8 = async (
|
|
662
|
+
key: CryptoKey,
|
|
663
|
+
): Promise<ArrayBuffer | unknown> => {
|
|
664
|
+
switch (key.algorithm.name) {
|
|
665
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
666
|
+
// Fall through
|
|
667
|
+
case 'RSA-PSS':
|
|
668
|
+
// Fall through
|
|
669
|
+
case 'RSA-OAEP':
|
|
670
|
+
if (key.type === 'private') {
|
|
671
|
+
return rsaExportKey(key, KWebCryptoKeyFormat.kWebCryptoKeyFormatPKCS8);
|
|
672
|
+
}
|
|
673
|
+
break;
|
|
674
|
+
case 'ECDSA':
|
|
675
|
+
// Fall through
|
|
676
|
+
case 'ECDH':
|
|
677
|
+
if (key.type === 'private') {
|
|
678
|
+
return ecExportKey(key, KWebCryptoKeyFormat.kWebCryptoKeyFormatPKCS8);
|
|
679
|
+
}
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
throw new Error(
|
|
684
|
+
`Unable to export a pkcs8 ${key.algorithm.name} ${key.type} key`,
|
|
685
|
+
);
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
const exportKeyRaw = (key: CryptoKey): ArrayBuffer | unknown => {
|
|
689
|
+
switch (key.algorithm.name) {
|
|
690
|
+
case 'ECDSA':
|
|
691
|
+
// Fall through
|
|
692
|
+
case 'ECDH':
|
|
693
|
+
if (key.type === 'public') {
|
|
694
|
+
return ecExportKey(key, KWebCryptoKeyFormat.kWebCryptoKeyFormatRaw);
|
|
695
|
+
}
|
|
696
|
+
break;
|
|
697
|
+
case 'AES-CTR':
|
|
698
|
+
// Fall through
|
|
699
|
+
case 'AES-CBC':
|
|
700
|
+
// Fall through
|
|
701
|
+
case 'AES-GCM':
|
|
702
|
+
// Fall through
|
|
703
|
+
case 'AES-KW':
|
|
704
|
+
// Fall through
|
|
705
|
+
case 'HMAC': {
|
|
706
|
+
const exported = key.keyObject.export();
|
|
707
|
+
// Convert Buffer to ArrayBuffer
|
|
708
|
+
return exported.buffer.slice(
|
|
709
|
+
exported.byteOffset,
|
|
710
|
+
exported.byteOffset + exported.byteLength,
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
throw lazyDOMException(
|
|
716
|
+
`Unable to export a raw ${key.algorithm.name} ${key.type} key`,
|
|
717
|
+
'InvalidAccessError',
|
|
718
|
+
);
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
const exportKeyJWK = (key: CryptoKey): ArrayBuffer | unknown => {
|
|
722
|
+
const jwk = key.keyObject.handle.exportJwk(
|
|
723
|
+
{
|
|
724
|
+
key_ops: key.usages,
|
|
725
|
+
ext: key.extractable,
|
|
726
|
+
},
|
|
727
|
+
true,
|
|
728
|
+
);
|
|
729
|
+
switch (key.algorithm.name) {
|
|
730
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
731
|
+
jwk.alg = normalizeHashName(key.algorithm.hash, HashContext.JwkRsa);
|
|
732
|
+
return jwk;
|
|
733
|
+
case 'RSA-PSS':
|
|
734
|
+
jwk.alg = normalizeHashName(key.algorithm.hash, HashContext.JwkRsaPss);
|
|
735
|
+
return jwk;
|
|
736
|
+
case 'RSA-OAEP':
|
|
737
|
+
jwk.alg = normalizeHashName(key.algorithm.hash, HashContext.JwkRsaOaep);
|
|
738
|
+
return jwk;
|
|
739
|
+
case 'HMAC':
|
|
740
|
+
jwk.alg = normalizeHashName(key.algorithm.hash, HashContext.JwkHmac);
|
|
741
|
+
return jwk;
|
|
742
|
+
case 'ECDSA':
|
|
743
|
+
// Fall through
|
|
744
|
+
case 'ECDH':
|
|
745
|
+
jwk.crv ||= key.algorithm.namedCurve;
|
|
746
|
+
return jwk;
|
|
747
|
+
case 'AES-CTR':
|
|
748
|
+
// Fall through
|
|
749
|
+
case 'AES-CBC':
|
|
750
|
+
// Fall through
|
|
751
|
+
case 'AES-GCM':
|
|
752
|
+
// Fall through
|
|
753
|
+
case 'AES-KW':
|
|
754
|
+
if (key.algorithm.length === undefined) {
|
|
755
|
+
throw lazyDOMException(
|
|
756
|
+
`Algorithm ${key.algorithm.name} missing required length property`,
|
|
757
|
+
'InvalidAccessError',
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
jwk.alg = getAlgorithmName(key.algorithm.name, key.algorithm.length);
|
|
761
|
+
return jwk;
|
|
762
|
+
default:
|
|
763
|
+
// Fall through
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
throw lazyDOMException(
|
|
767
|
+
`JWK export not yet supported: ${key.algorithm.name}`,
|
|
768
|
+
'NotSupportedError',
|
|
769
|
+
);
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
const importGenericSecretKey = async (
|
|
773
|
+
{ name, length }: SubtleAlgorithm,
|
|
774
|
+
format: ImportFormat,
|
|
775
|
+
keyData: BufferLike | BinaryLike,
|
|
776
|
+
extractable: boolean,
|
|
777
|
+
keyUsages: KeyUsage[],
|
|
778
|
+
): Promise<CryptoKey> => {
|
|
779
|
+
if (extractable) {
|
|
780
|
+
throw new Error(`${name} keys are not extractable`);
|
|
781
|
+
}
|
|
782
|
+
if (hasAnyNotIn(keyUsages, ['deriveKey', 'deriveBits'])) {
|
|
783
|
+
throw new Error(`Unsupported key usage for a ${name} key`);
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
switch (format) {
|
|
787
|
+
case 'raw': {
|
|
788
|
+
if (hasAnyNotIn(keyUsages, ['deriveKey', 'deriveBits'])) {
|
|
789
|
+
throw new Error(`Unsupported key usage for a ${name} key`);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const checkLength =
|
|
793
|
+
typeof keyData === 'string' || SBuffer.isBuffer(keyData)
|
|
794
|
+
? keyData.length * 8
|
|
795
|
+
: keyData.byteLength * 8;
|
|
796
|
+
|
|
797
|
+
if (length !== undefined && length !== checkLength) {
|
|
798
|
+
throw new Error('Invalid key length');
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
const keyObject = createSecretKey(keyData as BinaryLike);
|
|
802
|
+
return new CryptoKey(keyObject, { name }, keyUsages, false);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
throw new Error(`Unable to import ${name} key with format ${format}`);
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
const checkCryptoKeyPairUsages = (pair: CryptoKeyPair) => {
|
|
810
|
+
if (
|
|
811
|
+
pair.privateKey &&
|
|
812
|
+
pair.privateKey instanceof CryptoKey &&
|
|
813
|
+
pair.privateKey.keyUsages &&
|
|
814
|
+
pair.privateKey.keyUsages.length > 0
|
|
815
|
+
) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
throw lazyDOMException(
|
|
819
|
+
'Usages cannot be empty when creating a key.',
|
|
820
|
+
'SyntaxError',
|
|
821
|
+
);
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// Type guard to check if result is CryptoKeyPair
|
|
825
|
+
export function isCryptoKeyPair(
|
|
826
|
+
result: CryptoKey | CryptoKeyPair,
|
|
827
|
+
): result is CryptoKeyPair {
|
|
828
|
+
return 'publicKey' in result && 'privateKey' in result;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
const signVerify = (
|
|
832
|
+
algorithm: SubtleAlgorithm,
|
|
833
|
+
key: CryptoKey,
|
|
834
|
+
data: BufferLike,
|
|
835
|
+
signature?: BufferLike,
|
|
836
|
+
): ArrayBuffer | boolean => {
|
|
837
|
+
const usage: Operation = signature === undefined ? 'sign' : 'verify';
|
|
838
|
+
algorithm = normalizeAlgorithm(algorithm, usage);
|
|
839
|
+
|
|
840
|
+
if (!key.usages.includes(usage) || algorithm.name !== key.algorithm.name) {
|
|
841
|
+
throw lazyDOMException(
|
|
842
|
+
`Unable to use this key to ${usage}`,
|
|
843
|
+
'InvalidAccessError',
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
switch (algorithm.name) {
|
|
848
|
+
case 'ECDSA':
|
|
849
|
+
return ecdsaSignVerify(key, data, algorithm, signature);
|
|
850
|
+
}
|
|
851
|
+
throw lazyDOMException(
|
|
852
|
+
`Unrecognized algorithm name '${algorithm}' for '${usage}'`,
|
|
853
|
+
'NotSupportedError',
|
|
854
|
+
);
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
const cipherOrWrap = async (
|
|
858
|
+
mode: CipherOrWrapMode,
|
|
859
|
+
algorithm: EncryptDecryptParams,
|
|
860
|
+
key: CryptoKey,
|
|
861
|
+
data: ArrayBuffer,
|
|
862
|
+
op: Operation,
|
|
863
|
+
): Promise<ArrayBuffer> => {
|
|
864
|
+
if (
|
|
865
|
+
key.algorithm.name !== algorithm.name ||
|
|
866
|
+
!key.usages.includes(op as KeyUsage)
|
|
867
|
+
) {
|
|
868
|
+
throw lazyDOMException(
|
|
869
|
+
'The requested operation is not valid for the provided key',
|
|
870
|
+
'InvalidAccessError',
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
validateMaxBufferLength(data, 'data');
|
|
875
|
+
|
|
876
|
+
switch (algorithm.name) {
|
|
877
|
+
case 'RSA-OAEP':
|
|
878
|
+
return rsaCipher(mode, key, data, algorithm);
|
|
879
|
+
case 'AES-CTR':
|
|
880
|
+
// Fall through
|
|
881
|
+
case 'AES-CBC':
|
|
882
|
+
// Fall through
|
|
883
|
+
case 'AES-GCM':
|
|
884
|
+
return aesCipher(mode, key, data, algorithm);
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
export class Subtle {
|
|
889
|
+
async decrypt(
|
|
890
|
+
algorithm: EncryptDecryptParams,
|
|
891
|
+
key: CryptoKey,
|
|
892
|
+
data: BufferLike,
|
|
893
|
+
): Promise<ArrayBuffer> {
|
|
894
|
+
const normalizedAlgorithm = normalizeAlgorithm(algorithm, 'decrypt');
|
|
895
|
+
return cipherOrWrap(
|
|
896
|
+
CipherOrWrapMode.kWebCryptoCipherDecrypt,
|
|
897
|
+
normalizedAlgorithm as EncryptDecryptParams,
|
|
898
|
+
key,
|
|
899
|
+
bufferLikeToArrayBuffer(data),
|
|
900
|
+
'decrypt',
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
async digest(
|
|
905
|
+
algorithm: SubtleAlgorithm | AnyAlgorithm,
|
|
906
|
+
data: BufferLike,
|
|
907
|
+
): Promise<ArrayBuffer> {
|
|
908
|
+
const normalizedAlgorithm = normalizeAlgorithm(
|
|
909
|
+
algorithm,
|
|
910
|
+
'digest' as Operation,
|
|
911
|
+
);
|
|
912
|
+
return asyncDigest(normalizedAlgorithm, data);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
async deriveBits(
|
|
916
|
+
algorithm: SubtleAlgorithm,
|
|
917
|
+
baseKey: CryptoKey,
|
|
918
|
+
length: number,
|
|
919
|
+
): Promise<ArrayBuffer> {
|
|
920
|
+
if (!baseKey.keyUsages.includes('deriveBits')) {
|
|
921
|
+
throw new Error('baseKey does not have deriveBits usage');
|
|
922
|
+
}
|
|
923
|
+
if (baseKey.algorithm.name !== algorithm.name)
|
|
924
|
+
throw new Error('Key algorithm mismatch');
|
|
925
|
+
switch (algorithm.name) {
|
|
926
|
+
case 'PBKDF2':
|
|
927
|
+
return pbkdf2DeriveBits(algorithm, baseKey, length);
|
|
928
|
+
}
|
|
929
|
+
throw new Error(
|
|
930
|
+
`'subtle.deriveBits()' for ${algorithm.name} is not implemented.`,
|
|
931
|
+
);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
async encrypt(
|
|
935
|
+
algorithm: EncryptDecryptParams,
|
|
936
|
+
key: CryptoKey,
|
|
937
|
+
data: BufferLike,
|
|
938
|
+
): Promise<ArrayBuffer> {
|
|
939
|
+
const normalizedAlgorithm = normalizeAlgorithm(algorithm, 'encrypt');
|
|
940
|
+
return cipherOrWrap(
|
|
941
|
+
CipherOrWrapMode.kWebCryptoCipherEncrypt,
|
|
942
|
+
normalizedAlgorithm as EncryptDecryptParams,
|
|
943
|
+
key,
|
|
944
|
+
bufferLikeToArrayBuffer(data),
|
|
945
|
+
'encrypt',
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
async exportKey(
|
|
950
|
+
format: ImportFormat,
|
|
951
|
+
key: CryptoKey,
|
|
952
|
+
): Promise<ArrayBuffer | JWK> {
|
|
953
|
+
if (!key.extractable) throw new Error('key is not extractable');
|
|
954
|
+
|
|
955
|
+
switch (format) {
|
|
956
|
+
case 'spki':
|
|
957
|
+
return (await exportKeySpki(key)) as ArrayBuffer;
|
|
958
|
+
case 'pkcs8':
|
|
959
|
+
return (await exportKeyPkcs8(key)) as ArrayBuffer;
|
|
960
|
+
case 'jwk':
|
|
961
|
+
return exportKeyJWK(key) as JWK;
|
|
962
|
+
case 'raw':
|
|
963
|
+
return exportKeyRaw(key) as ArrayBuffer;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
async generateKey(
|
|
968
|
+
algorithm: SubtleAlgorithm,
|
|
969
|
+
extractable: boolean,
|
|
970
|
+
keyUsages: KeyUsage[],
|
|
971
|
+
): Promise<CryptoKey | CryptoKeyPair> {
|
|
972
|
+
algorithm = normalizeAlgorithm(algorithm, 'generateKey');
|
|
973
|
+
let result: CryptoKey | CryptoKeyPair;
|
|
974
|
+
switch (algorithm.name) {
|
|
975
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
976
|
+
// Fall through
|
|
977
|
+
case 'RSA-PSS':
|
|
978
|
+
// Fall through
|
|
979
|
+
case 'RSA-OAEP':
|
|
980
|
+
result = await rsa_generateKeyPair(algorithm, extractable, keyUsages);
|
|
981
|
+
break;
|
|
982
|
+
case 'ECDSA':
|
|
983
|
+
// Fall through
|
|
984
|
+
case 'ECDH':
|
|
985
|
+
result = await ec_generateKeyPair(
|
|
986
|
+
algorithm.name,
|
|
987
|
+
algorithm.namedCurve!,
|
|
988
|
+
extractable,
|
|
989
|
+
keyUsages,
|
|
990
|
+
);
|
|
991
|
+
checkCryptoKeyPairUsages(result as CryptoKeyPair);
|
|
992
|
+
break;
|
|
993
|
+
case 'AES-CTR':
|
|
994
|
+
// Fall through
|
|
995
|
+
case 'AES-CBC':
|
|
996
|
+
// Fall through
|
|
997
|
+
case 'AES-GCM':
|
|
998
|
+
// Fall through
|
|
999
|
+
case 'AES-KW':
|
|
1000
|
+
result = await aesGenerateKey(
|
|
1001
|
+
algorithm as AesKeyGenParams,
|
|
1002
|
+
extractable,
|
|
1003
|
+
keyUsages,
|
|
1004
|
+
);
|
|
1005
|
+
break;
|
|
1006
|
+
default:
|
|
1007
|
+
throw new Error(
|
|
1008
|
+
`'subtle.generateKey()' is not implemented for ${algorithm.name}.
|
|
1009
|
+
Unrecognized algorithm name`,
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
return result;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
async importKey(
|
|
1017
|
+
format: ImportFormat,
|
|
1018
|
+
data: BufferLike | BinaryLike | JWK,
|
|
1019
|
+
algorithm: SubtleAlgorithm | AnyAlgorithm,
|
|
1020
|
+
extractable: boolean,
|
|
1021
|
+
keyUsages: KeyUsage[],
|
|
1022
|
+
): Promise<CryptoKey> {
|
|
1023
|
+
const normalizedAlgorithm = normalizeAlgorithm(algorithm, 'importKey');
|
|
1024
|
+
let result: CryptoKey;
|
|
1025
|
+
switch (normalizedAlgorithm.name) {
|
|
1026
|
+
case 'RSASSA-PKCS1-v1_5':
|
|
1027
|
+
// Fall through
|
|
1028
|
+
case 'RSA-PSS':
|
|
1029
|
+
// Fall through
|
|
1030
|
+
case 'RSA-OAEP':
|
|
1031
|
+
result = rsaImportKey(
|
|
1032
|
+
format,
|
|
1033
|
+
data as BufferLike | JWK,
|
|
1034
|
+
normalizedAlgorithm,
|
|
1035
|
+
extractable,
|
|
1036
|
+
keyUsages,
|
|
1037
|
+
);
|
|
1038
|
+
break;
|
|
1039
|
+
case 'ECDSA':
|
|
1040
|
+
// Fall through
|
|
1041
|
+
case 'ECDH':
|
|
1042
|
+
result = ecImportKey(
|
|
1043
|
+
format,
|
|
1044
|
+
data,
|
|
1045
|
+
normalizedAlgorithm,
|
|
1046
|
+
extractable,
|
|
1047
|
+
keyUsages,
|
|
1048
|
+
);
|
|
1049
|
+
break;
|
|
1050
|
+
case 'HMAC':
|
|
1051
|
+
result = await hmacImportKey(
|
|
1052
|
+
normalizedAlgorithm,
|
|
1053
|
+
format,
|
|
1054
|
+
data as BufferLike | JWK,
|
|
1055
|
+
extractable,
|
|
1056
|
+
keyUsages,
|
|
1057
|
+
);
|
|
1058
|
+
break;
|
|
1059
|
+
case 'AES-CTR':
|
|
1060
|
+
// Fall through
|
|
1061
|
+
case 'AES-CBC':
|
|
1062
|
+
// Fall through
|
|
1063
|
+
case 'AES-GCM':
|
|
1064
|
+
// Fall through
|
|
1065
|
+
case 'AES-KW':
|
|
1066
|
+
result = await aesImportKey(
|
|
1067
|
+
normalizedAlgorithm,
|
|
1068
|
+
format,
|
|
1069
|
+
data as BufferLike | JWK,
|
|
1070
|
+
extractable,
|
|
1071
|
+
keyUsages,
|
|
1072
|
+
);
|
|
1073
|
+
break;
|
|
1074
|
+
case 'PBKDF2':
|
|
1075
|
+
result = await importGenericSecretKey(
|
|
1076
|
+
normalizedAlgorithm,
|
|
1077
|
+
format,
|
|
1078
|
+
data as BufferLike | BinaryLike,
|
|
1079
|
+
extractable,
|
|
1080
|
+
keyUsages,
|
|
1081
|
+
);
|
|
1082
|
+
break;
|
|
1083
|
+
default:
|
|
1084
|
+
throw new Error(
|
|
1085
|
+
`"subtle.importKey()" is not implemented for ${normalizedAlgorithm.name}`,
|
|
1086
|
+
);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
if (
|
|
1090
|
+
(result.type === 'secret' || result.type === 'private') &&
|
|
1091
|
+
result.usages.length === 0
|
|
1092
|
+
) {
|
|
1093
|
+
throw new Error(
|
|
1094
|
+
`Usages cannot be empty when importing a ${result.type} key.`,
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
return result;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
async sign(
|
|
1102
|
+
algorithm: SubtleAlgorithm,
|
|
1103
|
+
key: CryptoKey,
|
|
1104
|
+
data: BufferLike,
|
|
1105
|
+
): Promise<ArrayBuffer> {
|
|
1106
|
+
return signVerify(algorithm, key, data) as ArrayBuffer;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
async verify(
|
|
1110
|
+
algorithm: SubtleAlgorithm,
|
|
1111
|
+
key: CryptoKey,
|
|
1112
|
+
signature: BufferLike,
|
|
1113
|
+
data: BufferLike,
|
|
1114
|
+
): Promise<ArrayBuffer> {
|
|
1115
|
+
return signVerify(algorithm, key, data, signature) as ArrayBuffer;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export const subtle = new Subtle();
|