Skip to content

Commit

Permalink
make the signing key optional
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Oct 16, 2024
1 parent eadcf46 commit 66044fc
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -291,30 +291,32 @@ class Client() {

// This is a V3 only feature
suspend fun createOrBuild(
account: SigningKey,
options: ClientOptions,
address: String,
account: SigningKey? = null,
options: ClientOptions? = null,
): Client {
this.hasV2Client = false
val inboxId = getOrCreateInboxId(options, account.address)
val clientOptions = options ?: ClientOptions(enableV3 = true)
val inboxId = getOrCreateInboxId(clientOptions, address)

return try {
val (libXMTPClient, dbPath) = ffiXmtpClient(
options,
clientOptions,
account,
options.appContext,
clientOptions.appContext,
null,
account.address,
address,
inboxId
)

libXMTPClient?.let { client ->
Client(
account.address,
address,
client,
dbPath,
client.installationId().toHex(),
client.inboxId(),
options.api.env
clientOptions.api.env
)
} ?: throw XMTPException("Error creating V3 client: libXMTPClient is null")
} catch (e: Exception) {
Expand Down

0 comments on commit 66044fc

Please sign in to comment.