diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt index 6b13181ec..f80211c73 100644 --- a/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt +++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt @@ -246,6 +246,7 @@ class XMTPModule : Module() { "sign", "authed", "authedV3", + "bundleAuthed", "preCreateIdentityCallback", "preEnableIdentityCallback", "preAuthenticateToInboxCallback", @@ -431,7 +432,7 @@ class XMTPModule : Module() { clients[client.inboxId] = client ContentJson.Companion signer = null - sendEvent("authed", ClientWrapper.encodeToObj(client)) + sendEvent("bundleAuthed", ClientWrapper.encodeToObj(client)) } catch (e: Exception) { throw XMTPException("Failed to create client: $e") } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 36bec2102..80a196fcb 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -56,7 +56,7 @@ PODS: - hermes-engine/Pre-built (= 0.71.14) - hermes-engine/Pre-built (0.71.14) - libevent (2.1.12) - - LibXMTP (0.5.10) + - LibXMTP (0.6.0) - Logging (1.0.0) - MessagePacker (0.4.7) - MMKV (2.0.0): @@ -449,16 +449,16 @@ PODS: - GenericJSON (~> 2.0) - Logging (~> 1.0.0) - secp256k1.swift (~> 0.1) - - XMTP (0.16.0): + - XMTP (0.16.1): - Connect-Swift (= 0.12.0) - GzipSwift - - LibXMTP (= 0.5.10) + - LibXMTP (= 0.6.0) - web3.swift - XMTPReactNative (0.1.0): - ExpoModulesCore - MessagePacker - secp256k1.swift - - XMTP (= 0.16.0) + - XMTP (= 0.16.1) - Yoga (1.14.0) DEPENDENCIES: @@ -711,7 +711,7 @@ SPEC CHECKSUMS: GzipSwift: 893f3e48e597a1a4f62fafcb6514220fcf8287fa hermes-engine: d7cc127932c89c53374452d6f93473f1970d8e88 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 - LibXMTP: 3b64b0b1e4157ff73c37cde60fe943f89e6f8693 + LibXMTP: 059c6d51b2c59419941ecff600aa586bbe083673 Logging: 9ef4ecb546ad3169398d5a723bc9bea1c46bef26 MessagePacker: ab2fe250e86ea7aedd1a9ee47a37083edd41fd02 MMKV: f7d1d5945c8765f97f39c3d121f353d46735d801 @@ -763,8 +763,8 @@ SPEC CHECKSUMS: secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634 SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1 web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959 - XMTP: 18d555dbf5afd3dcafa11b108042f9673da3c6b9 - XMTPReactNative: cd8be3d8547d116005f3d0f4f207f19c7b34d035 + XMTP: b2c2bcb0ddd6fbdb4820cac7be8a694c0f797425 + XMTPReactNative: 0b3b70a875bcb3defc24f051f69c35b257037c08 Yoga: e71803b4c1fff832ccf9b92541e00f9b873119b9 PODFILE CHECKSUM: 0e6fe50018f34e575d38dc6a1fdf1f99c9596cdd diff --git a/example/src/tests/groupTests.ts b/example/src/tests/groupTests.ts index 73c06c3fb..6f2881185 100644 --- a/example/src/tests/groupTests.ts +++ b/example/src/tests/groupTests.ts @@ -50,8 +50,8 @@ test('can make a MLS V3 client', async () => { return true }) -test('can create from key bundle with signer', async () => { - const keyBytes = new Uint8Array([ +test('can revoke all other installations', async () => { + const keyBytes = new Uint8Array([ 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145, ]) @@ -75,7 +75,7 @@ test('can create from key bundle with signer', async () => { const keyBundle = await alix2.exportKeyBundle() // create from keybundle a v3 client - const alix3 = await Client.createFromKeyBundle( + const alixKeyBundle = await Client.createFromKeyBundle( keyBundle, { env: 'local', @@ -86,33 +86,23 @@ test('can create from key bundle with signer', async () => { alixWallet ) - const inboxState = await alix3.inboxState(true) + const inboxState = await alixKeyBundle.inboxState(true) assert( inboxState.installations.length === 2, `installations length should be 2 but was ${inboxState.installations.length}` ) - return true -}) - -test('can revoke all other installations', async () => { - const keyBytes = new Uint8Array([ - 233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64, - 166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145, - ]) - const alixWallet = Wallet.createRandom() - - const alix = await Client.create(alixWallet, { + const alix3 = await Client.create(alixWallet, { env: 'local', appVersion: 'Testing/0.0.0', enableV3: true, dbEncryptionKey: keyBytes, }) - const keyBundle = await alix.exportKeyBundle() + const keyBundle2 = await alix3.exportKeyBundle() - await Client.createFromKeyBundle( - keyBundle, + const alixKeyBundle2 = await Client.createFromKeyBundle( + keyBundle2, { env: 'local', appVersion: 'Testing/0.0.0', @@ -122,31 +112,31 @@ test('can revoke all other installations', async () => { alixWallet ) - await alix.deleteLocalDatabase() + await alix3.deleteLocalDatabase() - const alix2 = await Client.create(alixWallet, { + const alix4 = await Client.create(alixWallet, { env: 'local', appVersion: 'Testing/0.0.0', enableV3: true, dbEncryptionKey: keyBytes, }) - const inboxState = await alix2.inboxState(true) + const inboxState2 = await alix4.inboxState(true) assert( - inboxState.installations.length === 2, - `installations length should be 2 but was ${inboxState.installations.length}` + inboxState2.installations.length === 3, + `installations length should be 3 but was ${inboxState2.installations.length}` ) - await alix2.revokeAllOtherInstallations(alixWallet) + await alix4.revokeAllOtherInstallations(alixWallet) - const inboxState2 = await alix2.inboxState(true) + const inboxState3 = await alix4.inboxState(true) assert( - inboxState2.installations.length === 1, - `installations length should be 1 but was ${inboxState2.installations.length}` + inboxState3.installations.length === 1, + `installations length should be 1 but was ${inboxState3.installations.length}` ) assert( - inboxState2.installations[0].createdAt !== undefined, + inboxState3.installations[0].createdAt !== undefined, `installations createdAt should not be undefined` ) return true diff --git a/ios/XMTPModule.swift b/ios/XMTPModule.swift index d3c954cb0..a869a8309 100644 --- a/ios/XMTPModule.swift +++ b/ios/XMTPModule.swift @@ -105,6 +105,7 @@ public class XMTPModule: Module { "sign", "authed", "authedV3", + "bundleAuthed", "preCreateIdentityCallback", "preEnableIdentityCallback", "preAuthenticateToInboxCallback", @@ -315,7 +316,7 @@ public class XMTPModule: Module { let client = try await Client.from(v1Bundle: bundle.v1, options: options, signingKey: signer) await clientsManager.updateClient(key: client.inboxID, client: client) self.signer = nil - self.sendEvent("authed", try ClientWrapper.encodeToObj(client)) + self.sendEvent("bundleAuthed", try ClientWrapper.encodeToObj(client)) } catch { print("ERROR! Failed to create client: \(error)") throw error diff --git a/ios/XMTPReactNative.podspec b/ios/XMTPReactNative.podspec index d8cbfd215..4a4097fc5 100644 --- a/ios/XMTPReactNative.podspec +++ b/ios/XMTPReactNative.podspec @@ -26,5 +26,5 @@ Pod::Spec.new do |s| s.source_files = "**/*.{h,m,swift}" s.dependency 'secp256k1.swift' s.dependency "MessagePacker" - s.dependency "XMTP", "= 0.16.0" + s.dependency "XMTP", "= 0.16.1" end diff --git a/src/lib/Client.ts b/src/lib/Client.ts index 37ac433da..5f2d6c2a6 100644 --- a/src/lib/Client.ts +++ b/src/lib/Client.ts @@ -289,7 +289,7 @@ export class Client< ) this.authSubscription = XMTPModule.emitter.addListener( - 'authed', + 'bundleAuthed', async (message: { inboxId: string address: string diff --git a/src/lib/types/EventTypes.ts b/src/lib/types/EventTypes.ts index d9730ba2b..d02e22966 100644 --- a/src/lib/types/EventTypes.ts +++ b/src/lib/types/EventTypes.ts @@ -3,6 +3,7 @@ export enum EventTypes { Sign = 'sign', Authed = 'authed', AuthedV3 = 'authedV3', + BundleAuthed = 'bundleAuthed', PreCreateIdentityCallback = 'preCreateIdentityCallback', PreEnableIdentityCallback = 'preEnableIdentityCallback', // Conversations Events