支持向已核验设备加密转发文字和附件

This commit is contained in:
xhgit committed 2026-11-13 19:28:24 +08:00
1 parent f5f116a266
commit 0b89634af2
6 files changed
+81 -6

No files matched your search

+8 -1
View File
@@ -3,7 +3,7 @@ import { mlsBinding, signMls } from '../identity'
import { base64, decode, fingerprint, loadEngine } from './engine'
import type { DeviceMls } from './engine'
import { withVault } from './vault'
import { decodeMessage, encodeAttachment, encodeMutation, encodeReply, sealAttachment, uploadAttachment } from './attachments'
import { decodeMessage, encodeAttachment, encodeMutation, encodeReply, readAttachment, sealAttachment, uploadAttachment } from './attachments'
import type { Attachment, Mutation } from './attachments'
export interface Peer {
@@ -259,6 +259,13 @@ export function localMessageAction(identity: ChatIdentity, line: ChatLine, actio
})
}
export async function forwardMessage(identity: ChatIdentity, line: ChatLine, recipient: string, device: Peer, call: Call) {
if (line.recalled) throw new Error('撤回的消息无法转发')
const attachment = line.attachment
const content = attachment ? new File([await readAttachment(attachment, call)], attachment.name) : line.text
await send(identity, recipient, device, content, call)
}
export function synchronize(identity: ChatIdentity, user: string, call: Call) {
return update(identity, async (state, save, factory) => {
const peers = await directory(call, user)