Skip to content

Commit

Permalink
add the ability to pass in a DB url
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer authored and zombieobject committed Feb 20, 2024
1 parent 56310bc commit 47bcb31
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/XMTPiOS/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public struct ClientOptions {

public var mlsAlpha = false
public var mlsEncryptionKey: Data?
public var mlsDbPath: String?

public init(
api: Api = Api(),
Expand Down Expand Up @@ -128,12 +129,12 @@ public final class Client {
signingKey: SigningKey?
) async throws -> FfiXmtpClient? {
if options?.mlsAlpha == true, options?.api.env.supportsMLS == true {
let dbURL = URL.documentsDirectory.appendingPathComponent("xmtp-\(options?.api.env.rawValue ?? "")-\(address).db3")
let dbURL = options?.mlsDbPath ?? URL.documentsDirectory.appendingPathComponent("xmtp-\(options?.api.env.rawValue ?? "")-\(address).db3").path
let v3Client = try await LibXMTP.createClient(
logger: XMTPLogger(),
host: (options?.api.env ?? .local).url,
isSecure: options?.api.env.isSecure == true,
db: dbURL.path,
db: dbURL,
encryptionKey: options?.mlsEncryptionKey,
accountAddress: address,
legacyIdentitySource: source,
Expand Down

0 comments on commit 47bcb31

Please sign in to comment.