Files
module-tencent-sdk/src/usersig.h
2026-03-16 17:50:45 +08:00

23 lines
767 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include <string>
#include <cstdint>
// 生成 TRTC UserSigTLS-SigAPIv2
// 参数:
// - user_id : 用户 ID对应 TLS.identifier
// - sdk_app_id : 控制台创建的 TRTC 应用 SDKAppID
// - secret_key : 控制台获取的密钥 SecretKey
// - expire : 过期时间(秒),例如 7 * 24 * 60 * 60
//
// 返回:
// - 用于 TRTC 鉴权的 UserSig 字符串
//
// 说明:
// - 该函数仅做算法封装,不做任何网络/IO 操作
// - 推荐在服务端调用本函数生成 UserSig再下发到客户端
std::string GenerateUserSig(const std::string& user_id,
int sdk_app_id,
const std::string& secret_key,
std::uint32_t expire);