Bitzsoft.Integrations.ElectronicSignature.Tencent 1.0.0-alpha.7

This is a prerelease version of Bitzsoft.Integrations.ElectronicSignature.Tencent.
dotnet add package Bitzsoft.Integrations.ElectronicSignature.Tencent --version 1.0.0-alpha.7
                    
NuGet\Install-Package Bitzsoft.Integrations.ElectronicSignature.Tencent -Version 1.0.0-alpha.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.ElectronicSignature.Tencent" Version="1.0.0-alpha.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.ElectronicSignature.Tencent" Version="1.0.0-alpha.7" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.ElectronicSignature.Tencent" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.ElectronicSignature.Tencent --version 1.0.0-alpha.7
                    
#r "nuget: Bitzsoft.Integrations.ElectronicSignature.Tencent, 1.0.0-alpha.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.ElectronicSignature.Tencent@1.0.0-alpha.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.ElectronicSignature.Tencent&version=1.0.0-alpha.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.ElectronicSignature.Tencent&version=1.0.0-alpha.7&prerelease
                    
Install as a Cake Tool

Bitzsoft.Integrations.ElectronicSignature.Tencent

腾讯电子签电子签章服务实现,基于腾讯电子签自建应用 API 和腾讯云 TC3-HMAC-SHA256 签名。

功能特性

  • 支持腾讯电子签自建应用 API 调用
  • 支持上传 PDF 并创建签署流程
  • 支持查询合同详情、签署状态、文件下载 URL
  • 支持获取 H5 签署链接、撤销合同流程
  • 支持查询企业印章和流程模板
  • 支持企业角色、员工、SSO 员工和客户系统 OpenId 绑定相关接口
  • 支持按调用传入租户上下文,覆盖 Operator 和集团代理企业 Agent
  • 提供 InvokeAsync 调用腾讯电子签原生 Action

安装

dotnet add package Bitzsoft.Integrations.ElectronicSignature.Tencent
<PackageReference Include="Bitzsoft.Integrations.ElectronicSignature.Tencent" Version="*" />

配置

{
  "ElectronicSignature": {
    "Tencent": {
      "SecretId": "your-secret-id",
      "SecretKey": "your-secret-key",
      "OperatorUserId": "operator-user-id",
      "Endpoint": "ess.tencentcloudapi.com",
      "FileEndpoint": "file.ess.tencent.cn",
      "Region": "ap-guangzhou"
    }
  }
}
参数 必填 默认值 说明
SecretId - 腾讯云访问密钥 ID
SecretKey - 腾讯云访问密钥 Key
OperatorUserId - 自建应用经办人 UserId
Endpoint ess.tencentcloudapi.com 业务接口域名
FileEndpoint file.ess.tencent.cn 文件上传接口域名
Region - 腾讯云地域,电子签可选
ProxyOrganizationId - 集团子公司代发等场景使用
DefaultFlowType - 默认合同类型
DefaultSignUrlJumpUrl - H5 签署完成跳转地址
UseSandbox false 使用测试文件域名

注册服务

using Bitzsoft.Integrations.ElectronicSignature.Tencent;

services.AddBitzsoftTencentElectronicSignature(configuration);

或:

using Bitzsoft.Integrations.ElectronicSignature.Tencent;

services.AddBitzsoftTencentElectronicSignature(options =>
{
    options.SecretId = "your-secret-id";
    options.SecretKey = "your-secret-key";
    options.OperatorUserId = "operator-user-id";
});

第三方请求日志

内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认 NullRequestLogStore 不持久化。

// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddBitzsoftTencentElectronicSignature(configuration);

// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
    opts.MaxBodyLength = 8192;
    opts.SensitiveFields.Add("mySecret");
});
services.AddBitzsoftTencentElectronicSignature(configuration);

使用示例

统一抽象

var result = await provider.CreateContractAsync(new SimpleContractRequest
{
    Title = "采购合同",
    FileName = "contract.pdf",
    FileData = await File.ReadAllBytesAsync("contract.pdf"),
    SignerName = "张三",
    SignerPhone = "13800000000",
    ExtensionParams = new Dictionary<string, object>
    {
        ["ComponentPage"] = 1,
        ["ComponentPosX"] = 360,
        ["ComponentPosY"] = 640,
        ["ComponentWidth"] = 100,
        ["ComponentHeight"] = 40
    }
});

腾讯电子签完整发起流程

var tencent = (TencentElectronicSignatureProvider)provider;
var flow = await tencent.CreateFlowByFilesAsync(new TencentCreateFlowByFilesRequest
{
    Tenant = new TencentTenantContext
    {
        OperatorUserId = "operator-user-id",
        ProxyOrganizationId = "member-organization-id"
    },
    FlowName = "采购合同",
    FlowType = "采购合同",
    Files =
    [
        new TencentUploadFileRequest
        {
            FileName = "contract.pdf",
            FileData = await File.ReadAllBytesAsync("contract.pdf")
        }
    ],
    Approvers =
    [
        new TencentFlowApprover
        {
            ApproverType = 3,
            OrganizationName = "示例企业",
            ApproverName = "张三",
            ApproverMobile = "13800000000",
            NotifyType = "NONE",
            SignComponents =
            [
                new TencentSignComponent
                {
                    ComponentType = "SIGN_SEAL",
                    ComponentValue = "seal-id",
                    FileIndex = 0,
                    ComponentPage = 1,
                    ComponentPosX = 160,
                    ComponentPosY = 260,
                    ComponentWidth = 100,
                    ComponentHeight = 100
                }
            ]
        }
    ]
});

员工和客户系统 OpenId 映射

await tencent.CreateIntegrationEmployeesAsync(
[
    new TencentEmployeeRequest
    {
        OpenId = "biz-user-10001",
        DisplayName = "张三",
        Mobile = "13800000000",
        RoleIds = ["role-id"]
    }
]);

await tencent.BindEmployeeUserIdWithClientOpenIdAsync(new TencentUserOpenIdBindingRequest
{
    UserId = "tencent-user-id",
    OpenId = "biz-user-10001"
});

实现状态

方法 腾讯电子签 Action 状态 说明
CreateContractAsync UploadFiles + CreateFlowByFiles 已实现 单 PDF、单个人签署方基础场景
GetContractDetailAsync DescribeFlowInfo 已实现 映射统一合同详情
DownloadContractAsync DescribeFileUrls 已实现 获取临时 URL 后下载
GetContractViewUrlAsync DescribeFileUrls 已实现 返回第一个文件 URL
CancelContractAsync CancelFlow 已实现 撤销单个流程
GetSigningUrlAsync CreateFlowSignUrl 已实现 H5 签署链接
GetSigningStatusAsync DescribeFlowInfo 已实现 基于详情计算签署状态
ListSealsAsync DescribeOrganizationSeals 已实现 查询企业电子印章
GetSealDetailAsync DescribeOrganizationSeals 已实现 客户端筛选
ListTemplatesAsync DescribeFlowTemplates 已实现 查询模板列表
GetTemplateDetailAsync DescribeFlowTemplates 已实现 客户端筛选基础信息
VerifyCallback - 基础实现 保留原始 payload,复杂验签可按业务回调配置扩展
CreateFlowByFilesAsync UploadFiles + CreateFlowByFiles 已实现 多签署方、企业签、租户上下文
DescribeIntegrationRolesAsync DescribeIntegrationRoles 已实现 企业角色列表
DescribeIntegrationEmployeesAsync DescribeIntegrationEmployees 已实现 企业员工分页查询
CreateIntegrationEmployeesAsync CreateIntegrationEmployees 已实现 企业员工创建
CreateSingleSignOnEmployeesAsync CreateSingleSignOnEmployees 已实现 SSO 员工创建
DescribeSingleSignOnEmployeesAsync DescribeSingleSignOnEmployees 已实现 SSO 员工查询
BindEmployeeUserIdWithClientOpenIdAsync BindEmployeeUserIdWithClientOpenId 已实现 员工 UserId 与业务 OpenId 绑定
UnbindEmployeeUserIdWithClientOpenIdAsync UnbindEmployeeUserIdWithClientOpenId 已实现 员工 UserId 与业务 OpenId 解绑
DescribeOrganizationVerifyStatusAsync DescribeOrganizationVerifyStatus 已实现 企业认证状态
DescribeThirdPartyAuthCodeAsync DescribeThirdPartyAuthCode 已实现 个人实名授权码查询

注意事项

  • 腾讯电子签 UploadFiles 使用文件服务域名,正式环境默认为 file.ess.tencent.cn
  • CreateContractAsync 只覆盖统一抽象的极简场景,复杂签署方、审批、关键字定位、模板控件和租户上下文请使用 CreateFlowByFilesAsyncInvokeAsync
  • CreateFlowByFiles 发起后会扣减合同额度,撤销返还规则以腾讯电子签官方文档为准
  • H5 签署链接需要传入腾讯电子签返回的 RecipientId,可从 CreateFlowByFilesAsync 返回值或 DescribeFlowInfo 中获取
  • 业务系统用户 ID 不等于腾讯电子签 UserId;需要使用员工创建、SSO 员工或 OpenId 绑定接口完成映射

依赖

  • Bitzsoft.Integrations.Compatibility:基础工具库

相关包

供应商 包名
统一抽象 Bitzsoft.Integrations.ElectronicSignature
君子签 Bitzsoft.Integrations.ElectronicSignature.Junziqian
法大大 Bitzsoft.Integrations.ElectronicSignature.Fadada
爱签 Bitzsoft.Integrations.ElectronicSignature.Asign
上上签 Bitzsoft.Integrations.ElectronicSignature.BestSign
e签宝 Bitzsoft.Integrations.ElectronicSignature.ESign
契约锁 Bitzsoft.Integrations.ElectronicSignature.Qiyuesuo
安证通 Bitzsoft.Integrations.ElectronicSignature.Anzhengtong
腾讯电子签 Bitzsoft.Integrations.ElectronicSignature.Tencent
聚合包 Bitzsoft.Integrations.ElectronicSignature.All
基础工具库 Bitzsoft.Integrations.Compatibility

相关文档

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.ElectronicSignature.Tencent:

Package Downloads
Bitzsoft.Integrations.ElectronicSignature.All

电子签章聚合包 — 包含君子签 / 法大大 / 爱签 / 上上签 / e签宝 / 契约锁 / 安证通 / 腾讯电子签全部实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.7 56 6/16/2026
1.0.0-alpha.6 53 6/16/2026
1.0.0-alpha.5 50 6/14/2026
1.0.0-alpha.3 55 6/7/2026