Skip to content

Commit

Permalink
Require only 1 signature to add a wallet (#438)
Browse files Browse the repository at this point in the history
* update package

* update to 1 signature version
  • Loading branch information
nplasterer authored Nov 22, 2024
1 parent 19a55aa commit 20dfbe7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
8 changes: 2 additions & 6 deletions Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
12 changes: 4 additions & 8 deletions Tests/XMTPTests/ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion XMTP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down

0 comments on commit 20dfbe7

Please sign in to comment.