refactor(shared): conv-keys target user-id instead of device-id
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
decryptWithConvKey,
|
||||
encryptWithConvKey,
|
||||
getOrCreateConvKey,
|
||||
type OwnDeviceCtx,
|
||||
type OwnUserCtx,
|
||||
tryGetConvKey,
|
||||
} from './convKeys';
|
||||
import type { ChatMessage, DecryptedMessage } from './types';
|
||||
@@ -104,9 +104,8 @@ export interface SendMessageParams {
|
||||
// send and shared with every existing recipient device. New devices that
|
||||
// register later receive their key bundle through `shareConvKeyToDevice`.
|
||||
export async function sendEncryptedMessage(params: SendMessageParams): Promise<ChatMessage> {
|
||||
const ownCtx: OwnDeviceCtx = {
|
||||
const ownCtx: OwnUserCtx = {
|
||||
userId: params.senderUserId,
|
||||
deviceId: params.senderDeviceId,
|
||||
privateKey: params.senderPrivateKey,
|
||||
};
|
||||
const handle = await getOrCreateConvKey(params.client, params.conversationId, ownCtx);
|
||||
@@ -175,9 +174,8 @@ export interface EditMessageParams {
|
||||
export async function editEncryptedMessage(
|
||||
params: EditMessageParams & { senderUserId: string; senderDeviceId: string },
|
||||
): Promise<void> {
|
||||
const ownCtx: OwnDeviceCtx = {
|
||||
const ownCtx: OwnUserCtx = {
|
||||
userId: params.senderUserId,
|
||||
deviceId: params.senderDeviceId,
|
||||
privateKey: params.senderPrivateKey,
|
||||
};
|
||||
const handle = await getOrCreateConvKey(params.client, params.conversationId, ownCtx);
|
||||
|
||||
Reference in New Issue
Block a user