diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index 62b4f4d4..b02f1a24 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -54,26 +54,26 @@ public struct ClientOptions { /// `preCreateIdentityCallback` will be called immediately before a Create Identity wallet signature is requested from the user. public var preCreateIdentityCallback: PreEventCallback? - public var mlsAlpha = false - public var mlsEncryptionKey: Data? - public var mlsDbDirectory: String? + public var enableV3 = false + public var dbEncryptionKey: Data? + public var dbDirectory: String? public init( api: Api = Api(), codecs: [any ContentCodec] = [], preEnableIdentityCallback: PreEventCallback? = nil, preCreateIdentityCallback: PreEventCallback? = nil, - mlsAlpha: Bool = false, - mlsEncryptionKey: Data? = nil, - mlsDbDirectory: String? = nil + enableV3: Bool = false, + encryptionKey: Data? = nil, + dbDirectory: String? = nil ) { self.api = api self.codecs = codecs self.preEnableIdentityCallback = preEnableIdentityCallback self.preCreateIdentityCallback = preCreateIdentityCallback - self.mlsAlpha = mlsAlpha - self.mlsEncryptionKey = mlsEncryptionKey - self.mlsDbDirectory = mlsDbDirectory + self.enableV3 = enableV3 + self.dbEncryptionKey = encryptionKey + self.dbDirectory = dbDirectory } } @@ -135,7 +135,7 @@ public final class Client { privateKeyBundleV1: PrivateKeyBundleV1, signingKey: SigningKey? ) async throws -> (FfiXmtpClient?, String) { - if options?.mlsAlpha == true, options?.api.env.supportsMLS == true { + if options?.enableV3 == true { let address = accountAddress.lowercased() var inboxId: String @@ -150,7 +150,7 @@ public final class Client { inboxId = generateInboxId(accountAddress: address, nonce: 0) } - let mlsDbDirectory = options?.mlsDbDirectory + let mlsDbDirectory = options?.dbDirectory var directoryURL: URL if let mlsDbDirectory = mlsDbDirectory { let fileManager = FileManager.default @@ -170,7 +170,7 @@ public final class Client { let alias = "xmtp-\(options?.api.env.rawValue ?? "")-\(inboxId).db3" let dbURL = directoryURL.appendingPathComponent(alias).path - let encryptionKey = options?.mlsEncryptionKey + let encryptionKey = options?.dbEncryptionKey let v3Client = try await LibXMTP.createClient( logger: XMTPLogger(), diff --git a/Sources/XMTPiOS/XMTPEnvironment.swift b/Sources/XMTPiOS/XMTPEnvironment.swift index 4f12c8d2..c34d2831 100644 --- a/Sources/XMTPiOS/XMTPEnvironment.swift +++ b/Sources/XMTPiOS/XMTPEnvironment.swift @@ -24,10 +24,6 @@ public enum XMTPEnvironment: String, Sendable { } } - public var supportsMLS: Bool { - self != .production - } - public var isSecure: Bool { url.starts(with: "https") } diff --git a/Tests/XMTPTests/ClientTests.swift b/Tests/XMTPTests/ClientTests.swift index bba2de24..9fa2e78e 100644 --- a/Tests/XMTPTests/ClientTests.swift +++ b/Tests/XMTPTests/ClientTests.swift @@ -29,8 +29,8 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) } catch { @@ -45,8 +45,8 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) @@ -56,15 +56,15 @@ class ClientTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), // Should not need to pass the signer again - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) XCTAssertEqual(client.address, otherClient.address) } - func testPassingMLSEncryptionKey() async throws { + func testPassingencryptionKey() async throws { let bo = try PrivateKey.generate() let key = try Crypto.secureRandomBytes(count: 32) @@ -72,8 +72,8 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) @@ -82,8 +82,8 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: nil // No key should error + enableV3: true, + encryptionKey: nil // No key should error ) ) @@ -100,7 +100,7 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true + enableV3: true ) ) @@ -108,7 +108,7 @@ class ClientTests: XCTestCase { account: alix, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true + enableV3: true ) ) @@ -124,7 +124,7 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true + enableV3: true ) ) @@ -140,7 +140,7 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true + enableV3: true ) ) @@ -148,7 +148,7 @@ class ClientTests: XCTestCase { account: alix, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true + enableV3: true ) ) @@ -285,7 +285,7 @@ class ClientTests: XCTestCase { } } - func testPassingMLSEncryptionKeyAndDatabaseDirectory() async throws { + func testPassingencryptionKeyAndDatabaseDirectory() async throws { let bo = try PrivateKey.generate() let key = try Crypto.secureRandomBytes(count: 32) @@ -293,9 +293,9 @@ class ClientTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key, - mlsDbDirectory: "xmtp_db" + enableV3: true, + encryptionKey: key, + dbDirectory: "xmtp_db" ) ) @@ -304,9 +304,9 @@ class ClientTests: XCTestCase { bundle: keys, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key, - mlsDbDirectory: "xmtp_db" + enableV3: true, + encryptionKey: key, + dbDirectory: "xmtp_db" ) ) @@ -319,9 +319,9 @@ class ClientTests: XCTestCase { bundle: keys, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: nil, - mlsDbDirectory: "xmtp_db" + enableV3: true, + encryptionKey: nil, + dbDirectory: "xmtp_db" ) ) ) @@ -331,9 +331,9 @@ class ClientTests: XCTestCase { bundle: keys, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key, - mlsDbDirectory: nil + enableV3: true, + encryptionKey: key, + dbDirectory: nil ) ) ) diff --git a/Tests/XMTPTests/FramesTests.swift b/Tests/XMTPTests/FramesTests.swift index f0bf567f..94828061 100644 --- a/Tests/XMTPTests/FramesTests.swift +++ b/Tests/XMTPTests/FramesTests.swift @@ -20,8 +20,8 @@ final class FramesTests: XCTestCase { account: bo, options: .init( api: .init(env: .local, isSecure: false), - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) diff --git a/Tests/XMTPTests/GroupPermissionsTests.swift b/Tests/XMTPTests/GroupPermissionsTests.swift index 02d893bc..2076d744 100644 --- a/Tests/XMTPTests/GroupPermissionsTests.swift +++ b/Tests/XMTPTests/GroupPermissionsTests.swift @@ -31,8 +31,8 @@ class GroupPermissionTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) let bob = try PrivateKey.generate() @@ -41,8 +41,8 @@ class GroupPermissionTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) let caro = try PrivateKey.generate() @@ -51,8 +51,8 @@ class GroupPermissionTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) diff --git a/Tests/XMTPTests/GroupTests.swift b/Tests/XMTPTests/GroupTests.swift index 5cc8a8c1..99adc26e 100644 --- a/Tests/XMTPTests/GroupTests.swift +++ b/Tests/XMTPTests/GroupTests.swift @@ -52,8 +52,8 @@ class GroupTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) let bob = try PrivateKey.generate() @@ -62,8 +62,8 @@ class GroupTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) let fred = try PrivateKey.generate() @@ -72,8 +72,8 @@ class GroupTests: XCTestCase { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true, - mlsEncryptionKey: key + enableV3: true, + encryptionKey: key ) ) diff --git a/XMTP.podspec b/XMTP.podspec index 3428d098..be452284 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |spec| # spec.name = "XMTP" - spec.version = "0.11.7" + spec.version = "0.12.0" spec.summary = "XMTP SDK Cocoapod" # This description is used to generate tags and improve search results. diff --git a/XMTPiOSExample/XMTPiOSExample/ContentView.swift b/XMTPiOSExample/XMTPiOSExample/ContentView.swift index 5a883b02..7d50f7e5 100644 --- a/XMTPiOSExample/XMTPiOSExample/ContentView.swift +++ b/XMTPiOSExample/XMTPiOSExample/ContentView.swift @@ -52,7 +52,7 @@ struct ContentView: View { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true + enableV3: true ) ) await MainActor.run { @@ -97,7 +97,7 @@ struct ContentView: View { options: .init( api: .init(env: .local, isSecure: false, appVersion: "XMTPTest/v1.0.0"), codecs: [GroupUpdatedCodec()], - mlsAlpha: true + enableV3: true ) ) diff --git a/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift b/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift index 28b3ca0d..d47f90c4 100644 --- a/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift +++ b/XMTPiOSExample/XMTPiOSExample/Views/LoginView.swift @@ -166,7 +166,7 @@ struct LoginView: View { options: .init( api: .init(env: .local, isSecure: false), codecs: [GroupUpdatedCodec()], - mlsAlpha: true + enableV3: true ) )