π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Simplify tvOS crypto Rust bridge
Manav Rathid5e6cdbf2090
diff --git a/mobile/native/darwin/Apps/tv/cast/Services/CastPairingService.swift b/mobile/native/darwin/Apps/tv/cast/Services/CastPairingService.swiftindex 841154fe1d..7a515e04ac 100644--- a/mobile/native/darwin/Apps/tv/cast/Services/CastPairingService.swift+++ b/mobile/native/darwin/Apps/tv/cast/Services/CastPairingService.swift@@ -7,7 +7,6 @@import SwiftUIimport Foundation-import EnteCrypto// MARK: - Cast Session Management@@ -73,13 +72,8 @@ class RealCastPairingService {return newInterval}- // Generate real X25519 keypair using EnteCryptoprivate func generateKeyPair() throws -> (publicKey: Data, privateKey: Data) {- let keys = try EnteCrypto.generateCastKeyPair()- return (- publicKey: Data(base64Encoded: keys.publicKey)!,- privateKey: Data(base64Encoded: keys.privateKey)!- )+ try Crypto.generateKeyPair()}func registerDevice() async throws -> CastDevice {@@ -204,12 +198,15 @@ class RealCastPairingService {}private func decryptPayload(encryptedData: String, publicKey: Data, privateKey: Data) async throws -> CastPayload {- // Use EnteCrypto for cast payload decryptiondo {- let decryptedData = try EnteCrypto.decryptCastPayload(- encryptedPayload: encryptedData,- recipientPublicKey: publicKey.base64EncodedString(),- recipientPrivateKey: privateKey.base64EncodedString()+ guard let encryptedBytes = Data(base64Encoded: encryptedData) else {+ throw CastError.decryptionError("Invalid encrypted cast payload")+ }++ let decryptedData = try Crypto.sealedBoxOpen(+ cipherText: encryptedBytes,+ publicKey: publicKey,+ secretKey: privateKey)// Handle potential base64 preprocessing from mobile client@@ -225,7 +222,7 @@ class RealCastPairingService {return payload} catch {throw CastError.decryptionError(- "EnteCrypto cast payload decryption failed: \(error.localizedDescription)"+ "Cast payload decryption failed: \(error.localizedDescription)")}}diff --git a/mobile/native/darwin/Apps/tv/cast/Services/Crypto.swift b/mobile/native/darwin/Apps/tv/cast/Services/Crypto.swiftnew file mode 100644index 0000000000..5f2539542c--- /dev/null+++ b/mobile/native/darwin/Apps/tv/cast/Services/Crypto.swift@@ -0,0 +1,180 @@+import Foundation++enum CryptoError: Error, LocalizedError {+ case failed(String)+ case invalidOutput(String)++ var errorDescription: String? {+ switch self {+ case .failed(let message), .invalidOutput(let message):+ return message+ }+ }+}++@_silgen_name("ente_crypto_string_free")+private func rustStringFree(_ ptr: UnsafeMutablePointer<CChar>?)++@_silgen_name("ente_crypto_generate_keypair_b64")+private func rustGenerateKeyPair(+ _ outPublicKeyB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ _ outSecretKeyB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?+) -> Int32++@_silgen_name("ente_crypto_secretbox_open_b64")+private func rustSecretBoxOpen(+ _ cipherTextB64: UnsafePointer<CChar>?,+ _ nonceB64: UnsafePointer<CChar>?,+ _ keyB64: UnsafePointer<CChar>?,+ _ outPlainTextB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?+) -> Int32++@_silgen_name("ente_crypto_sealed_box_open_b64")+private func rustSealedBoxOpen(+ _ cipherTextB64: UnsafePointer<CChar>?,+ _ publicKeyB64: UnsafePointer<CChar>?,+ _ secretKeyB64: UnsafePointer<CChar>?,+ _ outPlainTextB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?+) -> Int32++@_silgen_name("ente_crypto_secretstream_decrypt_b64")+private func rustDecryptSecretStream(+ _ encryptedDataB64: UnsafePointer<CChar>?,+ _ headerB64: UnsafePointer<CChar>?,+ _ keyB64: UnsafePointer<CChar>?,+ _ outPlainTextB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?+) -> Int32++enum Crypto {+ static func generateKeyPair() throws -> (publicKey: Data, privateKey: Data) {+ let (publicKey, privateKey) = try callForTwoStrings { out1, out2, error in+ rustGenerateKeyPair(out1, out2, error)+ }+ return (+ publicKey: try decodeBase64(publicKey, "public key"),+ privateKey: try decodeBase64(privateKey, "private key")+ )+ }++ static func secretBoxOpen(cipherText: Data, nonce: Data, key: Data) throws -> Data {+ guard nonce.count == 24, key.count == 32 else {+ throw CryptoError.failed("invalid SecretBox input")+ }++ let plainText = try callForString(+ cipherText.base64EncodedString(),+ nonce.base64EncodedString(),+ key.base64EncodedString()+ ) { cipherText, nonce, key, output, error in+ rustSecretBoxOpen(cipherText, nonce, key, output, error)+ }+ return try decodeBase64(plainText, "SecretBox plaintext")+ }++ static func sealedBoxOpen(cipherText: Data, publicKey: Data, secretKey: Data) throws -> Data {+ guard publicKey.count == 32, secretKey.count == 32 else {+ throw CryptoError.failed("invalid SealedBox input")+ }++ let plainText = try callForString(+ cipherText.base64EncodedString(),+ publicKey.base64EncodedString(),+ secretKey.base64EncodedString()+ ) { cipherText, publicKey, secretKey, output, error in+ rustSealedBoxOpen(cipherText, publicKey, secretKey, output, error)+ }+ return try decodeBase64(plainText, "SealedBox plaintext")+ }++ static func decryptSecretStream(encryptedData: Data, key: Data, header: Data) throws -> Data {+ guard key.count == 32, header.count == 24 else {+ throw CryptoError.failed("invalid secretstream input")+ }++ let plainText = try callForString(+ encryptedData.base64EncodedString(),+ header.base64EncodedString(),+ key.base64EncodedString()+ ) { encryptedData, header, key, output, error in+ rustDecryptSecretStream(encryptedData, header, key, output, error)+ }+ return try decodeBase64(plainText, "secretstream plaintext")+ }++ private static func decodeBase64(_ value: String, _ label: String) throws -> Data {+ guard let data = Data(base64Encoded: value) else {+ throw CryptoError.invalidOutput("invalid base64 \(label)")+ }+ return data+ }++ private static func callForString(+ _ input1: String,+ _ input2: String,+ _ input3: String,+ _ call: (+ UnsafePointer<CChar>?,+ UnsafePointer<CChar>?,+ UnsafePointer<CChar>?,+ UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?+ ) -> Int32+ ) throws -> String {+ var output: UnsafeMutablePointer<CChar>? = nil+ var error: UnsafeMutablePointer<CChar>? = nil+ let status = input1.withCString { cInput1 in+ input2.withCString { cInput2 in+ input3.withCString { cInput3 in+ call(cInput1, cInput2, cInput3, &output, &error)+ }+ }+ }++ defer {+ rustStringFree(output)+ rustStringFree(error)+ }++ guard status == 0 else {+ throw CryptoError.failed(error.map { String(cString: $0) } ?? "unknown Rust crypto error")+ }+ guard let output, let value = String(validatingUTF8: output) else {+ throw CryptoError.invalidOutput("missing Rust crypto output")+ }+ return value+ }++ private static func callForTwoStrings(+ _ call: (+ UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,+ UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?+ ) -> Int32+ ) throws -> (String, String) {+ var output1: UnsafeMutablePointer<CChar>? = nil+ var output2: UnsafeMutablePointer<CChar>? = nil+ var error: UnsafeMutablePointer<CChar>? = nil+ let status = call(&output1, &output2, &error)++ defer {+ rustStringFree(output1)+ rustStringFree(output2)+ rustStringFree(error)+ }++ guard status == 0 else {+ throw CryptoError.failed(error.map { String(cString: $0) } ?? "unknown Rust crypto error")+ }+ guard let output1,+ let output2,+ let value1 = String(validatingUTF8: output1),+ let value2 = String(validatingUTF8: output2) else {+ throw CryptoError.invalidOutput("missing Rust crypto output")+ }+ return (value1, value2)+ }+}diff --git a/mobile/native/darwin/Apps/tv/cast/ViewModels/SlideshowService.swift b/mobile/native/darwin/Apps/tv/cast/ViewModels/SlideshowService.swiftindex dab9a00540..421f97a31a 100644--- a/mobile/native/darwin/Apps/tv/cast/ViewModels/SlideshowService.swift+++ b/mobile/native/darwin/Apps/tv/cast/ViewModels/SlideshowService.swift@@ -8,7 +8,6 @@import SwiftUIimport AVKitimport Foundation-import EnteCryptoimport ZIPFoundation#if canImport(UIKit)@@ -1167,13 +1166,11 @@ class RealSlideshowService: ObservableObject {throw CastError.decryptionError("Invalid base64 in file key decryption")}-- // Use EnteCrypto for file key decryption (XSalsa20-Poly1305)do {- let decryptedFileKey = try EnteCrypto.secretBoxOpen(encryptedKeyData, nonce: nonceData, key: collectionKeyData)+ let decryptedFileKey = try Crypto.secretBoxOpen(cipherText: encryptedKeyData, nonce: nonceData, key: collectionKeyData)return decryptedFileKey} catch {- throw CastError.decryptionError("EnteCrypto SecretBox decryption failed for file key: \(error)")+ throw CastError.decryptionError("SecretBox decryption failed for file key: \(error)")}}@@ -1186,14 +1183,12 @@ class RealSlideshowService: ObservableObject {print(" π XChaCha20: encrypted=\(encryptedBytes.count)b, header=\(headerBytes.count)b, key=\(fileKey.count)b")- // Use EnteCrypto for XChaCha20-Poly1305 streaming decryption- // This matches the mobile app's CryptoUtil.decryptChaCha implementationdo {- let decryptedData = try EnteCrypto.decryptSecretStream(encryptedData: encryptedBytes, key: fileKey, header: headerBytes)- print(" β Metadata decrypted using EnteCrypto: \(decryptedData.count) bytes")+ let decryptedData = try Crypto.decryptSecretStream(encryptedData: encryptedBytes, key: fileKey, header: headerBytes)+ print(" β Metadata decrypted using Rust crypto: \(decryptedData.count) bytes")return decryptedData} catch {- throw CastError.decryptionError("EnteCrypto XChaCha20-Poly1305 decryption failed for metadata: \(error)")+ throw CastError.decryptionError("XChaCha20-Poly1305 decryption failed for metadata: \(error)")}}@@ -1205,11 +1200,10 @@ class RealSlideshowService: ObservableObject {if verboseDecryptionLogging { print(" π File decryption: encrypted=\(encryptedData.count)b, header=\(headerBytes.count)b, key=\(fileKey.count)b") }- // Use EnteCrypto for XChaCha20-Poly1305 streaming decryptiondo {- return try EnteCrypto.decryptSecretStream(encryptedData: encryptedData, key: fileKey, header: headerBytes)+ return try Crypto.decryptSecretStream(encryptedData: encryptedData, key: fileKey, header: headerBytes)} catch {- throw CastError.decryptionError("EnteCrypto file content decryption failed: \(error)")+ throw CastError.decryptionError("file content decryption failed: \(error)")}}diff --git a/mobile/native/darwin/Apps/tv/scripts/build-rust.sh b/mobile/native/darwin/Apps/tv/scripts/build-rust.shnew file mode 100644index 0000000000..736c276c64--- /dev/null+++ b/mobile/native/darwin/Apps/tv/scripts/build-rust.sh@@ -0,0 +1,63 @@+#!/bin/sh+set -eu++REPO_ROOT=$(cd "$SRCROOT/../../../../.." && pwd)+OUT_DIR="$TARGET_TEMP_DIR/ente_crypto_rust"+TARGET_DIR="$REPO_ROOT/rust/target"+LIB=libente_crypto_ffi.a++export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"++mkdir -p "$OUT_DIR"++case "${CONFIGURATION:-Debug}" in+ Release) profile=release; release_flag=--release ;;+ *) profile=debug; release_flag= ;;+esac++case "$PLATFORM_NAME" in+ appletvos) min_flag=-mtvos-version-min ;;+ appletvsimulator) min_flag=-mtvos-simulator-version-min ;;+ *) echo "unsupported platform: $PLATFORM_NAME" >&2; exit 1 ;;+esac++sdk=$(xcrun --sdk "$PLATFORM_NAME" --show-sdk-path)+clang=$(xcrun --sdk "$PLATFORM_NAME" --find clang)+libs=++for arch in $ARCHS; do+ case "$PLATFORM_NAME:$arch" in+ appletvos:arm64) target=aarch64-apple-tvos ;;+ appletvsimulator:arm64) target=aarch64-apple-tvos-sim ;;+ appletvsimulator:x86_64) target=x86_64-apple-tvos ;;+ *) echo "unsupported arch: $PLATFORM_NAME/$arch" >&2; exit 1 ;;+ esac++ suffix=$(printf "%s" "$target" | tr "[:lower:]-" "[:upper:]_")+ eval "export CARGO_TARGET_${suffix}_LINKER=\$clang"++ rustflags="-C link-arg=-isysroot -C link-arg=$sdk"+ if [ -n "${TVOS_DEPLOYMENT_TARGET:-}" ]; then+ rustflags="$rustflags -C link-arg=$min_flag=$TVOS_DEPLOYMENT_TARGET"+ fi++ (+ cd "$REPO_ROOT/rust"+ CC="$clang" \+ CFLAGS="-isysroot $sdk" \+ CARGO_TARGET_DIR="$TARGET_DIR" \+ RUSTFLAGS="$rustflags" \+ cargo +nightly build -Z build-std --locked -p ente_crypto_ffi --target "$target" $release_flag+ )++ built="$TARGET_DIR/$target/$profile/$LIB"+ cp "$built" "$OUT_DIR/$arch.a"+ libs="$libs $OUT_DIR/$arch.a"+done++set -- $libs+if [ "$#" -eq 1 ]; then+ cp "$1" "$OUT_DIR/$LIB"+else+ lipo -create "$@" -output "$OUT_DIR/$LIB"+fidiff --git a/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.pbxproj b/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.pbxprojindex d4f6002122..6c0dd4f609 100644--- a/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.pbxproj+++ b/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.pbxproj@@ -7,7 +7,6 @@objects = {/* Begin PBXBuildFile section */- DACC3DC92E618D6A00DAF993 /* EnteCrypto in Frameworks */ = {isa = PBXBuildFile; productRef = DACC3DC82E618D6A00DAF993 /* EnteCrypto */; };DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */ = {isa = PBXBuildFile; productRef = DAF584662E61BB8300F8A08F /* ZIPFoundation */; };/* End PBXBuildFile section */@@ -60,7 +59,6 @@isa = PBXFrameworksBuildPhase;buildActionMask = 2147483647;files = (- DACC3DC92E618D6A00DAF993 /* EnteCrypto in Frameworks */,DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */,);runOnlyForDeploymentPostprocessing = 0;@@ -115,6 +113,7 @@isa = PBXNativeTarget;buildConfigurationList = DA72BC872E5F87A100D128FF /* Build configuration list for PBXNativeTarget "cast" */;buildPhases = (+ DAEC00012F40000000CABA11 /* Build Rust (ente-crypto) */,DA72BC5D2E5F87A000D128FF /* Sources */,DA72BC5E2E5F87A000D128FF /* Frameworks */,DA72BC5F2E5F87A000D128FF /* Resources */,@@ -128,7 +127,6 @@);name = cast;packageProductDependencies = (- DACC3DC82E618D6A00DAF993 /* EnteCrypto */,DAF584662E61BB8300F8A08F /* ZIPFoundation */,);productName = tv;@@ -208,7 +206,6 @@mainGroup = DA72BC582E5F87A000D128FF;minimizedProjectReferenceProxies = 1;packageReferences = (- DACC3DC62E618D5300DAF993 /* XCLocalSwiftPackageReference "../../Packages/EnteCrypto" */,DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */,);preferredProjectObjectVersion = 77;@@ -247,6 +244,24 @@};/* End PBXResourcesBuildPhase section */+/* Begin PBXShellScriptBuildPhase section */+ DAEC00012F40000000CABA11 /* Build Rust (ente-crypto) */ = {+ isa = PBXShellScriptBuildPhase;+ buildActionMask = 2147483647;+ files = (+ );+ inputPaths = (+ );+ name = "Build Rust (ente-crypto)";+ outputPaths = (+ "$(TARGET_TEMP_DIR)/ente_crypto_rust/libente_crypto_ffi.a",+ );+ runOnlyForDeploymentPostprocessing = 0;+ shellPath = /bin/sh;+ shellScript = "sh \"${SRCROOT}/scripts/build-rust.sh\"\n";+ };+/* End PBXShellScriptBuildPhase section */+/* Begin PBXSourcesBuildPhase section */DA72BC5D2E5F87A000D128FF /* Sources */ = {isa = PBXSourcesBuildPhase;@@ -418,6 +433,7 @@CURRENT_PROJECT_VERSION = 1;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;+ ENABLE_USER_SCRIPT_SANDBOXING = NO;GENERATE_INFOPLIST_FILE = YES;INFOPLIST_FILE = cast/Info.plist;INFOPLIST_KEY_CFBundleDisplayName = "Ente Cast";@@ -430,6 +446,11 @@"@executable_path/Frameworks",);MARKETING_VERSION = 1.1;+ OTHER_LDFLAGS = (+ "$(inherited)",+ "-force_load",+ "$(TARGET_TEMP_DIR)/ente_crypto_rust/libente_crypto_ffi.a",+ );PRODUCT_BUNDLE_IDENTIFIER = io.ente.photos.tv.cast;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";@@ -449,6 +470,7 @@CURRENT_PROJECT_VERSION = 1;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;+ ENABLE_USER_SCRIPT_SANDBOXING = NO;GENERATE_INFOPLIST_FILE = YES;INFOPLIST_FILE = cast/Info.plist;"INFOPLIST_FILE[sdk=appletvos*]" = "";@@ -462,6 +484,11 @@"@executable_path/Frameworks",);MARKETING_VERSION = 1.1;+ OTHER_LDFLAGS = (+ "$(inherited)",+ "-force_load",+ "$(TARGET_TEMP_DIR)/ente_crypto_rust/libente_crypto_ffi.a",+ );PRODUCT_BUNDLE_IDENTIFIER = io.ente.frame.tv.cast;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";@@ -584,13 +611,6 @@};/* End XCConfigurationList section */-/* Begin XCLocalSwiftPackageReference section */- DACC3DC62E618D5300DAF993 /* XCLocalSwiftPackageReference "../../Packages/EnteCrypto" */ = {- isa = XCLocalSwiftPackageReference;- relativePath = ../../Packages/EnteCrypto;- };-/* End XCLocalSwiftPackageReference section */-/* Begin XCRemoteSwiftPackageReference section */DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */ = {isa = XCRemoteSwiftPackageReference;@@ -603,10 +623,6 @@/* End XCRemoteSwiftPackageReference section *//* Begin XCSwiftPackageProductDependency section */- DACC3DC82E618D6A00DAF993 /* EnteCrypto */ = {- isa = XCSwiftPackageProductDependency;- productName = EnteCrypto;- };DAF584662E61BB8300F8A08F /* ZIPFoundation */ = {isa = XCSwiftPackageProductDependency;package = DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */;diff --git a/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolvedindex a49789cca9..3a7a30ece2 100644--- a/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved+++ b/mobile/native/darwin/Apps/tv/tv.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved@@ -1,51 +1,6 @@{"originHash" : "f31e140ec37f5c23a792afed0762216b02b92701e0e3dbc4391488047b811865","pins" : [- {- "identity" : "bigint",- "kind" : "remoteSourceControl",- "location" : "https://github.com/attaswift/BigInt.git",- "state" : {- "revision" : "e07e00fa1fd435143a2dcf8b7eec9a7710b2fdfe",- "version" : "5.7.0"- }- },- {- "identity" : "swift-asn1",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-asn1.git",- "state" : {- "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc",- "version" : "1.4.0"- }- },- {- "identity" : "swift-crypto",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-crypto.git",- "state" : {- "revision" : "d1c6b70f7c5f19fb0b8750cb8dcdf2ea6e2d8c34",- "version" : "3.15.0"- }- },- {- "identity" : "swift-log",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-log.git",- "state" : {- "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2",- "version" : "1.6.4"- }- },- {- "identity" : "swift-tagged",- "kind" : "remoteSourceControl",- "location" : "https://github.com/pointfreeco/swift-tagged.git",- "state" : {- "revision" : "3907a9438f5b57d317001dc99f3f11b46882272b",- "version" : "0.10.0"- }- },{"identity" : "zipfoundation","kind" : "remoteSourceControl",diff --git a/mobile/native/darwin/Packages/EnteCast/Package.resolved b/mobile/native/darwin/Packages/EnteCast/Package.resolveddeleted file mode 100644index c9ce773e64..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Package.resolved+++ /dev/null@@ -1,14 +0,0 @@-{- "pins" : [- {- "identity" : "swift-log",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-log.git",- "state" : {- "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2",- "version" : "1.6.4"- }- }- ],- "version" : 2-}diff --git a/mobile/native/darwin/Packages/EnteCast/Package.swift b/mobile/native/darwin/Packages/EnteCast/Package.swiftdeleted file mode 100644index 6b9b45486c..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Package.swift+++ /dev/null@@ -1,40 +0,0 @@-// swift-tools-version: 5.9-import PackageDescription--let package = Package(- name: "EnteCast",- platforms: [- .iOS(.v15),- .tvOS(.v15),- .macOS(.v12)- ],- products: [- .library(- name: "EnteCast",- targets: ["EnteCast"]- ),- ],- dependencies: [- // TODO: Uncomment when these packages are available:- // .package(path: "../EnteCore"),- // .package(path: "../EnteNetwork"),- // .package(path: "../EnteCrypto"),- .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),- ],- targets: [- .target(- name: "EnteCast",- dependencies: [- // TODO: Uncomment when these packages are available:- // "EnteCore",- // "EnteNetwork",- // "EnteCrypto",- .product(name: "Logging", package: "swift-log"),- ]- ),- .testTarget(- name: "EnteCastTests",- dependencies: ["EnteCast"]- ),- ]-)\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/EnteCast.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/EnteCast.swiftdeleted file mode 100644index 3e38da9820..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/EnteCast.swift+++ /dev/null@@ -1,10 +0,0 @@-import Foundation--public struct EnteCast {- public static let version = "1.0.0"-- public init() {}-}--// Re-export stub types for convenience-// TODO: Replace with actual Ente package exports when available\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastError.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastError.swiftdeleted file mode 100644index a6c545c5d5..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastError.swift+++ /dev/null@@ -1,45 +0,0 @@-import Foundation--public enum CastError: Error, LocalizedError {- case networkError(String)- case decryptionError(String)- case invalidImageData- case imageConversionFailed- case videoProcessingFailed- case fileNotFound- case invalidFileType- case fileSizeTooLarge- case deviceRegistrationFailed- case pairingTimeout- case invalidCastToken- case slideshowStopped-- public var errorDescription: String? {- switch self {- case .networkError(let message):- return "Network error: \(message)"- case .decryptionError(let message):- return "Decryption error: \(message)"- case .invalidImageData:- return "Invalid image data"- case .imageConversionFailed:- return "Failed to convert image"- case .videoProcessingFailed:- return "Failed to process video"- case .fileNotFound:- return "File not found"- case .invalidFileType:- return "Unsupported file type"- case .fileSizeTooLarge:- return "File size too large"- case .deviceRegistrationFailed:- return "Failed to register device"- case .pairingTimeout:- return "Pairing timed out"- case .invalidCastToken:- return "Invalid cast token"- case .slideshowStopped:- return "Slideshow was stopped"- }- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastFile.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastFile.swiftdeleted file mode 100644index c35faf5945..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastFile.swift+++ /dev/null@@ -1,100 +0,0 @@-import Foundation--public struct CastFileMetadata: Codable, Equatable {- public let fileType: Int- public let title: String- public let creationTime: Int64?-- public init(fileType: Int, title: String, creationTime: Int64? = nil) {- self.fileType = fileType- self.title = title- self.creationTime = creationTime- }-}--public struct CastFileInfo: Codable, Equatable {- public let fileSize: Int64?-- public init(fileSize: Int64?) {- self.fileSize = fileSize- }-}--public struct CastFileData: Codable, Equatable {- public let decryptionHeader: String-- public init(decryptionHeader: String) {- self.decryptionHeader = decryptionHeader- }-}--public struct CastFile: Codable, Equatable {- public let id: FileID- public let metadata: CastFileMetadata- public let info: CastFileInfo?- public let file: CastFileData- public let thumbnail: CastFileData- public let key: String- public let updationTime: Int64- public let isDeleted: Bool-- public init(- id: FileID,- metadata: CastFileMetadata,- info: CastFileInfo?,- file: CastFileData,- thumbnail: CastFileData,- key: String,- updationTime: Int64,- isDeleted: Bool- ) {- self.id = id- self.metadata = metadata- self.info = info- self.file = file- self.thumbnail = thumbnail- self.key = key- self.updationTime = updationTime- self.isDeleted = isDeleted- }-- public var fileName: String {- return metadata.title- }-- public var fileSize: Int64 {- return info?.fileSize ?? 0- }-- // File type constants from the web app- public var isImage: Bool {- return metadata.fileType == 0 // FileType.image- }-- public var isVideo: Bool {- return metadata.fileType == 1 // FileType.video- }-- public var isLivePhoto: Bool {- return metadata.fileType == 2 // FileType.livePhoto- }-- public func isEligibleForSlideshow(with configuration: SlideConfiguration) -> Bool {- guard isImage || isLivePhoto || (isVideo && configuration.includeVideos) else { return false }-- // Check file size limits- let maxSize: Int64 = isVideo ? configuration.maxVideoSize : configuration.maxImageSize- guard fileSize <= maxSize else { return false }-- return true- }-- public var fileExtension: String? {- let title = fileName.lowercased()- return URL(fileURLWithPath: title).pathExtension.isEmpty ? nil : URL(fileURLWithPath: title).pathExtension- }-- public var isHEIC: Bool {- return fileExtension == "heic" || fileExtension == "heif"- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastSession.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastSession.swiftdeleted file mode 100644index 038177940c..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/CastSession.swift+++ /dev/null@@ -1,88 +0,0 @@-import Foundation--public enum CastSessionState: Equatable {- case idle- case registering- case waitingForPairing(deviceCode: String)- case connected(CastPayload)- case error(String)-}--public struct CastPayload: Codable, Equatable {- public let collectionID: CollectionID- public let collectionKey: String- public let castToken: String-- public init(collectionID: CollectionID, collectionKey: String, castToken: String) {- self.collectionID = collectionID- self.collectionKey = collectionKey- self.castToken = castToken- }-}--public struct CastDevice: Codable, Equatable {- public let deviceCode: String- public let publicKey: String- public let privateKey: String-- public init(deviceCode: String, publicKey: String, privateKey: String) {- self.deviceCode = deviceCode- self.publicKey = publicKey- self.privateKey = privateKey- }-}--@MainActor-public class CastSession: ObservableObject {- @Published public var state: CastSessionState = .idle- @Published public var isActive: Bool = false-- public var deviceCode: String? {- if case .waitingForPairing(let code) = state {- return code- }- return nil- }-- public var payload: CastPayload? {- if case .connected(let payload) = state {- return payload- }- return nil- }-- public init() {}-- public func setState(_ newState: CastSessionState) {- state = newState- isActive = !isIdle- }-- public var isIdle: Bool {- if case .idle = state {- return true- }- return false- }-- public var isWaitingForPairing: Bool {- if case .waitingForPairing = state {- return true- }- return false- }-- public var isConnected: Bool {- if case .connected = state {- return true- }- return false- }-- public var hasError: Bool {- if case .error = state {- return true- }- return false- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/SlideConfiguration.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/SlideConfiguration.swiftdeleted file mode 100644index 757bba3fab..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Models/SlideConfiguration.swift+++ /dev/null@@ -1,64 +0,0 @@-import Foundation--public struct SlideConfiguration {- public let imageDuration: TimeInterval- public let videoDuration: TimeInterval- public let useThumbnails: Bool- public let shuffle: Bool- public let maxImageSize: Int64- public let maxVideoSize: Int64- public let includeVideos: Bool-- // Enhanced prefetch settings- public let prefetchCount: Int- public let maxCacheSize: Int- public let prefetchDelay: TimeInterval- public let enablePrefetching: Bool-- public init(- imageDuration: TimeInterval = 12.0,- videoDuration: TimeInterval = 30.0,- useThumbnails: Bool = false,- shuffle: Bool = true,- maxImageSize: Int64 = 100 * 1024 * 1024, // 100MB- maxVideoSize: Int64 = 500 * 1024 * 1024, // 500MB- includeVideos: Bool = true,- prefetchCount: Int = 3,- maxCacheSize: Int = 5,- prefetchDelay: TimeInterval = 0.5,- enablePrefetching: Bool = true- ) {- self.imageDuration = imageDuration- self.videoDuration = videoDuration- self.useThumbnails = useThumbnails- self.shuffle = shuffle- self.maxImageSize = maxImageSize- self.maxVideoSize = maxVideoSize- self.includeVideos = includeVideos- self.prefetchCount = prefetchCount- self.maxCacheSize = maxCacheSize- self.prefetchDelay = prefetchDelay- self.enablePrefetching = enablePrefetching- }-- public func duration(for file: CastFile) -> TimeInterval {- return file.isVideo ? videoDuration : imageDuration- }-- public static let `default` = SlideConfiguration()-- // TV-optimized configuration (use thumbnails for better performance)- public static let tvOptimized = SlideConfiguration(- imageDuration: 8.0, // Faster progression for TV viewing- videoDuration: 25.0,- useThumbnails: true, // Better performance on Apple TV- shuffle: true,- maxImageSize: 50 * 1024 * 1024, // 50MB for TV- maxVideoSize: 200 * 1024 * 1024, // 200MB for TV- includeVideos: true,- prefetchCount: 3, // Prefetch next 3 slides- maxCacheSize: 5, // Keep 5 slides in cache- prefetchDelay: 0.5, // 500ms delay between prefetch operations- enablePrefetching: true // Enable prefetching for smooth transitions- )-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/CastFileService.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/CastFileService.swiftdeleted file mode 100644index 7e5dffb693..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/CastFileService.swift+++ /dev/null@@ -1,184 +0,0 @@-import Foundation-import Logging--#if canImport(UIKit)-import UIKit-#endif--#if canImport(AVFoundation)-import AVFoundation-#endif--public class CastFileService {- private let castGateway: CastGateway- private let logger = Logger(label: "CastFileService")-- public init(castGateway: CastGateway) {- self.castGateway = castGateway- }-- // MARK: - File Discovery-- public func fetchAllFiles(castToken: String) async throws -> [CastFile] {- logger.info("Fetching all cast files")-- var allFiles: [FileID: CastFile] = [:]- var sinceTime: Int64 = 0-- while true {- let diff = try await castGateway.getDiff(sinceTime: sinceTime)-- guard !diff.diff.isEmpty else { break }-- for change in diff.diff {- sinceTime = max(sinceTime, change.updationTime)-- if change.isDeleted {- allFiles.removeValue(forKey: change.id)- } else {- // Convert network model to our model- // Note: This is a simplified conversion- // In practice, we'd need to decrypt the file metadata- let castFile = CastFile(- id: change.id,- metadata: CastFileMetadata(fileType: 0, title: "File \(change.id)"), // TODO: Get real metadata- info: CastFileInfo(fileSize: nil),- file: CastFileData(decryptionHeader: ""), // TODO: Get real headers- thumbnail: CastFileData(decryptionHeader: ""),- key: "", // TODO: Get real key- updationTime: change.updationTime,- isDeleted: false- )- allFiles[change.id] = castFile- }- }-- if !diff.hasMore { break }- }-- let files = Array(allFiles.values)- logger.info("Fetched \(files.count) files")- return files- }-- // MARK: - File Download-- public func downloadFile(- castFile: CastFile,- castToken: String,- useThumbnail: Bool = false- ) async throws -> Data {- logger.info("Downloading file \(castFile.id), thumbnail: \(useThumbnail)")-- let encryptedData: Data- let decryptionHeader: String-- if useThumbnail {- encryptedData = try await castGateway.getThumbnail(fileID: castFile.id)- decryptionHeader = castFile.thumbnail.decryptionHeader- } else {- encryptedData = try await castGateway.getFile(fileID: castFile.id)- decryptionHeader = castFile.file.decryptionHeader- }-- // Decrypt the file data- let decryptedData = try await decryptFileData(- encryptedData: encryptedData,- key: castFile.key,- decryptionHeader: decryptionHeader- )-- // Process the file based on its type- return try await processFileData(decryptedData, castFile: castFile)- }-- private func decryptFileData(- encryptedData: Data,- key: String,- decryptionHeader: String- ) async throws -> Data {- do {- logger.info("Decrypting file data: \(encryptedData.count) bytes encrypted")-- // Use proper stream decryption- let decryptedData = try CryptoUtil.decryptFileData(- encryptedData: encryptedData,- base64Key: key,- base64Header: decryptionHeader- )-- logger.info("Successfully decrypted \(encryptedData.count) bytes to \(decryptedData.count) bytes")- return decryptedData- } catch {- logger.error("Stream decryption failed: \(error)")- throw CastError.decryptionError(error.localizedDescription)- }- }-- // MARK: - File Processing-- public func processFileData(_ data: Data, castFile: CastFile) async throws -> Data {- if castFile.isImage {- return try await processImageData(data, castFile: castFile)- } else if castFile.isVideo {- return try await processVideoData(data, castFile: castFile)- } else if castFile.isLivePhoto {- return try await processLivePhotoData(data, castFile: castFile)- }-- return data- }-- private func processImageData(_ data: Data, castFile: CastFile) async throws -> Data {- #if canImport(UIKit)- guard let image = UIImage(data: data) else {- throw CastError.invalidImageData- }-- // Convert HEIC to JPEG for better tvOS compatibility- if castFile.isHEIC {- guard let jpegData = image.jpegData(compressionQuality: 0.85) else {- throw CastError.imageConversionFailed- }- return jpegData- }-- return data- #else- return data- #endif- }-- private func processVideoData(_ data: Data, castFile: CastFile) async throws -> Data {- // For videos, we might want to extract a thumbnail or process metadata- // For now, return the data as-is- return data- }-- private func processLivePhotoData(_ data: Data, castFile: CastFile) async throws -> Data {- // For live photos, extract the still image component- #if canImport(UIKit)- guard let image = UIImage(data: data) else {- throw CastError.invalidImageData- }-- // Convert to JPEG for slideshow display- guard let jpegData = image.jpegData(compressionQuality: 0.85) else {- throw CastError.imageConversionFailed- }- return jpegData- #else- return data- #endif- }-- // MARK: - File Filtering-- public func filterEligibleFiles(_ files: [CastFile], configuration: SlideConfiguration) -> [CastFile] {- return files.filter { $0.isEligibleForSlideshow(with: configuration) }- }-- public func shuffleFiles(_ files: [CastFile]) -> [CastFile] {- return files.shuffled()- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/CastPairingService.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/CastPairingService.swiftdeleted file mode 100644index 1a1e0f1581..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/CastPairingService.swift+++ /dev/null@@ -1,140 +0,0 @@-import Foundation-import Logging-import EnteCrypto-import EnteNetwork--public class CastPairingService {- private let castGateway: CastGateway- private let logger = Logger(label: "CastPairingService")- private var pollingTask: Task<Void, Never>?-- public init(castGateway: CastGateway) {- self.castGateway = castGateway- }-- deinit {- stopPolling()- }-- // MARK: - Device Registration-- public func registerDevice() async throws -> CastDevice {- logger.info("Starting device registration")-- // Generate real X25519 keypair for this session- let keyPair = try EnteCrypto.generateKeyPair()- logger.debug("Generated keypair for cast session")-- // Register with the server to get a device code- let response = try await castGateway.registerDevice()-- logger.info("Device registered successfully with code: \(response.code)")-- return CastDevice(- deviceCode: response.code,- publicKey: keyPair.publicKey,- privateKey: keyPair.privateKey- )- }-- // MARK: - Polling for Cast Payload-- public func startPolling(- device: CastDevice,- onPayloadReceived: @escaping (CastPayload) -> Void,- onError: @escaping (Error) -> Void- ) {- logger.info("Starting polling for device code: \(device.deviceCode)")-- stopPolling() // Stop any existing polling-- pollingTask = Task {- await pollForPayload(- device: device,- onPayloadReceived: onPayloadReceived,- onError: onError- )- }- }-- public func stopPolling() {- logger.info("Stopping polling")- pollingTask?.cancel()- pollingTask = nil- }-- private func pollForPayload(- device: CastDevice,- onPayloadReceived: @escaping (CastPayload) -> Void,- onError: @escaping (Error) -> Void- ) async {- let pollInterval: TimeInterval = 2.0 // Poll every 2 seconds- let maxAttempts = 150 // 5 minutes total (150 * 2 seconds)- var attempts = 0-- while !Task.isCancelled && attempts < maxAttempts {- do {- attempts += 1-- // Check if payload is available- if let payload = try await checkForPayload(device: device) {- logger.info("Payload received successfully")- await MainActor.run {- onPayloadReceived(payload)- }- return- }-- // Wait before next poll- try await Task.sleep(nanoseconds: UInt64(pollInterval * 1_000_000_000))-- } catch {- logger.error("Error during polling: \(error)")- await MainActor.run {- onError(error)- }- return- }- }-- if attempts >= maxAttempts {- logger.warning("Polling timeout reached")- await MainActor.run {- onError(EnteError.configurationError("Pairing timeout"))- }- }- }-- private func checkForPayload(device: CastDevice) async throws -> CastPayload? {- // This implements the web app's getCastPayload function- // Check if encrypted payload is available and decrypt it-- do {- let castData = try await castGateway.getCastData(deviceCode: device.deviceCode)-- // The response from museum contains encrypted payload data- // We need to implement decryption similar to web implementation-- // TODO: Once the server API returns encrypted data, implement decryption:- // 1. Get encrypted payload from castData- // 2. Decrypt using our private key: EnteCrypto.sealedBoxOpen(encryptedData, publicKey, privateKey)- // 3. Parse the decrypted JSON to get CastPayload-- // For now, convert from network model to our model- // This assumes the server returns the raw data (not encrypted)- return CastPayload(- collectionID: castData.collectionID,- collectionKey: "temp-key", // This should come from decrypted payload- castToken: castData.castToken- )- } catch {- // If the error is "not found" or similar, it means no payload yet- if let enteError = error as? EnteError,- case .serverError(let code, _) = enteError,- code == 404 {- return nil // No payload available yet- }- throw error // Re-throw other errors- }- }-}diff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/SlideshowService.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/SlideshowService.swiftdeleted file mode 100644index c9a53ca9b0..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Services/SlideshowService.swift+++ /dev/null@@ -1,348 +0,0 @@-import Foundation-import Logging--public class SlideshowService: ObservableObject {- @Published public var currentImageData: Data?- @Published public var currentVideoData: Data?- @Published public var currentFile: CastFile?- @Published public var isLoading: Bool = false- @Published public var error: String?-- // Enhanced state management- @Published public var isPlaying: Bool = false- @Published public var isPaused: Bool = false- @Published public var slideLoadingProgress: Double = 0.0- @Published public var currentSlideIndex: Int = 0- @Published public var totalSlides: Int = 0-- private let fileService: CastFileService- private let configuration: SlideConfiguration- private let logger = Logger(label: "SlideshowService")-- private var slideshowTask: Task<Void, Never>?- private var prefetchTask: Task<Void, Never>?- private var currentFiles: [CastFile] = []- private var currentIndex: Int = 0- private var castToken: String = ""- private var slideTimer: Timer?-- // Prefetching cache- private var prefetchCache: [Int: Data] = [:]- private let prefetchQueue = DispatchQueue(label: "slideshow.prefetch", qos: .utility)-- public init(fileService: CastFileService, configuration: SlideConfiguration = .tvOptimized) {- self.fileService = fileService- self.configuration = configuration- }-- deinit {- stop()- }-- // MARK: - Enhanced Controls-- public func pause() {- logger.info("Pausing slideshow")- slideTimer?.invalidate()- slideTimer = nil-- Task { @MainActor in- isPaused = true- isPlaying = false- }- }-- public func resume() {- guard !currentFiles.isEmpty else { return }- logger.info("Resuming slideshow")-- Task { @MainActor in- isPaused = false- isPlaying = true- }-- startSlideTimer()- }-- public func togglePlayPause() {- if isPaused || !isPlaying {- resume()- } else {- pause()- }- }-- // MARK: - Slideshow Control-- public func start(castToken: String) async {- logger.info("Starting slideshow")-- self.castToken = castToken- await MainActor.run {- isLoading = true- error = nil- isPlaying = false- isPaused = false- slideLoadingProgress = 0.0- currentSlideIndex = 0- }-- stop() // Stop any existing slideshow-- slideshowTask = Task {- await runSlideshow()- }- }-- public func stop() {- logger.info("Stopping slideshow")- slideshowTask?.cancel()- slideshowTask = nil- prefetchTask?.cancel()- prefetchTask = nil- slideTimer?.invalidate()- slideTimer = nil-- Task { @MainActor in- isPlaying = false- isPaused = false- }-- // Clear prefetch cache- prefetchCache.removeAll()- }-- private func runSlideshow() async {- do {- // Fetch all files- let allFiles = try await fileService.fetchAllFiles(castToken: castToken)- let eligibleFiles = fileService.filterEligibleFiles(allFiles, configuration: configuration)-- guard !eligibleFiles.isEmpty else {- await MainActor.run {- isLoading = false- error = "No media files found in this album"- }- return- }-- currentFiles = configuration.shuffle ? fileService.shuffleFiles(eligibleFiles) : eligibleFiles- currentIndex = 0-- await MainActor.run {- isLoading = false- totalSlides = currentFiles.count- currentSlideIndex = 0- isPlaying = true- }-- // Display the first slide- await displaySlideAtIndex(currentIndex)-- // Start prefetching- startPrefetching()-- // Start the timer for auto-advancement- startSlideTimer()-- } catch {- logger.error("Slideshow error: \(error)")- await MainActor.run {- isLoading = false- self.error = error.localizedDescription- }- }- }-- private func displayNextSlide() async {- guard !currentFiles.isEmpty else { return }-- let file = currentFiles[currentIndex]-- do {- let fileData = try await fileService.downloadFile(- castFile: file,- castToken: castToken,- useThumbnail: configuration.useThumbnails- )-- await MainActor.run {- currentFile = file-- if file.isVideo {- currentVideoData = fileData- currentImageData = nil- } else {- currentImageData = fileData- currentVideoData = nil- }-- error = nil- }-- // Move to next file (loop back to start when at end)- currentIndex = (currentIndex + 1) % currentFiles.count-- // If we've completed a full cycle, reshuffle if enabled- if currentIndex == 0 && configuration.shuffle {- currentFiles = fileService.shuffleFiles(currentFiles)- }-- } catch {- logger.error("Failed to display slide for file \(file.id): \(error)")- // Skip this file and move to the next one- currentIndex = (currentIndex + 1) % currentFiles.count- }- }-- // MARK: - Manual Navigation-- public func nextSlide() async {- guard !currentFiles.isEmpty else { return }- currentIndex = (currentIndex + 1) % currentFiles.count- await displaySlideAtIndex(currentIndex, updateTimer: true)- }-- public func previousSlide() async {- guard !currentFiles.isEmpty else { return }- currentIndex = currentIndex > 0 ? currentIndex - 1 : currentFiles.count - 1- await displaySlideAtIndex(currentIndex, updateTimer: true)- }-- // MARK: - Timer Management-- private func startSlideTimer() {- guard let currentFile = currentFile else { return }-- slideTimer?.invalidate()- let duration = configuration.duration(for: currentFile)-- slideTimer = Timer.scheduledTimer(withTimeInterval: duration, repeats: false) { [weak self] _ in- Task { @MainActor in- guard let self = self, self.isPlaying, !self.isPaused else { return }- await self.advanceToNextSlide()- }- }- }-- private func advanceToNextSlide() async {- guard !currentFiles.isEmpty else { return }-- currentIndex = (currentIndex + 1) % currentFiles.count-- // If we've completed a full cycle, reshuffle if enabled- if currentIndex == 0 && configuration.shuffle {- currentFiles = fileService.shuffleFiles(currentFiles)- }-- await displaySlideAtIndex(currentIndex)-- if isPlaying && !isPaused {- startSlideTimer()- }- }-- // MARK: - Enhanced Display Logic-- private func displaySlideAtIndex(_ index: Int, updateTimer: Bool = false) async {- guard index >= 0, index < currentFiles.count else { return }-- let file = currentFiles[index]-- do {- // Update loading state- await MainActor.run {- slideLoadingProgress = 0.0- currentSlideIndex = index- }-- // Check if we have prefetched data- let fileData: Data- if let cachedData = prefetchCache[index] {- fileData = cachedData- await MainActor.run { slideLoadingProgress = 1.0 }- } else {- fileData = try await fileService.downloadFile(- castFile: file,- castToken: castToken,- useThumbnail: configuration.useThumbnails- )- await MainActor.run { slideLoadingProgress = 1.0 }- }-- await MainActor.run {- currentFile = file-- if file.isVideo {- currentVideoData = fileData- currentImageData = nil- } else {- currentImageData = fileData- currentVideoData = nil- }-- error = nil- }-- // Start/restart timer if needed- if updateTimer && isPlaying && !isPaused {- startSlideTimer()- }-- } catch {- logger.error("Failed to display slide for file \(file.id): \(error)")- await MainActor.run {- self.error = "Failed to load image: \(error.localizedDescription)"- slideLoadingProgress = 0.0- }- }- }-- // MARK: - Prefetching-- private func startPrefetching() {- prefetchTask?.cancel()- prefetchTask = Task {- await performPrefetching()- }- }-- private func performPrefetching() async {- let prefetchCount = min(3, currentFiles.count)-- for i in 1...prefetchCount {- let prefetchIndex = (currentIndex + i) % currentFiles.count-- // Skip if already cached- if prefetchCache[prefetchIndex] != nil { continue }-- let file = currentFiles[prefetchIndex]-- do {- let fileData = try await fileService.downloadFile(- castFile: file,- castToken: castToken,- useThumbnail: configuration.useThumbnails- )-- // Store in cache- prefetchCache[prefetchIndex] = fileData-- // Clean up old cache entries (keep only 5 recent entries)- if prefetchCache.count > 5 {- let oldKeys = Array(prefetchCache.keys.sorted().prefix(prefetchCache.count - 5))- for key in oldKeys {- prefetchCache.removeValue(forKey: key)- }- }-- } catch {- // Silently fail for prefetching - we'll try again when needed- continue- }-- // Add delay between prefetch operations to avoid overwhelming the system- try? await Task.sleep(nanoseconds: 500_000_000) // 0.5 seconds- }- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Stubs/EnteStubs.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Stubs/EnteStubs.swiftdeleted file mode 100644index 00b4aac124..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Stubs/EnteStubs.swift+++ /dev/null@@ -1,125 +0,0 @@-// Temporary stub implementations for Ente dependencies-// TODO: Remove when actual Ente packages are integrated--import Foundation--// MARK: - EnteCore Stubs--public typealias FileID = Int-public typealias CollectionID = Int--// MARK: - EnteNetwork Stubs--public protocol CastGateway {- func getDiff(sinceTime: Int64) async throws -> DiffResponse- func getFile(fileID: FileID) async throws -> Data- func getThumbnail(fileID: FileID) async throws -> Data- func registerDevice() async throws -> DeviceRegistrationResponse- func getCastData(deviceCode: String) async throws -> CastData-}--public struct DiffResponse: Codable {- public let diff: [FileChange]- public let hasMore: Bool-- public init(diff: [FileChange], hasMore: Bool) {- self.diff = diff- self.hasMore = hasMore- }-}--public struct FileChange: Codable {- public let id: FileID- public let updationTime: Int64- public let isDeleted: Bool-- public init(id: FileID, updationTime: Int64, isDeleted: Bool) {- self.id = id- self.updationTime = updationTime- self.isDeleted = isDeleted- }-}--public struct DeviceRegistrationResponse: Codable {- public let code: String-- public init(code: String) {- self.code = code- }-}--public struct CastData: Codable {- public let collectionID: Int- public let castToken: String-- public init(collectionID: Int, castToken: String) {- self.collectionID = collectionID- self.castToken = castToken- }-}--public enum EnteError: Error {- case serverError(Int, String)- case configurationError(String)-}--// Mock implementation of CastGateway-public class MockCastGateway: CastGateway {- public init() {}-- public func getDiff(sinceTime: Int64) async throws -> DiffResponse {- // Return empty diff for now- return DiffResponse(diff: [], hasMore: false)- }-- public func getFile(fileID: FileID) async throws -> Data {- // Return mock file data- return "Mock file data".data(using: .utf8) ?? Data()- }-- public func getThumbnail(fileID: FileID) async throws -> Data {- // Return mock thumbnail data- return "Mock thumbnail data".data(using: .utf8) ?? Data()- }-- public func registerDevice() async throws -> DeviceRegistrationResponse {- // Generate a mock device code- let code = String((1...6).map { _ in String(Int.random(in: 0...9)) }.joined())- return DeviceRegistrationResponse(code: code)- }-- public func getCastData(deviceCode: String) async throws -> CastData {- // Mock implementation - throw 404 for first few calls, then return data- throw EnteError.serverError(404, "Not found")- }-}--// MARK: - EnteCrypto Implementation (using proper stream decryption)--import EnteCrypto--public enum CryptoUtil {- public static func decryptChaChaBase64(data: Data, key: Data, header: Data) throws -> Data {- // Use proper stream decryption from EnteCrypto- return try EnteCrypto.decryptFileStream(encryptedData: data, key: key, header: header)- }-- /// Decrypts file data using stream decryption with base64 encoded parameters- /// This matches the format used by the mobile app and server- public static func decryptFileData(- encryptedData: Data,- base64Key: String,- base64Header: String- ) throws -> Data {- guard let keyData = Data(base64Encoded: base64Key),- let headerData = Data(base64Encoded: base64Header) else {- throw CastError.decryptionError("Invalid base64 key or header")- }-- return try EnteCrypto.decryptFileStream(- encryptedData: encryptedData,- key: keyData,- header: headerData- )- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Utils/FileDownloader.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Utils/FileDownloader.swiftdeleted file mode 100644index 4a33a670af..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Utils/FileDownloader.swift+++ /dev/null@@ -1,124 +0,0 @@-import Foundation-import Logging--public class FileDownloader {- private let logger = Logger(label: "FileDownloader")- private let urlSession: URLSession- private let cache = NSCache<NSString, NSData>()-- public init(urlSession: URLSession = .shared) {- self.urlSession = urlSession- setupCache()- }-- private func setupCache() {- cache.countLimit = 10 // Keep up to 10 images in memory- cache.totalCostLimit = 50 * 1024 * 1024 // 50MB total cache size- }-- // MARK: - Download with Caching-- public func downloadWithCache(- url: URL,- cacheKey: String? = nil- ) async throws -> Data {- let key = cacheKey ?? url.absoluteString- let cacheKey = NSString(string: key)-- // Check cache first- if let cachedData = cache.object(forKey: cacheKey) {- logger.debug("Cache hit for key: \(key)")- return cachedData as Data- }-- // Download if not cached- logger.debug("Cache miss, downloading: \(url)")- let (data, response) = try await urlSession.data(from: url)-- guard let httpResponse = response as? HTTPURLResponse,- httpResponse.statusCode == 200 else {- throw FileDownloaderError.downloadFailed- }-- // Cache the result- let cost = data.count- cache.setObject(NSData(data: data), forKey: cacheKey, cost: cost)-- return data- }-- // MARK: - Background Download-- public func downloadInBackground(url: URL) -> AsyncStream<DownloadProgress> {- AsyncStream { continuation in- let task = urlSession.downloadTask(with: url) { localURL, response, error in- if let error = error {- continuation.yield(.failed(error))- continuation.finish()- return- }-- guard let localURL = localURL,- let httpResponse = response as? HTTPURLResponse,- httpResponse.statusCode == 200 else {- continuation.yield(.failed(FileDownloaderError.downloadFailed))- continuation.finish()- return- }-- do {- let data = try Data(contentsOf: localURL)- continuation.yield(.completed(data))- continuation.finish()- } catch {- continuation.yield(.failed(error))- continuation.finish()- }- }-- task.resume()-- continuation.onTermination = { @Sendable _ in- task.cancel()- }- }- }-- // MARK: - Cache Management-- public func clearCache() {- logger.info("Clearing download cache")- cache.removeAllObjects()- }-- public func removeCachedData(for key: String) {- cache.removeObject(forKey: NSString(string: key))- }-}--// MARK: - Download Progress--public enum DownloadProgress {- case progress(ByteCountFormatter.CountStyle)- case completed(Data)- case failed(Error)-}--// MARK: - Errors--public enum FileDownloaderError: Error, LocalizedError {- case downloadFailed- case invalidResponse- case cacheError-- public var errorDescription: String? {- switch self {- case .downloadFailed:- return "Download failed"- case .invalidResponse:- return "Invalid server response"- case .cacheError:- return "Cache operation failed"- }- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Utils/ImageProcessor.swift b/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Utils/ImageProcessor.swiftdeleted file mode 100644index 7aee95728c..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Sources/EnteCast/Utils/ImageProcessor.swift+++ /dev/null@@ -1,167 +0,0 @@-import Foundation-import UniformTypeIdentifiers-import ImageIO-import CoreGraphics--#if canImport(UIKit)-import UIKit-#endif--public struct ImageProcessor {-- // MARK: - MIME Type Detection-- public static func detectMIMEType(from data: Data, fileName: String = "") -> String? {- // Try to detect from data first- if let mimeType = detectMIMETypeFromData(data) {- return mimeType- }-- // Fallback to file extension- return detectMIMETypeFromExtension(fileName)- }-- private static func detectMIMETypeFromData(_ data: Data) -> String? {- guard data.count >= 12 else { return nil }-- let bytes = data.prefix(12)-- // Check for common image formats- if bytes.starts(with: [0xFF, 0xD8, 0xFF]) {- return "image/jpeg"- }- if bytes.starts(with: [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]) {- return "image/png"- }- if bytes.starts(with: [0x47, 0x49, 0x46, 0x38]) {- return "image/gif"- }- if bytes.starts(with: [0x57, 0x45, 0x42, 0x50]) {- return "image/webp"- }- // HEIF/HEIC detection- if bytes.count >= 12 {- let slice = bytes[4..<12]- if slice.starts(with: [0x66, 0x74, 0x79, 0x70]) { // "ftyp"- let subtype = bytes.suffix(4)- if subtype.starts(with: [0x68, 0x65, 0x69, 0x63]) { // "heic"- return "image/heic"- }- if subtype.starts(with: [0x68, 0x65, 0x69, 0x66]) { // "heif"- return "image/heif"- }- }- }-- return nil- }-- private static func detectMIMETypeFromExtension(_ fileName: String) -> String? {- let url = URL(fileURLWithPath: fileName)- let pathExtension = url.pathExtension.lowercased()-- switch pathExtension {- case "jpg", "jpeg":- return "image/jpeg"- case "png":- return "image/png"- case "gif":- return "image/gif"- case "webp":- return "image/webp"- case "heic":- return "image/heic"- case "heif":- return "image/heif"- default:- return nil- }- }-- // MARK: - Image Processing-- public static func processImage(_ data: Data, fileName: String) async throws -> Data {- guard let mimeType = detectMIMEType(from: data, fileName: fileName) else {- throw ImageProcessorError.unsupportedFormat- }-- // Handle HEIC/HEIF conversion- if mimeType == "image/heic" || mimeType == "image/heif" {- return try await convertHEICToJPEG(data)- }-- // For other formats, return as-is for now- return data- }-- // MARK: - HEIC Conversion-- private static func convertHEICToJPEG(_ data: Data) async throws -> Data {- return try await withCheckedThrowingContinuation { continuation in- DispatchQueue.global(qos: .userInitiated).async {- do {- let convertedData = try convertHEICToJPEGSync(data)- continuation.resume(returning: convertedData)- } catch {- continuation.resume(throwing: error)- }- }- }- }-- private static func convertHEICToJPEGSync(_ data: Data) throws -> Data {- guard let imageSource = CGImageSourceCreateWithData(data as CFData, nil),- let cgImage = CGImageSourceCreateImageAtIndex(imageSource, 0, nil) else {- throw ImageProcessorError.conversionFailed- }-- let mutableData = NSMutableData()- guard let destination = CGImageDestinationCreateWithData(- mutableData,- UTType.jpeg.identifier as CFString,- 1,- nil- ) else {- throw ImageProcessorError.conversionFailed- }-- let options: [CFString: Any] = [- kCGImageDestinationLossyCompressionQuality: 0.8- ]-- CGImageDestinationAddImage(destination, cgImage, options as CFDictionary)-- guard CGImageDestinationFinalize(destination) else {- throw ImageProcessorError.conversionFailed- }-- return mutableData as Data- }-- // MARK: - Live Photo Processing-- public static func extractImageFromLivePhoto(_ data: Data, fileName: String) throws -> (Data, String) {- // Live photo processing is complex and would require parsing the container format- // For now, return the data as-is and let the system handle it- return (data, fileName)- }-}--// MARK: - Errors--public enum ImageProcessorError: Error, LocalizedError {- case unsupportedFormat- case conversionFailed- case processingFailed-- public var errorDescription: String? {- switch self {- case .unsupportedFormat:- return "Unsupported image format"- case .conversionFailed:- return "Failed to convert image format"- case .processingFailed:- return "Failed to process image"- }- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCast/Tests/EnteCastTests/EnteCastTests.swift b/mobile/native/darwin/Packages/EnteCast/Tests/EnteCastTests/EnteCastTests.swiftdeleted file mode 100644index 97a3414d3d..0000000000--- a/mobile/native/darwin/Packages/EnteCast/Tests/EnteCastTests/EnteCastTests.swift+++ /dev/null@@ -1,56 +0,0 @@-import XCTest-@testable import EnteCast--final class EnteCastTests: XCTestCase {-- func testCastFileEligibility() {- let imageFile = CastFile(- id: FileID(1),- metadata: CastFileMetadata(fileType: 0, title: "image.jpg"), // Image type- info: CastFileInfo(fileSize: 1024 * 1024), // 1MB- file: CastFileData(decryptionHeader: "header"),- thumbnail: CastFileData(decryptionHeader: "thumb-header"),- key: "key",- updationTime: 123456,- isDeleted: false- )-- XCTAssertTrue(imageFile.isImage)- XCTAssertTrue(imageFile.isEligibleForSlideshow)-- let largeFile = CastFile(- id: FileID(2),- metadata: CastFileMetadata(fileType: 0, title: "large.jpg"),- info: CastFileInfo(fileSize: 200 * 1024 * 1024), // 200MB - too large- file: CastFileData(decryptionHeader: "header"),- thumbnail: CastFileData(decryptionHeader: "thumb-header"),- key: "key",- updationTime: 123456,- isDeleted: false- )-- XCTAssertFalse(largeFile.isEligibleForSlideshow)- }-- func testSlideConfiguration() {- let defaultConfig = SlideConfiguration.default- XCTAssertEqual(defaultConfig.duration, 12.0)- XCTAssertTrue(defaultConfig.shuffle)-- let tvConfig = SlideConfiguration.tvOptimized- XCTAssertTrue(tvConfig.useThumbnails)- XCTAssertEqual(tvConfig.maxFileSize, 50 * 1024 * 1024)- }-- func testCastPayload() {- let payload = CastPayload(- collectionID: CollectionID(123),- collectionKey: "test-key",- castToken: "test-token"- )-- XCTAssertEqual(payload.collectionID, CollectionID(123))- XCTAssertEqual(payload.collectionKey, "test-key")- XCTAssertEqual(payload.castToken, "test-token")- }-}\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCrypto/.gitignore b/mobile/native/darwin/Packages/EnteCrypto/.gitignoredeleted file mode 100644index 0023a53406..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/.gitignore+++ /dev/null@@ -1,8 +0,0 @@-.DS_Store-/.build-/Packages-xcuserdata/-DerivedData/-.swiftpm/configuration/registries.json-.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata-.netrcdiff --git a/mobile/native/darwin/Packages/EnteCrypto/Binaries/.gitignore b/mobile/native/darwin/Packages/EnteCrypto/Binaries/.gitignoredeleted file mode 100644index 7c9d611b59..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Binaries/.gitignore+++ /dev/null@@ -1,3 +0,0 @@-*-!.gitignore-!README.mddiff --git a/mobile/native/darwin/Packages/EnteCrypto/Binaries/README.md b/mobile/native/darwin/Packages/EnteCrypto/Binaries/README.mddeleted file mode 100644index 53b5985a3b..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Binaries/README.md+++ /dev/null@@ -1,13 +0,0 @@-# EnteRustCryptoFFI Artifacts--`EnteRustCryptoFFI.xcframework` is generated locally and is intentionally not checked into git.--Regenerate it from repo root with:--```bash-mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/build-xcframework.sh-```--The Swift package at `mobile/native/darwin/Packages/EnteCrypto/Package.swift` expects the generated output at:--`mobile/native/darwin/Packages/EnteCrypto/Binaries/EnteRustCryptoFFI.xcframework`diff --git a/mobile/native/darwin/Packages/EnteCrypto/CRYPTO_SPEC.md b/mobile/native/darwin/Packages/EnteCrypto/CRYPTO_SPEC.mddeleted file mode 100644index 5f6c03eb70..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/CRYPTO_SPEC.md+++ /dev/null@@ -1,324 +0,0 @@-# Ente Cryptographic Operations Specification--## Overview--This document specifies the cryptographic operations used in the Ente ecosystem, with particular focus on the tvOS/Swift implementation via the EnteCrypto package. All crypto operations use libsodium for consistency across platforms (Mobile, Web, CLI, tvOS).--## Core Algorithms & Libraries--### Primary Dependencies-- **libsodium**: Cross-platform cryptographic library (via swift-sodium)-- **CryptoKit**: Apple's cryptographic framework (X25519 key generation only)-- **Swift Crypto**: Additional cryptographic primitives--### Algorithm Suite-- **Key Exchange**: X25519 Elliptic Curve Diffie-Hellman-- **Symmetric Encryption**: XSalsa20Poly1305 (secretbox), XChaCha20Poly1305 (secretstream)-- **Anonymous Encryption**: X25519 + XSalsa20Poly1305 (sealed box)-- **Hashing**: BLAKE2b (64-byte output)-- **Key Derivation**: Argon2id, libsodium KDF-------## Authentication & Key Derivation--### Password-Based Key Derivation--**Purpose**: Convert user password into encryption keys-**Algorithm**: Argon2id-**Implementation**: `EnteCrypto.deriveArgonKey()`--```swift-// Parameters (configurable based on device capability)-memLimit: Int // Memory limit in bytes-opsLimit: Int // Time/CPU cost parameter-salt: String // Base64-encoded 16-byte salt-output: 32 bytes // keyEncryptionKey (KEK)-```--**Cross-Platform Notes**:-- Mobile/Web: argon2-browser, go-argon2-- tvOS: swift-sodium pwHash.hash()-- All platforms produce identical outputs for same parameters--### Login Key Derivation--**Purpose**: Derive authentication key from KEK for SRP-**Algorithm**: libsodium KDF (crypto_kdf_derive_from_key)-**Implementation**: `EnteCrypto.deriveLoginKey()`--```swift-input: keyEncryptionKey (32 bytes)-kdf_id: 1-context: "loginctx" (8 bytes)-output: 16 bytes (first half of 32-byte derived key)-```-------## Secure Remote Password (SRP)--**Purpose**: Zero-knowledge password authentication-**Implementation**: `SRPClient` class-**Parameters**:-- Group: 4096-bit safe prime (RFC 5054)-- Hash: SHA-256-- Generator: 5--### Authentication Flow-1. Client generates private key `a`, computes public key `A = g^a mod N`-2. Server responds with public key `B`, salt-3. Client computes shared secret `S` using password-derived `x`-4. Mutual authentication via evidence exchange (M1, M2)-5. Session key derived as `SHA-256(S)`-------## Cast System Cryptography--### Key Generation--**Purpose**: Generate keypair for cast device pairing-**Algorithm**: X25519 ECDH-**Implementation**: `EnteCrypto.generateCastKeyPair()`--```swift-// Uses CryptoKit for X25519 generation (compatible with libsodium)-privateKey: Curve25519.KeyAgreement.PrivateKey-publicKey: derived from privateKey-output: base64-encoded key pair-```--### Cast Payload Encryption/Decryption--**Purpose**: Secure transmission of collection metadata from mobile to tvOS-**Algorithm**: X25519 + XSalsa20Poly1305 (NaCl sealed box)-**Implementation**: `EnteCrypto.decryptCastPayload()`--**Mobile Client (Dart)**:-```dart-final encPayload = CryptoUtil.sealSync(- CryptoUtil.base642bin(base64Encode(payload.codeUnits)),- CryptoUtil.base642bin(publicKey)-);-```--**tvOS Client (Swift)**:-```swift-let decryptedBytes = sodium.box.open(- anonymousCipherText: cipherText,- recipientPublicKey: publicKey,- recipientSecretKey: privateKey-)-```--**Payload Structure**:-```json-{- "collectionID": 12345,- "castToken": "authentication-token",- "collectionKey": "base64-encoded-collection-key"-}-```-------## File Encryption System--### File Key Decryption--**Purpose**: Decrypt file-specific encryption keys-**Algorithm**: XSalsa20Poly1305 (libsodium secretbox)-**Implementation**: `EnteCrypto.secretBoxOpen()`--```swift-input: encryptedKey (base64) + nonce (base64) + collectionKey (32 bytes)-output: fileKey (32 bytes)-```--### File Content & Metadata Decryption--**Purpose**: Decrypt actual file data and metadata-**Algorithm**: XChaCha20Poly1305 (libsodium secretstream)-**Implementation**: `EnteCrypto.decryptSecretStream()`--```text-Inputs:- fileKey: 32 bytes (random; derived via key hierarchy)- header: 24 bytes (emitted once by secretstream initPush; MUST be stored)- cipher: Concatenation of encrypted chunks (each chunk = plaintextChunk + 17 bytes overhead)-Output:- Plaintext file bytes (exact original size)-```--#### File (NOT thumbnail) Encryption Format-All full-size files use libsodium secretstream XChaCha20-Poly1305 with FIXED PLAINTEXT CHUNK SIZE:-* Plaintext chunk size: 4,194,304 bytes (4 MiB) except final chunk (smaller or equal)-* Per-chunk overhead: 17 bytes (secretstream MAC + internal framing)-* Cipher chunk size (non-final): 4,194,321 bytes (4 MiB + 17)-* Final chunk: plaintext_len + 17 (tag = FINAL)--Encryption steps (producer):-1. Generate `fileKey` (32 random bytes) if not already present.-2. `state, header = initPush(fileKey)`; persist `header` alongside encrypted data record.-3. For each 4 MiB plaintext slice (streamed from disk):- - Tag = `MESSAGE` for all but last; `FINAL` for last slice.- - `cipherChunk = push(state, plaintextSlice, tag)` (cipherChunk length = sliceLen + 17)- - Append `cipherChunk` to output blob.-4. Store: `header` (24B), concatenated cipher blob, original size metadata (optional but useful for validations), and hash (BLAKE2b) if required.--Decryption steps (consumer):-1. Retrieve `fileKey`, `header`, full `cipher` blob.-2. Initialize: `state = initPull(header, fileKey)`.-3. Iterate over the cipher blob in fixed sized chunks of 4,194,321 bytes (cipherChunkSize) until remaining < cipherChunkSize; treat remainder as final chunk.-4. For each chunk: `plaintext, tag = pull(state, cipherChunk)`; append `plaintext`.-5. Expect `FINAL` tag on the last chunk and no trailing bytes after a `FINAL`.-6. Authentication failure (pull returns nil) β abort: report `decryptionFailed`.--Notes:-* Each chunk MAC authenticates sequence + content; modification or truncation causes pull failure.-* If in future producers change chunk size, the decrypter MUST add negotiation metadata (e.g. store chunk size) or attempt adaptive boundary detection BEFORE deploying change.-* Metadata blobs (small) MAY still be single-chunk (then cipher length = plaintext + 17, tag = FINAL). Logic above still applies.-------## Hash Verification System--### BLAKE2b Hashing--**Purpose**: Verify file content integrity-**Algorithm**: BLAKE2b (crypto_generichash)-**Output Length**: 64 bytes (512 bits)-**Implementation**: `EnteCrypto.computeBlake2bHash()`--```swift-input: file_content (Data)-process: sodium.genericHash.hash(message, outputLength: 64)-output: hex_string (128 characters)-```--### Cross-Platform Hash Verification--**Challenge**: Server stores hashes as base64, client computes as hex-**Solution**: Dual-format comparison in `EnteCrypto.verifyFileHash()`--```swift-// 1. Try direct hex comparison-if computedHex == expectedHash { return true }--// 2. Try base64βhex conversion-if let base64Data = Data(base64Encoded: expectedHash) {- let expectedHex = base64Data.hexString- if computedHex == expectedHex { return true }-}-```-------## Platform Consistency Matrix--| Operation | Mobile (Dart) | Web (TypeScript) | CLI (Go) | tvOS (Swift) |-|-----------|---------------|------------------|----------|--------------|-| **Key Derivation** | argon2-browser | argon2-browser | go-argon2 | swift-sodium |-| **SRP Auth** | custom | custom | custom | SRPClient |-| **Cast Payload** | sealSync() | boxSeal() | SealedBoxOpen() | box.open() |-| **File Key** | secretBox | secretBox | SecretBoxOpen() | secretBox.open() |-| **File Content** | decryptChaCha() | decryptStreamBytes() | DecryptFile() | secretStream.xchacha20poly1305 |-| **Hash** | blake2b (64B) | blake2b (64B) | blake2b (64B) | genericHash (64B) |--## Security Properties--### Cryptographic Guarantees-1. **Forward Secrecy**: Cast uses ephemeral X25519 keypairs-2. **Zero Knowledge**: Server cannot decrypt payloads or file contents-3. **Authenticated Encryption**: All operations use AEAD ciphers-4. **Key Hierarchy**: `masterKey β collectionKey β fileKey β content`-5. **Integrity Verification**: BLAKE2b hashes validate authenticity--### Implementation Security-1. **Constant-Time Operations**: libsodium provides timing-safe implementations-2. **Memory Safety**: Swift automatic memory management + libsodium secure allocators-3. **Key Zeroization**: libsodium handles secure key deletion-4. **Side-Channel Resistance**: Hardware-accelerated crypto where available-------## Error Handling--### CryptoError Types-- `invalidSalt`: Base64 decoding or format errors-- `invalidParameters`: Wrong key/nonce lengths, malformed input-- `invalidKeyLength`: Key size validation failures-- `derivationFailed`: Argon2id, KDF, or random generation failures-- `decryptionFailed`: Authentication tag verification failures-- `encryptionFailed`: Encryption operation failures--### Error Recovery-1. **Cast Operations**: Fall back to demo mode on crypto failures-2. **File Operations**: Skip files with decryption/verification errors-3. **Authentication**: Clear stored credentials and restart flow-4. **Network**: Retry with exponential backoff for transient failures-------## Performance Considerations--### Optimization Strategies-1. **Streaming**: Use secretstream for large files (>1MB)-2. **Hardware Acceleration**: Leverage ARM64 crypto extensions on Apple TV-3. **Memory Management**: Process files in chunks to limit peak memory-4. **Caching**: Reuse decrypted collection keys within session-5. **Precomputation**: Generate ephemeral keys during app startup--### Resource Limits-- **Memory**: Argon2id memLimit tuned per device capability-- **Time**: Argon2id opsLimit balanced for UX vs security-- **Storage**: No persistent key storage (session-only)-- **Network**: Cast payload <1KB, efficient for real-time transmission-------## Testing & Validation--### Cross-Platform Test Vectors-1. **Key Derivation**: Same password/salt β identical KEK across platforms-2. **Cast Payload**: Mobile-encrypted β tvOS-decrypted β identical JSON-3. **File Decryption**: Server file β tvOS client β verified hash match-4. **Hash Computation**: Same content β identical BLAKE2b across platforms--### Security Testing-1. **Static Analysis**: SwiftLint crypto-specific rules-2. **Dynamic Analysis**: Memory leak detection during crypto operations-3. **Fuzzing**: Malformed input handling in decrypt operations-4. **Side-Channel**: Timing analysis of key derivation and comparison-------## Implementation Notes--### Swift-Specific Considerations-1. **libsodium Integration**: Use swift-sodium wrapper for cross-platform compatibility-2. **Memory Management**: Data types automatically zeroed by ARC-3. **Error Handling**: Typed errors with localized descriptions-4. **Concurrency**: All crypto operations are synchronous (libsodium requirement)--### tvOS Platform Constraints-1. **No Persistent Storage**: Keys exist only in memory during session-2. **Limited Input**: QR code scanning for device pairing-3. **Network Only**: All crypto material received via cast protocol-4. **Performance**: ARM64 hardware acceleration available-------## Version History--**v1.0 (August 2025)**: Initial implementation with working cast functionality-- Cast payload decryption (sealed box)-- File key/content decryption (secretbox/secretstream)-- BLAKE2b hash verification (64-byte, dual-format)-- X25519 key generation (CryptoKit + libsodium compatible)-- Cross-platform compatibility verified-------*This specification ensures cryptographic consistency across all Ente client platforms while maintaining the security guarantees of the zero-knowledge architecture.*\ No newline at end of filediff --git a/mobile/native/darwin/Packages/EnteCrypto/Package.resolved b/mobile/native/darwin/Packages/EnteCrypto/Package.resolveddeleted file mode 100644index c3c5b3fd85..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Package.resolved+++ /dev/null@@ -1,50 +0,0 @@-{- "pins" : [- {- "identity" : "bigint",- "kind" : "remoteSourceControl",- "location" : "https://github.com/attaswift/BigInt.git",- "state" : {- "revision" : "e07e00fa1fd435143a2dcf8b7eec9a7710b2fdfe",- "version" : "5.7.0"- }- },- {- "identity" : "swift-asn1",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-asn1.git",- "state" : {- "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc",- "version" : "1.4.0"- }- },- {- "identity" : "swift-crypto",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-crypto.git",- "state" : {- "revision" : "334e682869394ee239a57dbe9262bff3cd9495bd",- "version" : "3.14.0"- }- },- {- "identity" : "swift-log",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-log.git",- "state" : {- "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2",- "version" : "1.6.4"- }- },- {- "identity" : "swift-tagged",- "kind" : "remoteSourceControl",- "location" : "https://github.com/pointfreeco/swift-tagged.git",- "state" : {- "revision" : "3907a9438f5b57d317001dc99f3f11b46882272b",- "version" : "0.10.0"- }- }- ],- "version" : 2-}diff --git a/mobile/native/darwin/Packages/EnteCrypto/Package.swift b/mobile/native/darwin/Packages/EnteCrypto/Package.swiftdeleted file mode 100644index cdc11e593e..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Package.swift+++ /dev/null@@ -1,49 +0,0 @@-// swift-tools-version: 5.9-import PackageDescription--let package = Package(- name: "EnteCrypto",- platforms: [- .iOS(.v15),- .tvOS(.v15),- .macOS(.v12)- ],- products: [- .library(- name: "EnteCrypto",- targets: ["EnteCrypto"]- ),- ],- dependencies: [- .package(path: "../EnteCore"),- .package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0"),- .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),- .package(url: "https://github.com/attaswift/BigInt.git", from: "5.3.0"),- ],- targets: [- .binaryTarget(- name: "EnteRustCryptoFFI",- path: "Binaries/EnteRustCryptoFFI.xcframework"- ),- .target(- name: "EnteCrypto",- dependencies: [- "EnteCore",- "EnteRustCryptoFFI",- .product(name: "Crypto", package: "swift-crypto"),- .product(name: "Logging", package: "swift-log"),- .product(name: "BigInt", package: "BigInt"),- ],- linkerSettings: [- .linkedFramework("SystemConfiguration", .when(platforms: [.macOS])),- ]- ),- .testTarget(- name: "EnteCryptoTests",- dependencies: [- "EnteCrypto",- "EnteCore"- ]- ),- ]-)diff --git a/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/EnteCrypto.swift b/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/EnteCrypto.swiftdeleted file mode 100644index 38182e32cc..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/EnteCrypto.swift+++ /dev/null@@ -1,262 +0,0 @@-// EnteCrypto - Cryptographic operations for Ente native apps.--import Foundation-import EnteCore-import Crypto-import Logging--// MARK: - Constants (mirrors CLI crypto.go)--public struct CryptoConstants {- // Login key derivation constants - matches CLI crypto.go exactly- public static let loginSubKeyLength: UInt32 = 32 // CLI: loginSubKeyLen = 32- public static let loginSubKeyId: UInt64 = 1 // CLI: loginSubKeyId = 1- public static let loginSubKeyContext = "loginctx" // CLI: loginSubKeyContext = "loginctx"-- // BLAKE2b constants-- public static let cryptoKDFBlake2bBytesMax: UInt32 = 64- public static let cryptoGenerichashBlake2bSaltBytes = 16- public static let cryptoGenerichashBlake2bPersonalBytes = 16-- // Box constants- public static let boxSealBytes = 48 // 32 for ephemeral public key + 16 for MAC-- // Default key lengths- public static let keyEncryptionKeyLength = 32- public static let argonSaltLength = 16-}--// MARK: - Crypto Errors--public enum CryptoError: Error, Equatable, LocalizedError {- case invalidSalt- case invalidParameters- case invalidKeyLength- case derivationFailed- case decryptionFailed- case singleShotDecryptionFailed- case encryptionFailed- case invalidNonce- case invalidTag- case rustBackendUnavailable- case rustBackendError(String)-- public var errorDescription: String? {- switch self {- case .invalidSalt:- return "Invalid salt format"- case .invalidParameters:- return "Invalid cryptographic parameters"- case .invalidKeyLength:- return "Invalid key length"- case .derivationFailed:- return "Key derivation failed"- case .singleShotDecryptionFailed:- return "Single shot decryption failed"- case .decryptionFailed:- return "Decryption failed"- case .encryptionFailed:- return "Encryption failed"- case .invalidNonce:- return "Invalid nonce"- case .invalidTag:- return "Invalid authentication tag"- case .rustBackendUnavailable:- return "Rust crypto backend is unavailable on tvOS"- case .rustBackendError(let message):- return "Rust crypto backend error: \(message)"- }- }-}--// MARK: - Main Crypto Class--public class EnteCrypto {- private static let logger = Logger(label: "EnteCrypto")-- private static func rustBridge() throws -> RustCryptoBridge {- guard RustCryptoBridge.isAvailable else {- throw CryptoError.rustBackendUnavailable- }- return RustCryptoBridge.shared- }-- // MARK: - Key Derivation-- /// Derives a key using Argon2id - mirrors CLI DeriveArgonKey- public static func deriveArgonKey(- password: String,- salt: String,- memLimit: Int,- opsLimit: Int- ) throws -> Data {- logger.debug("Deriving Argon key with memLimit: \(memLimit), opsLimit: \(opsLimit)")-- guard memLimit >= 1024 && opsLimit >= 1 else {- throw CryptoError.invalidParameters- }-- guard let saltData = Data(base64Encoded: salt) else {- throw CryptoError.invalidSalt- }-- do {- return try rustBridge().deriveArgonKey(- password: password,- salt: saltData,- memLimit: memLimit,- opsLimit: opsLimit- )- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- /// Derives login key from keyEncKey - exactly matching web libsodium KDF implementation- /// This loginKey acts as user provided password during SRP authentication- public static func deriveLoginKey(keyEncKey: Data) throws -> Data {- do {- return try rustBridge().deriveLoginKey(keyEncKey: keyEncKey)- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- // MARK: - Key Generation-- /// Generates a new X25519 keypair for cast pairing- /// Returns base64 encoded public and private keys- public static func generateKeyPair() throws -> (publicKey: String, privateKey: String) {- do {- return try rustBridge().generateKeyPair()- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- // MARK: - Encryption/Decryption Operations-- /// SecretBox encryption - mirrors CLI SecretBoxOpen- public static func secretBoxOpen(_ cipherText: Data, nonce: Data, key: Data) throws -> Data {- guard nonce.count == 24, key.count == 32 else {- throw CryptoError.invalidParameters- }-- do {- return try rustBridge().secretBoxOpen(cipherText: cipherText, nonce: nonce, key: key)- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- /// SealedBox decryption - standard libsodium sealed box- public static func sealedBoxOpen(_ cipherText: Data, publicKey: Data, secretKey: Data) throws -> Data {- guard publicKey.count == 32, secretKey.count == 32 else {- throw CryptoError.invalidParameters- }-- do {- return try rustBridge().sealedBoxOpen(cipherText: cipherText, publicKey: publicKey, secretKey: secretKey)- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- // MARK: - Stream Decryption (XChaCha20-Poly1305)-- /// Stream decryption using XChaCha20Poly1305 secretstream- /// This is the main method used for file content and metadata decryption in Ente- public static func decryptSecretStream(encryptedData: Data, key: Data, header: Data) throws -> Data {- guard key.count == 32 else {- throw CryptoError.invalidKeyLength- }- guard header.count == 24 else {- throw CryptoError.invalidParameters- }-- do {- return try rustBridge().decryptSecretStream(encryptedData: encryptedData, key: key, header: header)- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- // MARK: - Cast Operations-- /// Generates X25519 keypair for cast pairing (using Swift CryptoKit for compatibility)- /// Returns base64 encoded keys for network transmission- public static func generateCastKeyPair() throws -> (publicKey: String, privateKey: String) {- try generateKeyPair()- }-- /// Decrypts cast payload using sealed box (anonymous encryption)- /// Used to decrypt collection info sent from mobile client- public static func decryptCastPayload(- encryptedPayload: String,- recipientPublicKey: String,- recipientPrivateKey: String- ) throws -> Data {- guard let cipherText = Data(base64Encoded: encryptedPayload),- let publicKey = Data(base64Encoded: recipientPublicKey),- let privateKey = Data(base64Encoded: recipientPrivateKey) else {- throw CryptoError.invalidParameters- }-- return try sealedBoxOpen(cipherText, publicKey: publicKey, secretKey: privateKey)- }-- // MARK: - Hash Operations-- /// Computes BLAKE2b hash using libsodium genericHash (64-byte output)- /// This matches the hash format used across all Ente platforms- public static func computeBlake2bHash(_ data: Data) throws -> String {- do {- return try rustBridge().blake2bHashHex(data)- } catch let err as CryptoError {- throw err- } catch {- throw CryptoError.rustBackendError(error.localizedDescription)- }- }-- /// Verifies file content hash with dual format support- /// Server stores hashes as base64, we compute as hex - handles both formats- public static func verifyFileHash(data: Data, expectedHash: String?) -> Bool {- guard let expectedHash = expectedHash, !expectedHash.isEmpty else {- // No hash available - allow for backwards compatibility- return true- }-- guard let computedHash = try? computeBlake2bHash(data) else {- return false- }-- // Try direct hex comparison first- if computedHash.lowercased() == expectedHash.lowercased() {- return true- }-- // Try base64 to hex conversion- if let base64DecodedHash = Data(base64Encoded: expectedHash) {- let expectedHashAsHex = base64DecodedHash.map { String(format: "%02x", $0) }.joined()- if computedHash.lowercased() == expectedHashAsHex.lowercased() {- return true- }- }-- return false- }-}diff --git a/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/RustCryptoBridge.swift b/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/RustCryptoBridge.swiftdeleted file mode 100644index c46b765ba0..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/RustCryptoBridge.swift+++ /dev/null@@ -1,292 +0,0 @@-import Foundation--enum RustCryptoBridgeError: Error, LocalizedError {- case operationFailed(String)- case invalidOutput(String)-- var errorDescription: String? {- switch self {- case .operationFailed(let message):- return message- case .invalidOutput(let message):- return message- }- }-}--@_silgen_name("ente_tvos_crypto_string_free")-private func rustStringFree(_ ptr: UnsafeMutablePointer<CChar>?)--@_silgen_name("ente_tvos_crypto_generate_keypair_b64")-private func rustGenerateKeyPair(- _ outPublicKeyB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outPrivateKeyB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--@_silgen_name("ente_tvos_crypto_derive_argon_key_b64")-private func rustDeriveArgonKey(- _ passwordUtf8: UnsafePointer<CChar>?,- _ saltB64: UnsafePointer<CChar>?,- _ memLimit: UInt32,- _ opsLimit: UInt32,- _ outKeyB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--@_silgen_name("ente_tvos_crypto_derive_login_key_b64")-private func rustDeriveLoginKey(- _ keyEncKeyB64: UnsafePointer<CChar>?,- _ outLoginKeyB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--@_silgen_name("ente_tvos_crypto_secretbox_open_b64")-private func rustSecretBoxOpen(- _ cipherTextB64: UnsafePointer<CChar>?,- _ nonceB64: UnsafePointer<CChar>?,- _ keyB64: UnsafePointer<CChar>?,- _ outPlainTextB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--@_silgen_name("ente_tvos_crypto_sealed_box_open_b64")-private func rustSealedBoxOpen(- _ cipherTextB64: UnsafePointer<CChar>?,- _ publicKeyB64: UnsafePointer<CChar>?,- _ secretKeyB64: UnsafePointer<CChar>?,- _ outPlainTextB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--@_silgen_name("ente_tvos_crypto_secretstream_decrypt_b64")-private func rustDecryptSecretStream(- _ encryptedDataB64: UnsafePointer<CChar>?,- _ headerB64: UnsafePointer<CChar>?,- _ keyB64: UnsafePointer<CChar>?,- _ outPlainTextB64: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--@_silgen_name("ente_tvos_crypto_blake2b_hash_hex")-private func rustBlake2bHashHex(- _ dataPtr: UnsafePointer<UInt8>?,- _ dataLen: Int,- _ outHashHex: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- _ outError: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?-) -> Int32--final class RustCryptoBridge {- static let shared = RustCryptoBridge()-- static var isAvailable: Bool {- true- }-- private init() {}-- func generateKeyPair() throws -> (publicKey: String, privateKey: String) {- let (publicKeyB64, privateKeyB64) = try callForTwoStringOutputs { out1, out2, outError in- rustGenerateKeyPair(out1, out2, outError)- }- return (publicKeyB64, privateKeyB64)- }-- func deriveArgonKey(password: String, salt: Data, memLimit: Int, opsLimit: Int) throws -> Data {- let saltB64 = salt.base64EncodedString()- let keyB64 = try withCStrings([password, saltB64]) { ptrs in- try callForStringOutput { out, outError in- rustDeriveArgonKey(- ptrs[0],- ptrs[1],- UInt32(memLimit),- UInt32(opsLimit),- out,- outError- )- }- }-- guard let key = Data(base64Encoded: keyB64) else {- throw RustCryptoBridgeError.invalidOutput("Failed to decode derived key")- }- return key- }-- func deriveLoginKey(keyEncKey: Data) throws -> Data {- let keyB64 = keyEncKey.base64EncodedString()- let loginKeyB64 = try withCStrings([keyB64]) { ptrs in- try callForStringOutput { out, outError in- rustDeriveLoginKey(ptrs[0], out, outError)- }- }-- guard let key = Data(base64Encoded: loginKeyB64) else {- throw RustCryptoBridgeError.invalidOutput("Failed to decode login key")- }- return key- }-- func secretBoxOpen(cipherText: Data, nonce: Data, key: Data) throws -> Data {- let plainTextB64 = try withCStrings([- cipherText.base64EncodedString(),- nonce.base64EncodedString(),- key.base64EncodedString(),- ]) { ptrs in- try callForStringOutput { out, outError in- rustSecretBoxOpen(ptrs[0], ptrs[1], ptrs[2], out, outError)- }- }-- guard let plainText = Data(base64Encoded: plainTextB64) else {- throw RustCryptoBridgeError.invalidOutput("Failed to decode decrypted SecretBox payload")- }- return plainText- }-- func sealedBoxOpen(cipherText: Data, publicKey: Data, secretKey: Data) throws -> Data {- let plainTextB64 = try withCStrings([- cipherText.base64EncodedString(),- publicKey.base64EncodedString(),- secretKey.base64EncodedString(),- ]) { ptrs in- try callForStringOutput { out, outError in- rustSealedBoxOpen(ptrs[0], ptrs[1], ptrs[2], out, outError)- }- }-- guard let plainText = Data(base64Encoded: plainTextB64) else {- throw RustCryptoBridgeError.invalidOutput("Failed to decode decrypted SealedBox payload")- }- return plainText- }-- func decryptSecretStream(encryptedData: Data, key: Data, header: Data) throws -> Data {- let plainTextB64 = try withCStrings([- encryptedData.base64EncodedString(),- header.base64EncodedString(),- key.base64EncodedString(),- ]) { ptrs in- try callForStringOutput { out, outError in- rustDecryptSecretStream(ptrs[0], ptrs[1], ptrs[2], out, outError)- }- }-- guard let plainText = Data(base64Encoded: plainTextB64) else {- throw RustCryptoBridgeError.invalidOutput("Failed to decode decrypted secret stream payload")- }- return plainText- }-- func blake2bHashHex(_ data: Data) throws -> String {- var output: UnsafeMutablePointer<CChar>? = nil- var error: UnsafeMutablePointer<CChar>? = nil- var zeroByte: UInt8 = 0-- let status: Int32 = data.withUnsafeBytes { bytes in- let pointer = bytes.baseAddress?.assumingMemoryBound(to: UInt8.self)- return withUnsafePointer(to: &zeroByte) { zeroPtr in- rustBlake2bHashHex(pointer ?? zeroPtr, data.count, &output, &error)- }- }-- defer {- freeRustString(output)- freeRustString(error)- }-- if status != 0 {- let message = error.map { String(cString: $0) } ?? "Unknown Rust error"- throw RustCryptoBridgeError.operationFailed(message)- }-- guard let output, let hash = String(validatingUTF8: output) else {- throw RustCryptoBridgeError.invalidOutput("Failed to decode BLAKE2b hash")- }-- return hash- }-- private func withCStrings<T>(_ values: [String], _ operation: ([UnsafePointer<CChar>?]) throws -> T) throws -> T {- func recurse(_ index: Int, _ pointers: [UnsafePointer<CChar>?]) throws -> T {- if index == values.count {- return try operation(pointers)- }-- return try values[index].withCString { ptr in- try recurse(index + 1, pointers + [ptr])- }- }-- return try recurse(0, [])- }-- private func callForStringOutput(- _ call: (- UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?- ) -> Int32- ) throws -> String {- var output: UnsafeMutablePointer<CChar>? = nil- var error: UnsafeMutablePointer<CChar>? = nil-- let status = call(&output, &error)-- defer {- freeRustString(output)- freeRustString(error)- }-- if status != 0 {- let message = error.map { String(cString: $0) } ?? "Unknown Rust error"- throw RustCryptoBridgeError.operationFailed(message)- }-- guard let output, let value = String(validatingUTF8: output) else {- throw RustCryptoBridgeError.invalidOutput("Missing or invalid UTF-8 output")- }-- return value- }-- private func callForTwoStringOutputs(- _ call: (- UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?,- UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?- ) -> Int32- ) throws -> (String, String) {- var output1: UnsafeMutablePointer<CChar>? = nil- var output2: UnsafeMutablePointer<CChar>? = nil- var error: UnsafeMutablePointer<CChar>? = nil-- let status = call(&output1, &output2, &error)-- defer {- freeRustString(output1)- freeRustString(output2)- freeRustString(error)- }-- if status != 0 {- let message = error.map { String(cString: $0) } ?? "Unknown Rust error"- throw RustCryptoBridgeError.operationFailed(message)- }-- guard let output1,- let output2,- let value1 = String(validatingUTF8: output1),- let value2 = String(validatingUTF8: output2) else {- throw RustCryptoBridgeError.invalidOutput("Missing or invalid UTF-8 keypair output")- }-- return (value1, value2)- }-- private func freeRustString(_ pointer: UnsafeMutablePointer<CChar>?) {- guard let pointer else {- return- }- rustStringFree(pointer)- }-}diff --git a/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/SRPClient.swift b/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/SRPClient.swiftdeleted file mode 100644index 375ea60d1f..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Sources/EnteCrypto/SRPClient.swift+++ /dev/null@@ -1,154 +0,0 @@-import Foundation-import EnteCore-import Crypto-import Logging-import BigInt--// MARK: - SRP Constants--public struct SRPConstants {- public static let groupSize = 4096- public static let hashAlgorithm = "SHA-256"- public static let generator = "05"-- // RFC 5054 4096-bit safe prime- public static let prime = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF"-}--// MARK: - SRP Client--public class SRPClient {- private let logger = Logger(label: "SRPClient")-- private let identity: Data- private let password: Data- private let salt: Data- private let privateKey: BigInt- private var serverPublicKey: Data?- private var sharedSecret: Data?- private var clientPublicKey: Data?-- // RFC 5054 parameters- private let generator: BigInt- private let prime: BigInt-- public init(identity: Data, password: Data, salt: Data) throws {- self.identity = identity- self.password = password- self.salt = salt-- self.prime = BigInt(SRPConstants.prime, radix: 16)!- self.generator = BigInt(SRPConstants.generator, radix: 16)!- var rng = SystemRandomNumberGenerator()- let randomBytes = (0..<32).map { _ in UInt8.random(in: UInt8.min ... UInt8.max, using: &rng) }- self.privateKey = BigInt(Data(randomBytes))-- logger.debug("SRP client initialized")- }-- // MARK: - Authentication Flow-- /// Generate client public key A = g^a mod N- public func generateClientCredentials() -> Data {- let A = generator.power(privateKey, modulus: prime)- let result = A.srpSerialize()- self.clientPublicKey = result-- logger.debug("Generated client public key (\(result.count) bytes)")- return result- }-- /// Process server public key and compute shared secret- public func processServerChallenge(serverPublicKey: Data) throws {- self.serverPublicKey = serverPublicKey-- guard let clientA = clientPublicKey else {- throw CryptoError.invalidParameters- }-- logger.debug("Processing server challenge (\(serverPublicKey.count) bytes)")-- let B = BigInt(serverPublicKey)-- let uData = SHA256.hash(data: clientA + serverPublicKey)- let u = BigInt(Data(uData))-- let innerHash = SHA256.hash(data: identity + ":".data(using: .utf8)! + password)- let xData = SHA256.hash(data: salt + Data(innerHash))- let x = BigInt(Data(xData))-- let kData = SHA256.hash(data: prime.srpSerialize() + generator.srpSerialize())- let k = BigInt(Data(kData))-- let gx = generator.power(x, modulus: prime)- let kgx = (k * gx) % prime- let base = (B - kgx + prime) % prime- let exponent = (privateKey + u * x)- let S = base.power(exponent, modulus: prime)-- self.sharedSecret = S.srpSerialize()- logger.debug("Computed shared secret (\(sharedSecret!.count) bytes)")- }-- /// Generate client evidence M1- public func generateClientEvidence() throws -> Data {- guard let clientA = clientPublicKey,- let serverB = serverPublicKey,- let S = sharedSecret else {- throw CryptoError.invalidParameters- }-- let m1 = Data(SHA256.hash(data: clientA + serverB + S))- logger.debug("Generated client evidence (\(m1.count) bytes)")- return m1- }-- /// Verify server evidence M2- public func verifyServerEvidence(_ serverEvidence: Data) throws -> Bool {- guard let clientA = clientPublicKey,- let S = sharedSecret else {- throw CryptoError.invalidParameters- }-- let clientM1 = try generateClientEvidence()- let expectedM2Data = SHA256.hash(data: clientA + clientM1 + S)- let expectedM2 = Data(expectedM2Data)-- let isValid = expectedM2 == serverEvidence- logger.debug("Server evidence verification: \(isValid)")- return isValid- }-- /// Get session key from shared secret- public func getSessionKey() throws -> Data {- guard let S = sharedSecret else {- throw CryptoError.invalidParameters- }-- let sessionKeyData = SHA256.hash(data: S)- return Data(sessionKeyData)- }-}--// MARK: - BigInt Extensions--extension BigInt {- /// Create BigInt from byte data- init(_ data: Data) {- self.init(sign: .plus, magnitude: BigUInt(data))- }-- /// Serialize to 512-byte padded format- func srpSerialize() -> Data {- let magnitude = self.magnitude- var data = magnitude.serialize()-- let targetLength = 512- if data.count < targetLength {- let padding = Data(count: targetLength - data.count)- data = padding + data- }-- return data- }-}diff --git a/mobile/native/darwin/Packages/EnteCrypto/Tests/EnteCryptoTests/EnteCryptoTests.swift b/mobile/native/darwin/Packages/EnteCrypto/Tests/EnteCryptoTests/EnteCryptoTests.swiftdeleted file mode 100644index aa928b643e..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/Tests/EnteCryptoTests/EnteCryptoTests.swift+++ /dev/null@@ -1,164 +0,0 @@-import XCTest-@testable import EnteCrypto-@testable import EnteCore-import Foundation-import CryptoKit--final class EnteCryptoTests: XCTestCase {-- // MARK: - Key Derivation Tests-- func testArgonKeyDerivation() throws {- let password = "testpassword123"- let salt = Data(count: 16).base64EncodedString()- let memLimit = 64 * 1024 * 1024- let opsLimit = 3-- let derivedKey = try EnteCrypto.deriveArgonKey(- password: password,- salt: salt,- memLimit: memLimit,- opsLimit: opsLimit- )-- XCTAssertEqual(derivedKey.count, 32)- XCTAssertFalse(derivedKey.allSatisfy { $0 == 0 })- }-- func testLoginKeyDerivation() throws {- let keyEncKey = Data(repeating: 1, count: 32)- let loginKey = try EnteCrypto.deriveLoginKey(keyEncKey: keyEncKey)-- XCTAssertEqual(loginKey.count, 16)- XCTAssertFalse(loginKey.allSatisfy { $0 == 0 })- }-- // MARK: - Encryption Tests-- func testGenerateKeyPair() throws {- let keyPair = try EnteCrypto.generateKeyPair()- let publicKey = try XCTUnwrap(Data(base64Encoded: keyPair.publicKey))- let privateKey = try XCTUnwrap(Data(base64Encoded: keyPair.privateKey))-- XCTAssertEqual(publicKey.count, 32)- XCTAssertEqual(privateKey.count, 32)- }-- func testGenerateKeyPairPublicKeyConsistency() throws {- let keyPair = try EnteCrypto.generateKeyPair()- let publicKey = try XCTUnwrap(Data(base64Encoded: keyPair.publicKey))- let privateKey = try XCTUnwrap(Data(base64Encoded: keyPair.privateKey))-- let curvePrivateKey = try Curve25519.KeyAgreement.PrivateKey(rawRepresentation: privateKey)- XCTAssertEqual(curvePrivateKey.publicKey.rawRepresentation, publicKey)- }-- func testSecretBoxOperations() throws {- let message = "Hello, World!".data(using: .utf8)!- let key = Data(repeating: 1, count: 32)- let nonce = Data(repeating: 2, count: 24)-- XCTAssertThrowsError(try EnteCrypto.secretBoxOpen(message, nonce: nonce, key: key)) { error in- XCTAssertTrue(error is CryptoError)- }- }-- // MARK: - SRP Tests-- func testSRPConstants() {- XCTAssertEqual(SRPConstants.groupSize, 4096)- XCTAssertEqual(SRPConstants.hashAlgorithm, "SHA-256")- XCTAssertEqual(SRPConstants.generator, "05")- XCTAssertFalse(SRPConstants.prime.isEmpty)- }-- func testSRPClientInitialization() throws {- let identity = "[email protected]".data(using: .utf8)!- let password = "password123".data(using: .utf8)!- let salt = Data(repeating: 3, count: 16)-- let srpClient = try SRPClient(identity: identity, password: password, salt: salt)- let clientPublicKey = srpClient.generateClientCredentials()-- XCTAssertFalse(clientPublicKey.isEmpty)- }-- // MARK: - Integration Tests-- func testLoginFlowIntegration() throws {- let email = "[email protected]"- let password = "testpassword"- let salt = Data(count: 16).base64EncodedString()- let memLimit = 64 * 1024 * 1024- let opsLimit = 3-- let keyEncKey = try EnteCrypto.deriveArgonKey(- password: password,- salt: salt,- memLimit: memLimit,- opsLimit: opsLimit- )- XCTAssertEqual(keyEncKey.count, 32)-- let loginKey = try EnteCrypto.deriveLoginKey(keyEncKey: keyEncKey)- XCTAssertEqual(loginKey.count, 16)-- let identity = email.data(using: .utf8)!- let srpSalt = Data(repeating: 4, count: 16)- let srpClient = try SRPClient(identity: identity, password: loginKey, salt: srpSalt)-- let clientPublicKey = srpClient.generateClientCredentials()- XCTAssertFalse(clientPublicKey.isEmpty)- }-- // func testRealServerLoginFlow() async throws {- // let email = "<>"- // let password = "<>"- // let baseURL = URL(string: "http://localhost:8080")!-- // let config = NetworkConfiguration.selfHosted(baseURL: baseURL)- // let httpClient = HTTPClient()- // let apiClient = APIClient(- // configuration: config,- // app: .cast,- // authTokenProvider: nil,- // httpClient: httpClient- // )- // let authGateway = AuthenticationGateway(client: apiClient)-- // do {- // let srpAttributes = try await authGateway.getSRPAttributes(email: email)-- // let keyEncKey = try EnteCrypto.deriveArgonKey(- // password: password,- // salt: srpAttributes.kekSalt,- // memLimit: srpAttributes.memLimit,- // opsLimit: srpAttributes.opsLimit- // )- // let loginKey = try EnteCrypto.deriveLoginKey(keyEncKey: keyEncKey)-- // let identity = srpAttributes.srpUserID.data(using: String.Encoding.utf8)!- // let srpSalt = Data(base64Encoded: srpAttributes.srpSalt)!- // let srpClient = try SRPClient(identity: identity, password: loginKey, salt: srpSalt)-- // let clientPublicKey = srpClient.generateClientCredentials()- // let srpSession = try await authGateway.createSRPSession(- // srpUserID: srpAttributes.srpUserID,- // clientPub: clientPublicKey.base64EncodedString()- // )-- // let serverPublicKey = Data(base64Encoded: srpSession.srpB)!- // try srpClient.processServerChallenge(serverPublicKey: serverPublicKey)-- // let clientEvidence = try srpClient.generateClientEvidence()- // _ = try await authGateway.verifySRPSession(- // srpUserID: srpAttributes.srpUserID,- // sessionID: srpSession.sessionID,- // clientM1: clientEvidence.base64EncodedString()- // )-- // } catch {- // XCTFail("Login flow failed with error: \(error)")- // }- // }-}diff --git a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/.gitignore b/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/.gitignoredeleted file mode 100644index b83d22266a..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/.gitignore+++ /dev/null@@ -1 +0,0 @@-/target/diff --git a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/Cargo.lock b/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/Cargo.lockdeleted file mode 100644index 610b13fce8..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/Cargo.lock+++ /dev/null@@ -1,2031 +0,0 @@-# This file is automatically @generated by Cargo.-# It is not intended for manual editing.-version = 4--[[package]]-name = "aead"-version = "0.5.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"-dependencies = [- "crypto-common 0.1.7",- "generic-array",-]--[[package]]-name = "argon2"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072"-dependencies = [- "base64ct",- "blake2",- "cpufeatures",- "password-hash",-]--[[package]]-name = "arrayref"-version = "0.3.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"--[[package]]-name = "arrayvec"-version = "0.7.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"--[[package]]-name = "atomic-waker"-version = "1.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"--[[package]]-name = "base64"-version = "0.22.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"--[[package]]-name = "base64ct"-version = "1.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"--[[package]]-name = "bip39"-version = "2.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc"-dependencies = [- "bitcoin_hashes",- "serde",- "unicode-normalization",-]--[[package]]-name = "bitcoin_hashes"-version = "0.14.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b"-dependencies = [- "hex-conservative",-]--[[package]]-name = "bitflags"-version = "2.10.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"--[[package]]-name = "blake2"-version = "0.10.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe"-dependencies = [- "digest 0.10.7",-]--[[package]]-name = "blake2b_simd"-version = "1.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b79834656f71332577234b50bfc009996f7449e0c056884e6a02492ded0ca2f3"-dependencies = [- "arrayref",- "arrayvec",- "constant_time_eq",-]--[[package]]-name = "block-buffer"-version = "0.10.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"-dependencies = [- "generic-array",-]--[[package]]-name = "block-buffer"-version = "0.12.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be"-dependencies = [- "hybrid-array",-]--[[package]]-name = "block-padding"-version = "0.3.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"-dependencies = [- "generic-array",-]--[[package]]-name = "bumpalo"-version = "3.19.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"--[[package]]-name = "bytes"-version = "1.11.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"--[[package]]-name = "cc"-version = "1.2.55"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"-dependencies = [- "find-msvc-tools",- "shlex",-]--[[package]]-name = "cfg-if"-version = "1.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"--[[package]]-name = "cfg_aliases"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"--[[package]]-name = "chacha20"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"-dependencies = [- "cfg-if",- "cipher",- "cpufeatures",-]--[[package]]-name = "cipher"-version = "0.4.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"-dependencies = [- "crypto-common 0.1.7",- "inout",- "zeroize",-]--[[package]]-name = "const-oid"-version = "0.10.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"--[[package]]-name = "constant_time_eq"-version = "0.4.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b"--[[package]]-name = "core-foundation"-version = "0.9.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"-dependencies = [- "core-foundation-sys",- "libc",-]--[[package]]-name = "core-foundation"-version = "0.10.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6"-dependencies = [- "core-foundation-sys",- "libc",-]--[[package]]-name = "core-foundation-sys"-version = "0.8.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"--[[package]]-name = "cpufeatures"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"-dependencies = [- "libc",-]--[[package]]-name = "crypto-common"-version = "0.1.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"-dependencies = [- "generic-array",- "rand_core 0.6.4",- "typenum",-]--[[package]]-name = "crypto-common"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710"-dependencies = [- "hybrid-array",-]--[[package]]-name = "crypto_secretstream"-version = "0.2.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9a6419214057ad50a13efccb3ad7714b86b848e3a5aa7b6cf5a3ff07edf387eb"-dependencies = [- "aead",- "chacha20",- "getrandom 0.2.17",- "poly1305",- "rand_core 0.6.4",- "subtle",-]--[[package]]-name = "curve25519-dalek"-version = "4.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"-dependencies = [- "cfg-if",- "cpufeatures",- "curve25519-dalek-derive",- "fiat-crypto",- "rustc_version",- "subtle",- "zeroize",-]--[[package]]-name = "curve25519-dalek-derive"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "digest"-version = "0.10.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"-dependencies = [- "block-buffer 0.10.4",- "crypto-common 0.1.7",- "subtle",-]--[[package]]-name = "digest"-version = "0.11.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4850db49bf08e663084f7fb5c87d202ef91a3907271aff24a94eb97ff039153c"-dependencies = [- "block-buffer 0.12.0",- "const-oid",- "crypto-common 0.2.1",-]--[[package]]-name = "displaydoc"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "encoding_rs"-version = "0.8.35"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"-dependencies = [- "cfg-if",-]--[[package]]-name = "ente-core"-version = "0.0.1"-dependencies = [- "argon2",- "base64",- "bip39",- "blake2b_simd",- "crypto_secretstream",- "getrandom 0.2.17",- "hex",- "md-5",- "rand_core 0.6.4",- "reqwest",- "salsa20",- "serde",- "serde_json",- "subtle",- "thiserror",- "x25519-dalek",- "xsalsa20poly1305",- "zeroize",-]--[[package]]-name = "ente_tvos_crypto_ffi"-version = "0.1.0"-dependencies = [- "ente-core",-]--[[package]]-name = "equivalent"-version = "1.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"--[[package]]-name = "fiat-crypto"-version = "0.2.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"--[[package]]-name = "find-msvc-tools"-version = "0.1.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"--[[package]]-name = "fnv"-version = "1.0.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"--[[package]]-name = "form_urlencoded"-version = "1.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"-dependencies = [- "percent-encoding",-]--[[package]]-name = "futures-channel"-version = "0.3.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"-dependencies = [- "futures-core",-]--[[package]]-name = "futures-core"-version = "0.3.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"--[[package]]-name = "futures-sink"-version = "0.3.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"--[[package]]-name = "futures-task"-version = "0.3.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"--[[package]]-name = "futures-util"-version = "0.3.31"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"-dependencies = [- "futures-core",- "futures-task",- "pin-project-lite",- "pin-utils",- "slab",-]--[[package]]-name = "generic-array"-version = "0.14.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"-dependencies = [- "typenum",- "version_check",-]--[[package]]-name = "getrandom"-version = "0.2.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"-dependencies = [- "cfg-if",- "js-sys",- "libc",- "wasi",- "wasm-bindgen",-]--[[package]]-name = "getrandom"-version = "0.3.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"-dependencies = [- "cfg-if",- "js-sys",- "libc",- "r-efi",- "wasip2",- "wasm-bindgen",-]--[[package]]-name = "h2"-version = "0.4.13"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54"-dependencies = [- "atomic-waker",- "bytes",- "fnv",- "futures-core",- "futures-sink",- "http",- "indexmap",- "slab",- "tokio",- "tokio-util",- "tracing",-]--[[package]]-name = "hashbrown"-version = "0.16.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"--[[package]]-name = "hex"-version = "0.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"--[[package]]-name = "hex-conservative"-version = "0.2.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f"-dependencies = [- "arrayvec",-]--[[package]]-name = "http"-version = "1.4.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"-dependencies = [- "bytes",- "itoa",-]--[[package]]-name = "http-body"-version = "1.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"-dependencies = [- "bytes",- "http",-]--[[package]]-name = "http-body-util"-version = "0.1.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a"-dependencies = [- "bytes",- "futures-core",- "http",- "http-body",- "pin-project-lite",-]--[[package]]-name = "httparse"-version = "1.10.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"--[[package]]-name = "hybrid-array"-version = "0.4.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3944cf8cf766b40e2a1a333ee5e9b563f854d5fa49d6a8ca2764e97c6eddb214"-dependencies = [- "typenum",-]--[[package]]-name = "hyper"-version = "1.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"-dependencies = [- "atomic-waker",- "bytes",- "futures-channel",- "futures-core",- "h2",- "http",- "http-body",- "httparse",- "itoa",- "pin-project-lite",- "pin-utils",- "smallvec",- "tokio",- "want",-]--[[package]]-name = "hyper-rustls"-version = "0.27.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58"-dependencies = [- "http",- "hyper",- "hyper-util",- "rustls",- "rustls-native-certs",- "rustls-pki-types",- "tokio",- "tokio-rustls",- "tower-service",- "webpki-roots",-]--[[package]]-name = "hyper-util"-version = "0.1.20"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"-dependencies = [- "base64",- "bytes",- "futures-channel",- "futures-util",- "http",- "http-body",- "hyper",- "ipnet",- "libc",- "percent-encoding",- "pin-project-lite",- "socket2",- "system-configuration",- "tokio",- "tower-service",- "tracing",- "windows-registry",-]--[[package]]-name = "icu_collections"-version = "2.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"-dependencies = [- "displaydoc",- "potential_utf",- "yoke",- "zerofrom",- "zerovec",-]--[[package]]-name = "icu_locale_core"-version = "2.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"-dependencies = [- "displaydoc",- "litemap",- "tinystr",- "writeable",- "zerovec",-]--[[package]]-name = "icu_normalizer"-version = "2.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"-dependencies = [- "icu_collections",- "icu_normalizer_data",- "icu_properties",- "icu_provider",- "smallvec",- "zerovec",-]--[[package]]-name = "icu_normalizer_data"-version = "2.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"--[[package]]-name = "icu_properties"-version = "2.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"-dependencies = [- "icu_collections",- "icu_locale_core",- "icu_properties_data",- "icu_provider",- "zerotrie",- "zerovec",-]--[[package]]-name = "icu_properties_data"-version = "2.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"--[[package]]-name = "icu_provider"-version = "2.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"-dependencies = [- "displaydoc",- "icu_locale_core",- "writeable",- "yoke",- "zerofrom",- "zerotrie",- "zerovec",-]--[[package]]-name = "idna"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"-dependencies = [- "idna_adapter",- "smallvec",- "utf8_iter",-]--[[package]]-name = "idna_adapter"-version = "1.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344"-dependencies = [- "icu_normalizer",- "icu_properties",-]--[[package]]-name = "indexmap"-version = "2.13.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"-dependencies = [- "equivalent",- "hashbrown",-]--[[package]]-name = "inout"-version = "0.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"-dependencies = [- "block-padding",- "generic-array",-]--[[package]]-name = "ipnet"-version = "2.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"--[[package]]-name = "iri-string"-version = "0.7.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a"-dependencies = [- "memchr",- "serde",-]--[[package]]-name = "itoa"-version = "1.0.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"--[[package]]-name = "js-sys"-version = "0.3.85"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"-dependencies = [- "once_cell",- "wasm-bindgen",-]--[[package]]-name = "libc"-version = "0.2.181"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5"--[[package]]-name = "litemap"-version = "0.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"--[[package]]-name = "log"-version = "0.4.29"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"--[[package]]-name = "lru-slab"-version = "0.1.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"--[[package]]-name = "md-5"-version = "0.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98"-dependencies = [- "cfg-if",- "digest 0.11.2",-]--[[package]]-name = "memchr"-version = "2.8.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"--[[package]]-name = "mime"-version = "0.3.17"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"--[[package]]-name = "mio"-version = "1.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"-dependencies = [- "libc",- "wasi",- "windows-sys 0.61.2",-]--[[package]]-name = "once_cell"-version = "1.21.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"--[[package]]-name = "opaque-debug"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"--[[package]]-name = "openssl-probe"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"--[[package]]-name = "password-hash"-version = "0.5.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166"-dependencies = [- "base64ct",- "rand_core 0.6.4",- "subtle",-]--[[package]]-name = "percent-encoding"-version = "2.3.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"--[[package]]-name = "pin-project-lite"-version = "0.2.16"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"--[[package]]-name = "pin-utils"-version = "0.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"--[[package]]-name = "poly1305"-version = "0.8.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"-dependencies = [- "cpufeatures",- "opaque-debug",- "universal-hash",-]--[[package]]-name = "potential_utf"-version = "0.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"-dependencies = [- "zerovec",-]--[[package]]-name = "ppv-lite86"-version = "0.2.21"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"-dependencies = [- "zerocopy",-]--[[package]]-name = "proc-macro2"-version = "1.0.106"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"-dependencies = [- "unicode-ident",-]--[[package]]-name = "quinn"-version = "0.11.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"-dependencies = [- "bytes",- "cfg_aliases",- "pin-project-lite",- "quinn-proto",- "quinn-udp",- "rustc-hash",- "rustls",- "socket2",- "thiserror",- "tokio",- "tracing",- "web-time",-]--[[package]]-name = "quinn-proto"-version = "0.11.13"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31"-dependencies = [- "bytes",- "getrandom 0.3.4",- "lru-slab",- "rand",- "ring",- "rustc-hash",- "rustls",- "rustls-pki-types",- "slab",- "thiserror",- "tinyvec",- "tracing",- "web-time",-]--[[package]]-name = "quinn-udp"-version = "0.5.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"-dependencies = [- "cfg_aliases",- "libc",- "once_cell",- "socket2",- "tracing",- "windows-sys 0.60.2",-]--[[package]]-name = "quote"-version = "1.0.44"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"-dependencies = [- "proc-macro2",-]--[[package]]-name = "r-efi"-version = "5.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"--[[package]]-name = "rand"-version = "0.9.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"-dependencies = [- "rand_chacha",- "rand_core 0.9.5",-]--[[package]]-name = "rand_chacha"-version = "0.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"-dependencies = [- "ppv-lite86",- "rand_core 0.9.5",-]--[[package]]-name = "rand_core"-version = "0.6.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"-dependencies = [- "getrandom 0.2.17",-]--[[package]]-name = "rand_core"-version = "0.9.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"-dependencies = [- "getrandom 0.3.4",-]--[[package]]-name = "reqwest"-version = "0.12.28"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"-dependencies = [- "base64",- "bytes",- "encoding_rs",- "futures-core",- "h2",- "http",- "http-body",- "http-body-util",- "hyper",- "hyper-rustls",- "hyper-util",- "js-sys",- "log",- "mime",- "percent-encoding",- "pin-project-lite",- "quinn",- "rustls",- "rustls-native-certs",- "rustls-pki-types",- "serde",- "serde_json",- "serde_urlencoded",- "sync_wrapper",- "tokio",- "tokio-rustls",- "tower",- "tower-http",- "tower-service",- "url",- "wasm-bindgen",- "wasm-bindgen-futures",- "web-sys",- "webpki-roots",-]--[[package]]-name = "ring"-version = "0.17.14"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"-dependencies = [- "cc",- "cfg-if",- "getrandom 0.2.17",- "libc",- "untrusted",- "windows-sys 0.52.0",-]--[[package]]-name = "rustc-hash"-version = "2.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"--[[package]]-name = "rustc_version"-version = "0.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"-dependencies = [- "semver",-]--[[package]]-name = "rustls"-version = "0.23.36"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b"-dependencies = [- "once_cell",- "ring",- "rustls-pki-types",- "rustls-webpki",- "subtle",- "zeroize",-]--[[package]]-name = "rustls-native-certs"-version = "0.8.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63"-dependencies = [- "openssl-probe",- "rustls-pki-types",- "schannel",- "security-framework",-]--[[package]]-name = "rustls-pki-types"-version = "1.14.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd"-dependencies = [- "web-time",- "zeroize",-]--[[package]]-name = "rustls-webpki"-version = "0.103.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53"-dependencies = [- "ring",- "rustls-pki-types",- "untrusted",-]--[[package]]-name = "rustversion"-version = "1.0.22"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"--[[package]]-name = "ryu"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"--[[package]]-name = "salsa20"-version = "0.10.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"-dependencies = [- "cipher",-]--[[package]]-name = "schannel"-version = "0.1.28"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1"-dependencies = [- "windows-sys 0.61.2",-]--[[package]]-name = "security-framework"-version = "3.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef"-dependencies = [- "bitflags",- "core-foundation 0.10.1",- "core-foundation-sys",- "libc",- "security-framework-sys",-]--[[package]]-name = "security-framework-sys"-version = "2.15.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0"-dependencies = [- "core-foundation-sys",- "libc",-]--[[package]]-name = "semver"-version = "1.0.27"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"--[[package]]-name = "serde"-version = "1.0.228"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"-dependencies = [- "serde_core",- "serde_derive",-]--[[package]]-name = "serde_core"-version = "1.0.228"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"-dependencies = [- "serde_derive",-]--[[package]]-name = "serde_derive"-version = "1.0.228"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "serde_json"-version = "1.0.149"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"-dependencies = [- "itoa",- "memchr",- "serde",- "serde_core",- "zmij",-]--[[package]]-name = "serde_urlencoded"-version = "0.7.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"-dependencies = [- "form_urlencoded",- "itoa",- "ryu",- "serde",-]--[[package]]-name = "shlex"-version = "1.3.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"--[[package]]-name = "slab"-version = "0.4.12"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"--[[package]]-name = "smallvec"-version = "1.15.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"--[[package]]-name = "socket2"-version = "0.6.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0"-dependencies = [- "libc",- "windows-sys 0.60.2",-]--[[package]]-name = "stable_deref_trait"-version = "1.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"--[[package]]-name = "subtle"-version = "2.6.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"--[[package]]-name = "syn"-version = "2.0.114"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"-dependencies = [- "proc-macro2",- "quote",- "unicode-ident",-]--[[package]]-name = "sync_wrapper"-version = "1.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"-dependencies = [- "futures-core",-]--[[package]]-name = "synstructure"-version = "0.13.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "system-configuration"-version = "0.7.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"-dependencies = [- "bitflags",- "core-foundation 0.9.4",- "system-configuration-sys",-]--[[package]]-name = "system-configuration-sys"-version = "0.6.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"-dependencies = [- "core-foundation-sys",- "libc",-]--[[package]]-name = "thiserror"-version = "2.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"-dependencies = [- "thiserror-impl",-]--[[package]]-name = "thiserror-impl"-version = "2.0.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "tinystr"-version = "0.8.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"-dependencies = [- "displaydoc",- "zerovec",-]--[[package]]-name = "tinyvec"-version = "1.10.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"-dependencies = [- "tinyvec_macros",-]--[[package]]-name = "tinyvec_macros"-version = "0.1.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"--[[package]]-name = "tokio"-version = "1.49.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86"-dependencies = [- "bytes",- "libc",- "mio",- "pin-project-lite",- "socket2",- "windows-sys 0.61.2",-]--[[package]]-name = "tokio-rustls"-version = "0.26.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61"-dependencies = [- "rustls",- "tokio",-]--[[package]]-name = "tokio-util"-version = "0.7.18"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"-dependencies = [- "bytes",- "futures-core",- "futures-sink",- "pin-project-lite",- "tokio",-]--[[package]]-name = "tower"-version = "0.5.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"-dependencies = [- "futures-core",- "futures-util",- "pin-project-lite",- "sync_wrapper",- "tokio",- "tower-layer",- "tower-service",-]--[[package]]-name = "tower-http"-version = "0.6.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"-dependencies = [- "bitflags",- "bytes",- "futures-util",- "http",- "http-body",- "iri-string",- "pin-project-lite",- "tower",- "tower-layer",- "tower-service",-]--[[package]]-name = "tower-layer"-version = "0.3.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"--[[package]]-name = "tower-service"-version = "0.3.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"--[[package]]-name = "tracing"-version = "0.1.44"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"-dependencies = [- "pin-project-lite",- "tracing-core",-]--[[package]]-name = "tracing-core"-version = "0.1.36"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"-dependencies = [- "once_cell",-]--[[package]]-name = "try-lock"-version = "0.2.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"--[[package]]-name = "typenum"-version = "1.19.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"--[[package]]-name = "unicode-ident"-version = "1.0.23"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e"--[[package]]-name = "unicode-normalization"-version = "0.1.25"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"-dependencies = [- "tinyvec",-]--[[package]]-name = "universal-hash"-version = "0.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"-dependencies = [- "crypto-common 0.1.7",- "subtle",-]--[[package]]-name = "untrusted"-version = "0.9.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"--[[package]]-name = "url"-version = "2.5.8"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"-dependencies = [- "form_urlencoded",- "idna",- "percent-encoding",- "serde",-]--[[package]]-name = "utf8_iter"-version = "1.0.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"--[[package]]-name = "version_check"-version = "0.9.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"--[[package]]-name = "want"-version = "0.3.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"-dependencies = [- "try-lock",-]--[[package]]-name = "wasi"-version = "0.11.1+wasi-snapshot-preview1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"--[[package]]-name = "wasip2"-version = "1.0.2+wasi-0.2.9"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"-dependencies = [- "wit-bindgen",-]--[[package]]-name = "wasm-bindgen"-version = "0.2.108"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"-dependencies = [- "cfg-if",- "once_cell",- "rustversion",- "wasm-bindgen-macro",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-futures"-version = "0.4.58"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f"-dependencies = [- "cfg-if",- "futures-util",- "js-sys",- "once_cell",- "wasm-bindgen",- "web-sys",-]--[[package]]-name = "wasm-bindgen-macro"-version = "0.2.108"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"-dependencies = [- "quote",- "wasm-bindgen-macro-support",-]--[[package]]-name = "wasm-bindgen-macro-support"-version = "0.2.108"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"-dependencies = [- "bumpalo",- "proc-macro2",- "quote",- "syn",- "wasm-bindgen-shared",-]--[[package]]-name = "wasm-bindgen-shared"-version = "0.2.108"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"-dependencies = [- "unicode-ident",-]--[[package]]-name = "web-sys"-version = "0.3.85"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598"-dependencies = [- "js-sys",- "wasm-bindgen",-]--[[package]]-name = "web-time"-version = "1.1.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"-dependencies = [- "js-sys",- "wasm-bindgen",-]--[[package]]-name = "webpki-roots"-version = "1.0.7"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"-dependencies = [- "rustls-pki-types",-]--[[package]]-name = "windows-link"-version = "0.2.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"--[[package]]-name = "windows-registry"-version = "0.6.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"-dependencies = [- "windows-link",- "windows-result",- "windows-strings",-]--[[package]]-name = "windows-result"-version = "0.4.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-strings"-version = "0.5.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-sys"-version = "0.52.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"-dependencies = [- "windows-targets 0.52.6",-]--[[package]]-name = "windows-sys"-version = "0.60.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"-dependencies = [- "windows-targets 0.53.5",-]--[[package]]-name = "windows-sys"-version = "0.61.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"-dependencies = [- "windows-link",-]--[[package]]-name = "windows-targets"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"-dependencies = [- "windows_aarch64_gnullvm 0.52.6",- "windows_aarch64_msvc 0.52.6",- "windows_i686_gnu 0.52.6",- "windows_i686_gnullvm 0.52.6",- "windows_i686_msvc 0.52.6",- "windows_x86_64_gnu 0.52.6",- "windows_x86_64_gnullvm 0.52.6",- "windows_x86_64_msvc 0.52.6",-]--[[package]]-name = "windows-targets"-version = "0.53.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"-dependencies = [- "windows-link",- "windows_aarch64_gnullvm 0.53.1",- "windows_aarch64_msvc 0.53.1",- "windows_i686_gnu 0.53.1",- "windows_i686_gnullvm 0.53.1",- "windows_i686_msvc 0.53.1",- "windows_x86_64_gnu 0.53.1",- "windows_x86_64_gnullvm 0.53.1",- "windows_x86_64_msvc 0.53.1",-]--[[package]]-name = "windows_aarch64_gnullvm"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"--[[package]]-name = "windows_aarch64_gnullvm"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"--[[package]]-name = "windows_aarch64_msvc"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"--[[package]]-name = "windows_aarch64_msvc"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"--[[package]]-name = "windows_i686_gnu"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"--[[package]]-name = "windows_i686_gnu"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"--[[package]]-name = "windows_i686_gnullvm"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"--[[package]]-name = "windows_i686_gnullvm"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"--[[package]]-name = "windows_i686_msvc"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"--[[package]]-name = "windows_i686_msvc"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"--[[package]]-name = "windows_x86_64_gnu"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"--[[package]]-name = "windows_x86_64_gnu"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"--[[package]]-name = "windows_x86_64_gnullvm"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"--[[package]]-name = "windows_x86_64_gnullvm"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"--[[package]]-name = "windows_x86_64_msvc"-version = "0.52.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"--[[package]]-name = "windows_x86_64_msvc"-version = "0.53.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"--[[package]]-name = "wit-bindgen"-version = "0.51.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"--[[package]]-name = "writeable"-version = "0.6.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"--[[package]]-name = "x25519-dalek"-version = "2.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277"-dependencies = [- "curve25519-dalek",- "rand_core 0.6.4",- "serde",- "zeroize",-]--[[package]]-name = "xsalsa20poly1305"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "02a6dad357567f81cd78ee75f7c61f1b30bb2fe4390be8fb7c69e2ac8dffb6c7"-dependencies = [- "aead",- "poly1305",- "salsa20",- "subtle",- "zeroize",-]--[[package]]-name = "yoke"-version = "0.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"-dependencies = [- "stable_deref_trait",- "yoke-derive",- "zerofrom",-]--[[package]]-name = "yoke-derive"-version = "0.8.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"-dependencies = [- "proc-macro2",- "quote",- "syn",- "synstructure",-]--[[package]]-name = "zerocopy"-version = "0.8.39"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"-dependencies = [- "zerocopy-derive",-]--[[package]]-name = "zerocopy-derive"-version = "0.8.39"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "zerofrom"-version = "0.1.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"-dependencies = [- "zerofrom-derive",-]--[[package]]-name = "zerofrom-derive"-version = "0.1.6"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"-dependencies = [- "proc-macro2",- "quote",- "syn",- "synstructure",-]--[[package]]-name = "zeroize"-version = "1.8.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"-dependencies = [- "zeroize_derive",-]--[[package]]-name = "zeroize_derive"-version = "1.4.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "zerotrie"-version = "0.2.3"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"-dependencies = [- "displaydoc",- "yoke",- "zerofrom",-]--[[package]]-name = "zerovec"-version = "0.11.5"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"-dependencies = [- "yoke",- "zerofrom",- "zerovec-derive",-]--[[package]]-name = "zerovec-derive"-version = "0.11.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"-dependencies = [- "proc-macro2",- "quote",- "syn",-]--[[package]]-name = "zmij"-version = "1.0.20"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4de98dfa5d5b7fef4ee834d0073d560c9ca7b6c46a71d058c48db7960f8cfaf7"diff --git a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/Cargo.toml b/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/Cargo.tomldeleted file mode 100644index 557025cda9..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/Cargo.toml+++ /dev/null@@ -1,10 +0,0 @@-[package]-name = "ente_tvos_crypto_ffi"-version = "0.1.0"-edition = "2024"--[lib]-crate-type = ["staticlib", "cdylib"]--[dependencies]-ente-core = { path = "../../../../../../../rust/crates/core" }diff --git a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/build-xcframework.sh b/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/build-xcframework.shdeleted file mode 100755index d99c35134e..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/build-xcframework.sh+++ /dev/null@@ -1,101 +0,0 @@-#!/usr/bin/env bash-set -euo pipefail--SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"-ENCRYPTO_DIR="$(cd "${SCRIPT_DIR}/../.." && pwd)"-CRATE_DIR="${SCRIPT_DIR}"-BINARY_DIR="${ENCRYPTO_DIR}/Binaries"-XCFRAMEWORK_DIR="${BINARY_DIR}/EnteRustCryptoFFI.xcframework"-HEADER_DIR="${CRATE_DIR}/include"-TARGET_DIR="${CRATE_DIR}/target"-LIB_NAME="libente_tvos_crypto_ffi.a"-WORK_DIR="${TARGET_DIR}/xcframework-build"-FALLBACK_TOOLCHAIN="nightly"--IOS_DEVICE_TARGET="aarch64-apple-ios"-IOS_SIM_ARM_TARGET="aarch64-apple-ios-sim"-IOS_SIM_X86_TARGET="x86_64-apple-ios"-TVOS_DEVICE_TARGET="aarch64-apple-tvos"-TVOS_SIM_ARM_TARGET="aarch64-apple-tvos-sim"-TVOS_SIM_X86_TARGET="x86_64-apple-tvos"-MACOS_ARM_TARGET="aarch64-apple-darwin"-MACOS_X86_TARGET="x86_64-apple-darwin"--for tool in cargo rustup xcodebuild lipo; do- if ! command -v "${tool}" >/dev/null 2>&1; then- echo "error: required tool not found: ${tool}" >&2- exit 1- fi-done--TARGETS=(- "${IOS_DEVICE_TARGET}"- "${IOS_SIM_ARM_TARGET}"- "${IOS_SIM_X86_TARGET}"- "${TVOS_DEVICE_TARGET}"- "${TVOS_SIM_ARM_TARGET}"- "${TVOS_SIM_X86_TARGET}"- "${MACOS_ARM_TARGET}"- "${MACOS_X86_TARGET}"-)--nightly_ready=0-build_target() {- local target="$1"-- if rustup target add "${target}" >/dev/null 2>&1; then- cargo build --manifest-path "${CRATE_DIR}/Cargo.toml" --release --target "${target}"- return- fi-- if [[ "${nightly_ready}" -eq 0 ]]; then- echo "==> Falling back to ${FALLBACK_TOOLCHAIN} with build-std for unsupported Apple targets"- rustup toolchain install "${FALLBACK_TOOLCHAIN}" --profile minimal- rustup component add rust-src --toolchain "${FALLBACK_TOOLCHAIN}"- nightly_ready=1- fi-- cargo +"${FALLBACK_TOOLCHAIN}" build -Z build-std --manifest-path "${CRATE_DIR}/Cargo.toml" --release --target "${target}"-}--echo "==> Building static libraries"-for target in "${TARGETS[@]}"; do- echo " -> ${target}"- build_target "${target}"-done--mkdir -p "${WORK_DIR}"--IOS_SIM_LIB="${WORK_DIR}/libente_tvos_crypto_ffi-iossim.a"-TVOS_SIM_LIB="${WORK_DIR}/libente_tvos_crypto_ffi-tvossim.a"-MACOS_UNIVERSAL_LIB="${WORK_DIR}/libente_tvos_crypto_ffi-macos.a"--echo "==> Creating universal simulator and macOS slices"-lipo -create \- -output "${IOS_SIM_LIB}" \- "${TARGET_DIR}/${IOS_SIM_ARM_TARGET}/release/${LIB_NAME}" \- "${TARGET_DIR}/${IOS_SIM_X86_TARGET}/release/${LIB_NAME}"--lipo -create \- -output "${TVOS_SIM_LIB}" \- "${TARGET_DIR}/${TVOS_SIM_ARM_TARGET}/release/${LIB_NAME}" \- "${TARGET_DIR}/${TVOS_SIM_X86_TARGET}/release/${LIB_NAME}"--lipo -create \- -output "${MACOS_UNIVERSAL_LIB}" \- "${TARGET_DIR}/${MACOS_ARM_TARGET}/release/${LIB_NAME}" \- "${TARGET_DIR}/${MACOS_X86_TARGET}/release/${LIB_NAME}"--mkdir -p "${BINARY_DIR}"-rm -rf "${XCFRAMEWORK_DIR}"--echo "==> Building EnteRustCryptoFFI.xcframework"-xcodebuild -create-xcframework \- -library "${TARGET_DIR}/${IOS_DEVICE_TARGET}/release/${LIB_NAME}" -headers "${HEADER_DIR}" \- -library "${IOS_SIM_LIB}" -headers "${HEADER_DIR}" \- -library "${TARGET_DIR}/${TVOS_DEVICE_TARGET}/release/${LIB_NAME}" -headers "${HEADER_DIR}" \- -library "${TVOS_SIM_LIB}" -headers "${HEADER_DIR}" \- -library "${MACOS_UNIVERSAL_LIB}" -headers "${HEADER_DIR}" \- -output "${XCFRAMEWORK_DIR}"--echo "==> Done: ${XCFRAMEWORK_DIR}"diff --git a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/include/ente_tvos_crypto_ffi.h b/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/include/ente_tvos_crypto_ffi.hdeleted file mode 100644index e0167907fd..0000000000--- a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/include/ente_tvos_crypto_ffi.h+++ /dev/null@@ -1,68 +0,0 @@-#ifndef ENTE_TVOS_CRYPTO_FFI_H-#define ENTE_TVOS_CRYPTO_FFI_H--#include <stdint.h>--#ifdef __cplusplus-extern "C" {-#endif--void ente_tvos_crypto_string_free(char *ptr);--int32_t ente_tvos_crypto_generate_keypair_b64(- char **out_public_key_b64,- char **out_secret_key_b64,- char **out_error-);--int32_t ente_tvos_crypto_derive_argon_key_b64(- const char *password_utf8,- const char *salt_b64,- uint32_t mem_limit,- uint32_t ops_limit,- char **out_key_b64,- char **out_error-);--int32_t ente_tvos_crypto_derive_login_key_b64(- const char *key_enc_key_b64,- char **out_login_key_b64,- char **out_error-);--int32_t ente_tvos_crypto_secretbox_open_b64(- const char *ciphertext_b64,- const char *nonce_b64,- const char *key_b64,- char **out_plaintext_b64,- char **out_error-);--int32_t ente_tvos_crypto_sealed_box_open_b64(- const char *ciphertext_b64,- const char *public_key_b64,- const char *secret_key_b64,- char **out_plaintext_b64,- char **out_error-);--int32_t ente_tvos_crypto_secretstream_decrypt_b64(- const char *encrypted_data_b64,- const char *decryption_header_b64,- const char *key_b64,- char **out_plaintext_b64,- char **out_error-);--int32_t ente_tvos_crypto_blake2b_hash_hex(- const uint8_t *data_ptr,- uintptr_t data_len,- char **out_hash_hex,- char **out_error-);--#ifdef __cplusplus-}-#endif--#endifdiff --git a/mobile/native/darwin/darwin.xcworkspace/contents.xcworkspacedata b/mobile/native/darwin/darwin.xcworkspace/contents.xcworkspacedataindex b33d31aa1b..8bc88fa8e1 100644--- a/mobile/native/darwin/darwin.xcworkspace/contents.xcworkspacedata+++ b/mobile/native/darwin/darwin.xcworkspace/contents.xcworkspacedata@@ -120,9 +120,6 @@<FileReflocation = "group:EnteNetwork"></FileRef>- <FileRef- location = "group:EnteCast">- </FileRef><Grouplocation = "group:EnteConfiguration"name = "EnteConfiguration">@@ -134,8 +131,5 @@<FileReflocation = "group:EnteCore"></FileRef>- <FileRef- location = "group:EnteCrypto">- </FileRef></Group></Workspace>diff --git a/mobile/native/darwin/darwin.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mobile/native/darwin/darwin.xcworkspace/xcshareddata/swiftpm/Package.resolvedindex 610ef04085..e588ae5bb8 100644--- a/mobile/native/darwin/darwin.xcworkspace/xcshareddata/swiftpm/Package.resolved+++ b/mobile/native/darwin/darwin.xcworkspace/xcshareddata/swiftpm/Package.resolved@@ -1,14 +1,5 @@{"pins" : [- {- "identity" : "bigint",- "kind" : "remoteSourceControl",- "location" : "https://github.com/attaswift/BigInt.git",- "state" : {- "revision" : "e07e00fa1fd435143a2dcf8b7eec9a7710b2fdfe",- "version" : "5.7.0"- }- },{"identity" : "rive-ios","kind" : "remoteSourceControl",@@ -18,15 +9,6 @@"version" : "6.16.0"}},- {- "identity" : "swift-asn1",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-asn1.git",- "state" : {- "revision" : "f70225981241859eb4aa1a18a75531d26637c8cc",- "version" : "1.4.0"- }- },{"identity" : "swift-cmark","kind" : "remoteSourceControl",@@ -36,15 +18,6 @@"version" : "0.7.1"}},- {- "identity" : "swift-crypto",- "kind" : "remoteSourceControl",- "location" : "https://github.com/apple/swift-crypto.git",- "state" : {- "revision" : "d1c6b70f7c5f19fb0b8750cb8dcdf2ea6e2d8c34",- "version" : "3.15.0"- }- },{"identity" : "swift-log","kind" : "remoteSourceControl",diff --git a/rust/Cargo.lock b/rust/Cargo.lockindex 7527cedbe4..c83019600d 100644--- a/rust/Cargo.lock+++ b/rust/Cargo.lock@@ -2325,6 +2325,13 @@ dependencies = ["wasm-bindgen-futures",]+[[package]]+name = "ente_crypto_ffi"+version = "0.1.0"+dependencies = [+ "ente-core",+]+[[package]]name = "ente_image"version = "0.1.0"diff --git a/rust/Cargo.toml b/rust/Cargo.tomlindex 4b803fc9ad..cfe720b450 100644--- a/rust/Cargo.toml+++ b/rust/Cargo.toml@@ -4,6 +4,7 @@ members = ["apps/cli","apps/codegen","apps/ensu/src-tauri",+ "bindings/ffi/crypto","bindings/uniffi/core","bindings/uniffi/ensu/db","bindings/uniffi/ensu/inference",diff --git a/rust/bindings/ffi/crypto/Cargo.toml b/rust/bindings/ffi/crypto/Cargo.tomlnew file mode 100644index 0000000000..ebe735fa98--- /dev/null+++ b/rust/bindings/ffi/crypto/Cargo.toml@@ -0,0 +1,10 @@+[package]+name = "ente_crypto_ffi"+version = "0.1.0"+edition = "2024"++[lib]+crate-type = ["staticlib"]++[dependencies]+ente-core = { path = "../../../crates/core" }diff --git a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/src/lib.rs b/rust/bindings/ffi/crypto/src/lib.rssimilarity index 55%rename from mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/src/lib.rsrename to rust/bindings/ffi/crypto/src/lib.rsindex d0ed2c8af1..be13ebdea4 100644--- a/mobile/native/darwin/Packages/EnteCrypto/rust/tvos-crypto-ffi/src/lib.rs+++ b/rust/bindings/ffi/crypto/src/lib.rs@@ -1,6 +1,5 @@use std::ffi::{CStr, CString};use std::os::raw::{c_char, c_int};-use std::panic::{self, UnwindSafe};use std::ptr;use ente_core::crypto;@@ -8,20 +7,11 @@ use ente_core::crypto;const STATUS_OK: c_int = 0;const STATUS_ERROR: c_int = 1;-fn sanitize_c_string(input: String) -> String {- let mut output = input.replace('\0', " ");- if output.is_empty() {- output = "unknown error".to_owned();- }- output-}-fn clear_error(out_error: *mut *mut c_char) {- if out_error.is_null() {- return;- }- unsafe {- *out_error = ptr::null_mut();+ if !out_error.is_null() {+ unsafe {+ *out_error = ptr::null_mut();+ }}}@@ -30,28 +20,21 @@ fn write_error(out_error: *mut *mut c_char, message: impl Into<String>) {return;}- let message = sanitize_c_string(message.into());- let c_message = CString::new(message)- .unwrap_or_else(|_| CString::new("failed to construct error message").unwrap());+ let c_message = CString::new(message.into().replace('\0', " ")).unwrap();unsafe {*out_error = c_message.into_raw();}}-fn run_ffi(out_error: *mut *mut c_char, f: impl FnOnce() -> Result<(), String> + UnwindSafe) -> c_int {+fn run_ffi(out_error: *mut *mut c_char, f: impl FnOnce() -> Result<(), String>) -> c_int {clear_error(out_error);- match panic::catch_unwind(f) {- Ok(Ok(())) => STATUS_OK,- Ok(Err(message)) => {- write_error(out_error, message);- STATUS_ERROR- }- Err(_) => {- write_error(out_error, "panic in Rust crypto FFI");- STATUS_ERROR- }+ if let Err(message) = f() {+ write_error(out_error, message);+ STATUS_ERROR+ } else {+ STATUS_OK}}@@ -66,13 +49,16 @@ unsafe fn c_input(input: *const c_char, field_name: &str) -> Result<String, Stri.map_err(|_| format!("{field_name} is not valid UTF-8"))}-unsafe fn c_output(output: *mut *mut c_char, value: String, field_name: &str) -> Result<(), String> {+unsafe fn c_output(+ output: *mut *mut c_char,+ value: String,+ field_name: &str,+) -> Result<(), String> {if output.is_null() {return Err(format!("{field_name} is null"));}- let value = sanitize_c_string(value);- let c_value = CString::new(value).map_err(|_| format!("{field_name} contains interior NUL"))?;+ let c_value = CString::new(value).map_err(|_| format!("{field_name} contains NUL"))?;unsafe {*output = c_value.into_raw();}@@ -83,25 +69,35 @@ fn decode_b64(input: &str, field_name: &str) -> Result<Vec<u8>, String> {crypto::decode_b64(input).map_err(|e| format!("{field_name}: {e}"))}+/// Frees a string returned by this library.+///+/// # Safety+///+/// `ptr` must be null or a pointer returned by an `ente_crypto_*` function.#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_string_free(ptr: *mut c_char) {- if ptr.is_null() {- return;- }-- unsafe {- drop(CString::from_raw(ptr));+pub unsafe extern "C" fn ente_crypto_string_free(ptr: *mut c_char) {+ if !ptr.is_null() {+ unsafe {+ drop(CString::from_raw(ptr));+ }}}+/// Generates a public/secret keypair and returns both keys as base64 strings.+///+/// # Safety+///+/// Output pointers must be valid writable string slots. Returned strings must+/// be freed with `ente_crypto_string_free`.#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_generate_keypair_b64(+pub unsafe extern "C" fn ente_crypto_generate_keypair_b64(out_public_key_b64: *mut *mut c_char,out_secret_key_b64: *mut *mut c_char,out_error: *mut *mut c_char,) -> c_int {run_ffi(out_error, || {- let (public_key, secret_key) = crypto::keys::generate_keypair().map_err(|e| e.to_string())?;+ let (public_key, secret_key) =+ crypto::keys::generate_keypair().map_err(|e| e.to_string())?;unsafe {c_output(out_public_key_b64,@@ -118,61 +114,15 @@ pub extern "C" fn ente_tvos_crypto_generate_keypair_b64(})}+/// Decrypts a SecretBox payload and returns the plaintext as a base64 string.+///+/// # Safety+///+/// Input pointers must be non-null, valid UTF-8 C strings. Output pointers must+/// be valid writable string slots. Returned strings must be freed with+/// `ente_crypto_string_free`.#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_derive_argon_key_b64(- password_utf8: *const c_char,- salt_b64: *const c_char,- mem_limit: u32,- ops_limit: u32,- out_key_b64: *mut *mut c_char,- out_error: *mut *mut c_char,-) -> c_int {- run_ffi(out_error, || {- let (password, salt_b64) = unsafe {- (- c_input(password_utf8, "password_utf8")?,- c_input(salt_b64, "salt_b64")?,- )- };-- let salt = decode_b64(&salt_b64, "salt_b64")?;- let key = crypto::argon::derive_key(&password, &salt, mem_limit, ops_limit)- .map_err(|e| e.to_string())?;-- unsafe {- c_output(out_key_b64, crypto::encode_b64(&key), "out_key_b64")?;- }-- Ok(())- })-}--#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_derive_login_key_b64(- key_enc_key_b64: *const c_char,- out_login_key_b64: *mut *mut c_char,- out_error: *mut *mut c_char,-) -> c_int {- run_ffi(out_error, || {- let key_enc_key_b64 = unsafe { c_input(key_enc_key_b64, "key_enc_key_b64")? };- let key_enc_key = decode_b64(&key_enc_key_b64, "key_enc_key_b64")?;-- let login_key = crypto::kdf::derive_login_key(&key_enc_key).map_err(|e| e.to_string())?;-- unsafe {- c_output(- out_login_key_b64,- crypto::encode_b64(&login_key),- "out_login_key_b64",- )?;- }-- Ok(())- })-}--#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_secretbox_open_b64(+pub unsafe extern "C" fn ente_crypto_secretbox_open_b64(ciphertext_b64: *const c_char,nonce_b64: *const c_char,key_b64: *const c_char,@@ -187,13 +137,11 @@ pub extern "C" fn ente_tvos_crypto_secretbox_open_b64(c_input(key_b64, "key_b64")?,)};-let ciphertext = decode_b64(&ciphertext_b64, "ciphertext_b64")?;let nonce = decode_b64(&nonce_b64, "nonce_b64")?;let key = decode_b64(&key_b64, "key_b64")?;-- let plaintext = crypto::secretbox::decrypt(&ciphertext, &nonce, &key)- .map_err(|e| e.to_string())?;+ let plaintext =+ crypto::secretbox::decrypt(&ciphertext, &nonce, &key).map_err(|e| e.to_string())?;unsafe {c_output(@@ -202,13 +150,19 @@ pub extern "C" fn ente_tvos_crypto_secretbox_open_b64("out_plaintext_b64",)?;}-Ok(())})}+/// Decrypts a SealedBox payload and returns the plaintext as a base64 string.+///+/// # Safety+///+/// Input pointers must be non-null, valid UTF-8 C strings. Output pointers must+/// be valid writable string slots. Returned strings must be freed with+/// `ente_crypto_string_free`.#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_sealed_box_open_b64(+pub unsafe extern "C" fn ente_crypto_sealed_box_open_b64(ciphertext_b64: *const c_char,public_key_b64: *const c_char,secret_key_b64: *const c_char,@@ -223,11 +177,9 @@ pub extern "C" fn ente_tvos_crypto_sealed_box_open_b64(c_input(secret_key_b64, "secret_key_b64")?,)};-let ciphertext = decode_b64(&ciphertext_b64, "ciphertext_b64")?;let public_key = decode_b64(&public_key_b64, "public_key_b64")?;let secret_key = decode_b64(&secret_key_b64, "secret_key_b64")?;-let plaintext = crypto::sealed::open(&ciphertext, &public_key, &secret_key).map_err(|e| e.to_string())?;@@ -238,13 +190,19 @@ pub extern "C" fn ente_tvos_crypto_sealed_box_open_b64("out_plaintext_b64",)?;}-Ok(())})}+/// Decrypts a secretstream payload and returns the plaintext as a base64 string.+///+/// # Safety+///+/// Input pointers must be non-null, valid UTF-8 C strings. Output pointers must+/// be valid writable string slots. Returned strings must be freed with+/// `ente_crypto_string_free`.#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_secretstream_decrypt_b64(+pub unsafe extern "C" fn ente_crypto_secretstream_decrypt_b64(encrypted_data_b64: *const c_char,decryption_header_b64: *const c_char,key_b64: *const c_char,@@ -259,13 +217,12 @@ pub extern "C" fn ente_tvos_crypto_secretstream_decrypt_b64(c_input(key_b64, "key_b64")?,)};-let encrypted_data = decode_b64(&encrypted_data_b64, "encrypted_data_b64")?;let decryption_header = decode_b64(&decryption_header_b64, "decryption_header_b64")?;let key = decode_b64(&key_b64, "key_b64")?;-- let plaintext = crypto::stream::decrypt_file_data(&encrypted_data, &decryption_header, &key)- .map_err(|e| e.to_string())?;+ let plaintext =+ crypto::stream::decrypt_file_data(&encrypted_data, &decryption_header, &key)+ .map_err(|e| e.to_string())?;unsafe {c_output(@@ -274,31 +231,6 @@ pub extern "C" fn ente_tvos_crypto_secretstream_decrypt_b64("out_plaintext_b64",)?;}-- Ok(())- })-}--#[unsafe(no_mangle)]-pub extern "C" fn ente_tvos_crypto_blake2b_hash_hex(- data_ptr: *const u8,- data_len: usize,- out_hash_hex: *mut *mut c_char,- out_error: *mut *mut c_char,-) -> c_int {- run_ffi(out_error, || {- if data_ptr.is_null() {- return Err("data_ptr is null".to_owned());- }-- let data = unsafe { std::slice::from_raw_parts(data_ptr, data_len) };- let hash = crypto::hash::hash(data, Some(64), None).map_err(|e| e.to_string())?;- let hash_hex = crypto::encode_hex(&hash);-- unsafe {- c_output(out_hash_hex, hash_hex, "out_hash_hex")?;- }-Ok(())})}