From 20dfbe71ee221adb1a8f319e3cbb3ba49b2eb44e Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Fri, 22 Nov 2024 11:46:17 -0800 Subject: [PATCH] Require only 1 signature to add a wallet (#438) * update package * update to 1 signature version --- Package.swift | 2 +- Sources/XMTPiOS/Client.swift | 8 ++------ Tests/XMTPTests/ClientTests.swift | 12 ++++-------- XMTP.podspec | 2 +- .../xcshareddata/swiftpm/Package.resolved | 4 ++-- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Package.swift b/Package.swift index 4513363a..6216537f 100644 --- a/Package.swift +++ b/Package.swift @@ -20,7 +20,7 @@ let package = Package( .package(url: "https://github.com/tesseract-one/CSecp256k1.swift.git", from: "0.2.0"), .package(url: "https://github.com/bufbuild/connect-swift", exact: "1.0.0"), .package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.4.3"), - .package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "3.0.5"), + .package(url: "https://github.com/xmtp/libxmtp-swift.git", exact: "3.0.7"), .package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", exact: "1.8.3") ], targets: [ diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index 3fac8c1b..97f9c46e 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -292,15 +292,11 @@ public final class Client { self.environment = environment } - public func addAccount(recoveryAccount: SigningKey, newAccount: SigningKey) + public func addAccount(newAccount: SigningKey) async throws { - let signatureRequest = try await ffiClient.addWallet( - existingWalletAddress: recoveryAccount.address.lowercased(), - newWalletAddress: newAccount.address.lowercased()) + let signatureRequest = try await ffiClient.addWallet(newWalletAddress: newAccount.address.lowercased()) do { - try await Client.handleSignature( - for: signatureRequest, signingKey: recoveryAccount) try await Client.handleSignature( for: signatureRequest, signingKey: newAccount) try await ffiClient.applySignatureRequest( diff --git a/Tests/XMTPTests/ClientTests.swift b/Tests/XMTPTests/ClientTests.swift index fa292697..3d3442df 100644 --- a/Tests/XMTPTests/ClientTests.swift +++ b/Tests/XMTPTests/ClientTests.swift @@ -332,10 +332,8 @@ class ClientTests: XCTestCase { let alix2Wallet = try PrivateKey.generate() let alix3Wallet = try PrivateKey.generate() - try await fixtures.alixClient.addAccount( - recoveryAccount: fixtures.alix, newAccount: alix2Wallet) - try await fixtures.alixClient.addAccount( - recoveryAccount: fixtures.alix, newAccount: alix3Wallet) + try await fixtures.alixClient.addAccount(newAccount: alix2Wallet) + try await fixtures.alixClient.addAccount(newAccount: alix3Wallet) let state = try await fixtures.alixClient.inboxState( refreshFromNetwork: true) @@ -359,10 +357,8 @@ class ClientTests: XCTestCase { let alix2Wallet = try PrivateKey.generate() let alix3Wallet = try PrivateKey.generate() - try await fixtures.alixClient.addAccount( - recoveryAccount: fixtures.alix, newAccount: alix2Wallet) - try await fixtures.alixClient.addAccount( - recoveryAccount: fixtures.alix, newAccount: alix3Wallet) + try await fixtures.alixClient.addAccount(newAccount: alix2Wallet) + try await fixtures.alixClient.addAccount(newAccount: alix3Wallet) var state = try await fixtures.alixClient.inboxState( refreshFromNetwork: true) diff --git a/XMTP.podspec b/XMTP.podspec index b1c63778..48efd7d1 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |spec| spec.dependency 'CSecp256k1', '~> 0.2' spec.dependency "Connect-Swift", "= 1.0.0" - spec.dependency 'LibXMTP', '= 3.0.5' + spec.dependency 'LibXMTP', '= 3.0.7' spec.dependency 'CryptoSwift', '= 1.8.3' spec.ios.deployment_target = '14.0' diff --git a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 14a2f437..82187ce3 100644 --- a/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/XMTPiOSExample/XMTPiOSExample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/xmtp/libxmtp-swift.git", "state" : { - "revision" : "77fd4bb5a04281b30e887dcc8739497acaa7a3a6", - "version" : "3.0.5" + "revision" : "74733290efe7f6d13c40b7ed41ec4cd4e5d95da3", + "version" : "3.0.7" } }, {