Skip to content

Commit

Permalink
add it to the bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Apr 3, 2024
1 parent a6e7c74 commit 48100ec
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ export async function getHmacKeys(
return keystore.GetConversationHmacKeysResponse.decode(array)
}

export async function importConversationTopicData<ContentTypes extends ContentCodec<unknown>[],>(
export async function importConversationTopicData<
ContentTypes extends ContentCodec<unknown>[],
>(
client: Client<ContentTypes>,
topicData: string
): Promise<Conversation<ContentTypes>> {
Expand Down Expand Up @@ -698,6 +700,34 @@ export async function isGroupDenied(
return XMTPModule.isGroupDenied(clientAddress, groupId)
}

export async function processGroupMessage<
ContentTypes extends DefaultContentTypes = DefaultContentTypes,
>(
client: Client<ContentTypes>,
topic: string,
encryptedMessage: string
): Promise<DecodedMessage<ContentTypes>> {
const json = XMTPModule.processGroupMessage(
client.address,
topic,
encryptedMessage
)
return DecodedMessage.from(json, client)
}

export async function processWelcomeMessage<
ContentTypes extends DefaultContentTypes = DefaultContentTypes,
>(
client: Client<ContentTypes>,
encryptedMessage: string
): Promise<Group<ContentTypes>> {
const json = await XMTPModule.processWelcomeMessage(
client.address,
encryptedMessage
)
return new Group(client, JSON.parse(json))
}

export const emitter = new EventEmitter(XMTPModule ?? NativeModulesProxy.XMTP)

export * from './XMTP.types'
Expand Down

0 comments on commit 48100ec

Please sign in to comment.