Skip to main content

Module cos_sts

Module cos_sts 

Source
Expand description

腾讯云 COS STS 临时密钥

基于 cos-rust-sdk 的 STS (Security Token Service) 获取临时访问凭证。 对齐 Java CosStsClient

§使用场景

前端直传 COS 时,服务端下发 STS 临时密钥和策略, 前端用临时密钥直接 PUT 文件到 COS,避免暴露主密钥。

§安全模型

  • 临时密钥有效期由 duration_seconds 控制
  • 策略限定单对象写入(PutObject)或单对象读取(GetObject
  • 文件大小通过 content-length 条件限制

Structs§

TempCredentials
STS 临时凭证

Functions§

build_get_policy
构建 GetObject 权限策略
build_put_policy
构建 PutObject 权限策略
extract_app_id
从 bucket 名解析 appId
get_federation_token
调用 STS GetFederationToken 获取临时密钥