esign

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

README

esign

E签宝 Go SDK

签章准备

制作合同模板,切记:保存「模板ID」

  • 第一步:获取上传URL 👉 这里
  • 第二步:上传合同模板文件 👉 这里
  • 第三步:查询文件上传状态 👉 这里
  • 第四步:获取制作合同模板的页面 👉 这里
  • 第五步:查询合同模板控件详情 👉 这里
签章流程

基于合同模板创建签章流程,切记:保存「文件ID」和「流程ID」

  • 第一步:填写模板生成文件 👉 这里
  • 第二步:基于文件发起签署 👉 这里
  • 第三步:获取签署页面链接 👉 这里
  • 第四步:处理异步回调通知 👉 这里

Documentation

Index

Constants

View Source
const (
	HeaderContentMD5           = "Content-MD5"
	HeaderTSignOpenAppID       = "X-Tsign-Open-App-Id"
	HeaderTSignOpenAuthMode    = "X-Tsign-Open-Auth-Mode"
	HeaderTSignOpenCaTimestamp = "X-Tsign-Open-Ca-Timestamp"
	HeaderTSignOpenCaSignature = "X-Tsign-Open-Ca-Signature"
	HeaderTSignOpenTimestamp   = "X-Tsign-Open-TIMESTAMP"
	HeaderTSignOpenSignature   = "X-Tsign-Open-SIGNATURE"
)
View Source
const (
	AcceptAll    = "*/*"
	AuthModeSign = "Signature"
)

Variables

This section is empty.

Functions

func ContentMD5

func ContentMD5(b []byte) string

ContentMD5 计算内容MD5值

func FileMD5

func FileMD5(filename string) (string, int64)

FileMD5 计算文件MD5值

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client E签宝客户端

func NewClient

func NewClient(appid, secret string, options ...Option) *Client

NewClient 返回E签宝客户端

func NewSandbox

func NewSandbox(appid, secret string, options ...Option) *Client

NewSandbox 返回E签宝「沙箱环境」客户端

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, path string, query url.Values) (gjson.Result, error)

GetJSON GET请求JSON数据

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, path string, params lib.X) (gjson.Result, error)

PostJSON POST请求JSON数据

func (*Client) PutStream

func (c *Client) PutStream(ctx context.Context, uploadURL string, reader io.ReadSeeker) error

PutStream 上传文件流

func (*Client) PutStreamFromFile

func (c *Client) PutStreamFromFile(ctx context.Context, uploadURL, filename string) error

PutStreamFromFile 通过文件上传文件流

func (*Client) Verify

func (c *Client) Verify(header http.Header, body []byte) error

Verify 签名验证 (回调通知等)

type Option

type Option func(c *Client)

Option 自定义设置项

func WithHttpClient added in v1.2.0

func WithHttpClient(cli *http.Client) Option

WithHttpClient 设置自定义 HTTP Client

func WithLogger

func WithLogger(fn func(ctx context.Context, err error, data map[string]string)) Option

WithLogger 设置日志记录

type SignOption

type SignOption func(sf *signfields)

SignOption 签名选项

func WithSignAccept

func WithSignAccept(v string) SignOption

WithSignAccept 设置Accept

func WithSignContMD5

func WithSignContMD5(v string) SignOption

WithSignContMD5 设置ContentMD5

func WithSignContType

func WithSignContType(v string) SignOption

WithSignContType 设置ContentType

func WithSignDate

func WithSignDate(v string) SignOption

WithSignDate 设置Date

func WithSignHeader

func WithSignHeader(k, v string) SignOption

WithSignHeader 设置Header

func WithSignParam

func WithSignParam(k, v string) SignOption

WithSignParam 以 K-V 设置参数

func WithSignValues

func WithSignValues(v url.Values) SignOption

WithSignValues 以 url.Values 设置参数

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer 签名器

func NewSigner

func NewSigner(method, path string, options ...SignOption) *Signer

NewSigner 返回新的签名器

func (*Signer) Do

func (s *Signer) Do(secret string) string

Do 生成签名

func (*Signer) String

func (s *Signer) String() string

String 返回签名字符串

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL