Skip to content

Commit

Permalink
Fix v3 client creation for real devices (#252)
Browse files Browse the repository at this point in the history
* pass at potential issues

* remove dev changes and bump pod

---------

Co-authored-by: Naomi Plasterer <[email protected]>
  • Loading branch information
alexrisch and nplasterer authored Feb 16, 2024
1 parent 898fc90 commit fc3b273
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 7 additions & 12 deletions Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ public final class Client {
signingKey: account
)

if let textToSign = v3Client?.textToSign() {
let signature = try await account.sign(message: textToSign).rawData
try await v3Client?.registerIdentity(recoverableWalletSignature: signature)
}

let client = try Client(address: account.address, privateKeyBundleV1: privateKeyBundleV1, apiClient: apiClient, v3Client: v3Client)
try await client.ensureUserContactPublished()

Expand Down Expand Up @@ -258,14 +253,7 @@ public final class Client {
signingKey: SigningKey? = nil
) async throws -> Client {
let address = try v1Bundle.identityKey.publicKey.recoverWalletSignerPublicKey().walletAddress

let options = options ?? ClientOptions()
let client = try await LibXMTP.createV2Client(host: options.api.env.url, isSecure: options.api.env.isSecure)
let apiClient = try GRPCApiClient(
environment: options.api.env,
secure: options.api.isSecure,
rustClient: client
)

let v3Client = try await initV3Client(
address: address,
Expand All @@ -274,6 +262,13 @@ public final class Client {
privateKeyBundleV1: v1Bundle,
signingKey: nil
)

let client = try await LibXMTP.createV2Client(host: options.api.env.url, isSecure: options.api.env.isSecure)
let apiClient = try GRPCApiClient(
environment: options.api.env,
secure: options.api.isSecure,
rustClient: client
)

let result = try Client(address: address, privateKeyBundleV1: v1Bundle, apiClient: apiClient, v3Client: v3Client)

Expand Down
2 changes: 1 addition & 1 deletion XMTP.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
#

spec.name = "XMTP"
spec.version = "0.8.6"
spec.version = "0.8.7"
spec.summary = "XMTP SDK Cocoapod"

# This description is used to generate tags and improve search results.
Expand Down

0 comments on commit fc3b273

Please sign in to comment.