sign

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildV2SigningPayload

func BuildV2SigningPayload(method string, path string, headers *orderedmap.OrderedMap, body []byte, addPathTrailingSlash bool) []byte

BuildV2SigningPayload builds a v2 signing payload.

Types

type Signer

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

Builder to generate a "Tl-Signature" header value using a private key.

func NewSigner

func NewSigner(kid string, privateKeyPem []byte) *Signer

func (*Signer) AddHeader

func (s *Signer) AddHeader(name string, value []byte)

AddHeader adds a header name & value. May be called multiple times to add multiple different headers.

Warning: Only a single value per header name is supported.

func (*Signer) Body

func (s *Signer) Body(body []byte) *Signer

Body adds the full request body.

Note: This **must** be identical to what is sent with the request.

func (*Signer) Header

func (s *Signer) Header(name string, value []byte) *Signer

Header adds a header name & value. May be called multiple times to add multiple different headers.

Warning: Only a single value per header name is supported.

func (*Signer) Headers

func (s *Signer) Headers(headers map[string][]byte) *Signer

Headers appends multiple header name & value.

Warning: Only a single value per header name is supported.

func (*Signer) Jku added in v0.1.6

func (s *Signer) Jku(jku string) *Signer

func (*Signer) Method

func (s *Signer) Method(method string) *Signer

Method adds the request method, defaults to "POST" if unspecified.

func (*Signer) Path

func (s *Signer) Path(path string) *Signer

Path adds the request absolute path starting with a leading '/' and without any trailing slashes.

func (*Signer) Sign

func (s *Signer) Sign() (string, error)

Sign produces a JWS 'Tl-Signature' v2 header value.

Jump to

Keyboard shortcuts

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