@@ -175,14 +175,14 @@ class Client() {
175
175
val apiClient =
176
176
GRPCApiClient (environment = clientOptions.api.env, secure = clientOptions.api.isSecure)
177
177
val v3Client: FfiXmtpClient ? = if (isAlphaMlsEnabled(options)) {
178
- if (account == null ) throw XMTPException (" Signing Key required to use groups." )
179
178
runBlocking {
180
179
ffiXmtpClient(
181
180
options,
182
181
account,
183
182
options?.appContext,
184
183
bundle,
185
- LegacyIdentitySource .STATIC
184
+ LegacyIdentitySource .STATIC ,
185
+ address
186
186
)
187
187
}
188
188
} else null
@@ -227,14 +227,15 @@ class Client() {
227
227
account,
228
228
options?.appContext,
229
229
privateKeyBundleV1,
230
- legacyIdentityKey
230
+ legacyIdentityKey,
231
+ account.address
231
232
)
232
233
val client =
233
234
Client (account.address, privateKeyBundleV1, apiClient, libXMTPClient)
234
235
client.ensureUserContactPublished()
235
236
client
236
237
} catch (e: java.lang.Exception ) {
237
- throw XMTPException (" Error creating client" , e)
238
+ throw XMTPException (" Error creating client ${e.message} " , e)
238
239
}
239
240
}
240
241
}
@@ -263,7 +264,8 @@ class Client() {
263
264
account,
264
265
options?.appContext,
265
266
v1Bundle,
266
- LegacyIdentitySource .STATIC
267
+ LegacyIdentitySource .STATIC ,
268
+ address
267
269
)
268
270
}
269
271
} else null
@@ -282,14 +284,15 @@ class Client() {
282
284
283
285
private suspend fun ffiXmtpClient (
284
286
options : ClientOptions ? ,
285
- account : SigningKey ,
287
+ account : SigningKey ? ,
286
288
appContext : Context ? ,
287
289
privateKeyBundleV1 : PrivateKeyBundleV1 ,
288
290
legacyIdentitySource : LegacyIdentitySource ,
291
+ accountAddress : String ,
289
292
): FfiXmtpClient ? {
290
293
val v3Client: FfiXmtpClient ? =
291
294
if (isAlphaMlsEnabled(options)) {
292
- val alias = " xmtp-${options!! .api.env} -${account.address .lowercase()} "
295
+ val alias = " xmtp-${options!! .api.env} -${accountAddress .lowercase()} "
293
296
294
297
val dbDir = File (appContext?.filesDir?.absolutePath, " xmtp_db" )
295
298
dbDir.mkdir()
@@ -325,7 +328,7 @@ class Client() {
325
328
isSecure = false ,
326
329
db = dbPath,
327
330
encryptionKey = retrievedKey.encoded,
328
- accountAddress = account.address .lowercase(),
331
+ accountAddress = accountAddress .lowercase(),
329
332
legacyIdentitySource = legacyIdentitySource,
330
333
legacySignedPrivateKeyProto = privateKeyBundleV1.toV2().identityKey.toByteArray()
331
334
)
@@ -335,10 +338,12 @@ class Client() {
335
338
336
339
if (v3Client?.textToSign() == null ) {
337
340
v3Client?.registerIdentity(null )
338
- } else {
341
+ } else if (account != null ) {
339
342
v3Client.textToSign()?.let {
340
343
v3Client.registerIdentity(account.sign(it))
341
344
}
345
+ } else {
346
+ Log .i(TAG , " No signer passed but signer was required." )
342
347
}
343
348
344
349
return v3Client
0 commit comments