diff --git a/Sources/XMTPiOS/Client.swift b/Sources/XMTPiOS/Client.swift index 8bc9d12a..7d7d86c0 100644 --- a/Sources/XMTPiOS/Client.swift +++ b/Sources/XMTPiOS/Client.swift @@ -112,16 +112,14 @@ public final class Client { encryptionKey: nil, accountAddress: account.address, legacyIdentitySource: source, - legacySignedPrivateKeyProto: nil + legacySignedPrivateKeyProto: try privateKeyBundleV1.toV2().identityKey.serializedData() ) - guard let textToSign = v3Client.textToSign() else { - throw ClientError.creationError("no text to sign") + if let textToSign = v3Client.textToSign() { + let signature = try await account.sign(message: textToSign).rawData + try await v3Client.registerIdentity(recoverableWalletSignature: signature) } - 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() @@ -203,7 +201,7 @@ public final class Client { encryptionKey: nil, accountAddress: address, legacyIdentitySource: .static, - legacySignedPrivateKeyProto: try v1Bundle.identityKey.serializedData() + legacySignedPrivateKeyProto: try v1Bundle.toV2().identityKey.serializedData() ) try await v3Client.registerIdentity(recoverableWalletSignature: nil) diff --git a/Sources/XMTPiOS/XMTPLogger.swift b/Sources/XMTPiOS/XMTPLogger.swift index ad16b669..1281576f 100644 --- a/Sources/XMTPiOS/XMTPLogger.swift +++ b/Sources/XMTPiOS/XMTPLogger.swift @@ -13,6 +13,17 @@ class XMTPLogger: FfiLogger { let logger = Logger() func log(level: UInt32, levelLabel: String, message: String) { - logger.info("libxmtp[\(levelLabel)] - \(message)") + switch level { + case 1: + logger.error("libxmtp[\(levelLabel)] - \(message)") + case 2, 3: + logger.info("libxmtp[\(levelLabel)] - \(message)") + case 4: + logger.debug("libxmtp[\(levelLabel)] - \(message)") + case 5: + logger.trace("libxmtp[\(levelLabel)] - \(message)") + default: + print("libxmtp[\(levelLabel)] - \(message)") + } } }