Skip to main content

privchat_protocol/rpc/message/
revoke.rs

1// Copyright 2025 Shanghai Boyu Information Technology Co., Ltd.
2// https://privchat.dev
3//
4// Author: zoujiaqing <zoujiaqing@gmail.com>
5//
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10//     http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18/// 消息撤回 RPC
19use serde::{Deserialize, Serialize};
20
21/// 撤回消息请求
22///
23/// RPC路由: `message/revoke`
24///
25/// 🔐 安全设计:不传递 user_id
26/// - user_id 从服务端 session 中获取(可信来源)
27/// - 防止客户端伪造身份
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct MessageRevokeRequest {
30    /// 服务端消息ID
31    pub server_message_id: u64,
32    /// 频道ID(从本地数据库查询)
33    pub channel_id: u64,
34
35    /// 用户ID(服务器端填充,客户端不可设置)
36    #[serde(skip_deserializing, default)]
37    pub user_id: u64,
38}
39
40/// 撤回消息响应
41///
42/// RPC路由: `message/revoke`
43/// 简单操作,返回 true(成功/失败由协议层 code 处理)
44pub type MessageRevokeResponse = bool;