Versions in this module Expand all Collapse all v0 v0.1.1 Aug 31, 2026 v0.1.0 Aug 31, 2026 Changes in this version + const HeaderAppKey + const HeaderContentDigest + const HeaderEncrypt + const HeaderNonce + const HeaderSign + const HeaderTimestamp + const SignExpiredSecondsDefault + const SignExpiredSecondsMax + const SignProtocolVersion + func CanonicalHeaders(headers map[string]string) string + func CanonicalRequest(...) string + func DecodeB64URL(s string) ([]byte, error) + func DigestHeaderValue(s Suite, data []byte) string + func EncodeB64URL(b []byte) string + func LowerHex(b []byte) string + func ParseContentDigest(value string) (tag, hexSum string, err error) + func ParseSignHeader(header string) (signHeader, error) + func TrimAll(s string) string + func URLEncodeJava(s string) string + func ValidateContentDigest(s Suite, headerValue string, wireBody []byte) error + func ValidateContentDigestHeader(s Suite, headerValue string) error + type Client struct + func NewClient(cfg Config) (*Client, error) + func (c *Client) BuildRequest(method, path string, body []byte, level Level, opts ...RequestOption) (RequestDraft, error) + func (c *Client) Do(method, path string, body []byte, level Level, opts ...RequestOption) (VerifyResult, TransportResponse, error) + func (c *Client) Suite() Suite + func (c *Client) VerifyCallback(callbackURL string, header http.Header, wireBody []byte) VerifyResult + func (c *Client) VerifyResponse(method, path string, header http.Header, wireBody []byte) VerifyResult + type Config struct + AppKey string + ExpiredSeconds int64 + GatewayBaseURL string + MerchantPrivateKey string + PlatformPublicKey string + SecurityReq string + Transport Transport + type DefaultTransport struct + BaseURL string + HTTPClient *http.Client + func (t DefaultTransport) Send(d RequestDraft) (TransportResponse, error) + type Error struct + Code ErrorCode + Message string + func (e *Error) Error() string + type ErrorCode string + const CodeAlgMismatch + const CodeConfig + const CodeDecryptFailed + const CodeDigestMismatch + const CodeProtocol + const CodeSuiteParse + const CodeSuiteUnsupported + const CodeVerifyFailed + type Family string + const FamilyRSA + const FamilySM2 + type Level string + const Level0 + const Level2 + type RequestDraft struct + Headers map[string]string + Method string + Path string + WireBody []byte + type RequestOption func(*RequestOptions) + func WithNonce(nonce string) RequestOption + func WithRandom(r io.Reader) RequestOption + func WithTimestamp(ms int64) RequestOption + type RequestOptions struct + Nonce string + Random io.Reader + TimestampMs int64 + type Suite struct + func ParseSuite(securityReq string) (Suite, error) + func (s Suite) Digest(data []byte) []byte + func (s Suite) DigestTag() string + func (s Suite) Family() Family + func (s Suite) IsSM2() bool + func (s Suite) KeyBits() int + func (s Suite) KeyWrapAlgorithm() string + func (s Suite) MessageAlgorithm() string + func (s Suite) SecurityReq() string + func (s Suite) SignAlgorithm() string + type Transport interface + Send func(RequestDraft) (TransportResponse, error) + func RoundTripperTransport(rt http.RoundTripper, baseURL string) Transport + type TransportFunc func(RequestDraft) (TransportResponse, error) + func (f TransportFunc) Send(d RequestDraft) (TransportResponse, error) + type TransportResponse struct + Body []byte + Headers http.Header + StatusCode int + type VerifyResult struct + Code ErrorCode + OK bool + Plaintext []byte + Reason string