Skip to content

Commit

Permalink
feat!: simplify API of 'add_clients_to_conversation' by not requiring…
Browse files Browse the repository at this point in the history
… to repeat the ClientId of the new members alongside their KeyPackage when the former can now be extracted from the latter
  • Loading branch information
beltram committed Nov 28, 2023
1 parent ac6b87e commit 2fc152e
Show file tree
Hide file tree
Showing 39 changed files with 352 additions and 764 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ branch = "wire/unstable-pq-xyber"
[patch.crates-io.wire-e2e-identity]
git = "https://github.com/wireapp/rusty-jwt-tools"
package = "wire-e2e-identity"
branch = "main"
#branch = "main"
tag = "v0.5.2"

# aarch64-apple-ios-sim target support has not yet been released
[patch.crates-io.openssl-src]
Expand Down
27 changes: 3 additions & 24 deletions crypto-ffi/bindings/js/CoreCrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import initWasm, {
CoreCrypto as CoreCryptoFfi,
ConversationConfiguration as ConversationConfigurationFfi,
CustomConfiguration as CustomConfigurationFfi,
Invitee as InviteeFfi,
CoreCryptoWasmCallbacks,
AcmeDirectory,
NewAcmeOrder,
Expand Down Expand Up @@ -429,20 +428,6 @@ export interface CoreCryptoParams extends CoreCryptoDeferredParams {
clientId: ClientId;
}

/**
* Data shape for adding clients to a conversation
*/
export interface Invitee {
/**
* Client ID as a byte array
*/
id: ClientId;
/**
* MLS KeyPackage belonging to the aforementioned client
*/
kp: Uint8Array;
}

export interface ConversationInitBundle {
/**
* Conversation ID of the conversation created
Expand Down Expand Up @@ -1139,26 +1124,20 @@ export class CoreCrypto {
* epoch, use new encryption secrets etc...
*
* @param conversationId - The ID of the conversation
* @param clients - Array of {@link Invitee} (which are Client ID / KeyPackage pairs)
* @param keyPackages - KeyPackages of the new clients to add
*
* @returns A {@link CommitBundle}
*/
async addClientsToConversation(
conversationId: ConversationId,
clients: Invitee[]
keyPackages: Uint8Array[]
): Promise<MemberAddedMessages> {
try {
const ffiClients = clients.map(
(invitee) => new InviteeFfi(invitee.id, invitee.kp)
);

const ffiRet: CoreCryptoFfiTypes.MemberAddedMessages = await CoreCryptoError.asyncMapErr(this.#cc.add_clients_to_conversation(
conversationId,
ffiClients
keyPackages
));

ffiClients.forEach(c => c.free());

const gi = ffiRet.group_info;

const ret: MemberAddedMessages = {
Expand Down
Loading

0 comments on commit 2fc152e

Please sign in to comment.