security

package
v1.1.5-0...-3eb88c4 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidContentType = errors.New("invalid content type")
	ErrInvalidHeader      = errors.New("invalid X-Content-Security header")
	ErrInvalidKey         = errors.New("invalid key")
	ErrInvalidPublicKey   = errors.New("invalid public key")
	ErrInvalidSecret      = errors.New("invalid secret")
)

Functions

func VerifySignature

func VerifySignature(r *http.Request, securityHeader *ContentSecurityHeader, tolerance time.Duration) int

Types

type ContentSecurityHeader

type ContentSecurityHeader struct {
	Key         []byte
	Timestamp   string
	ContentType int
	Signature   string
}

func ParseContentSecurity

func ParseContentSecurity(decrypters map[string]codec.RsaDecrypter, r *http.Request) (
	*ContentSecurityHeader, error)

func (*ContentSecurityHeader) Encrypted

func (h *ContentSecurityHeader) Encrypted() bool

type WithCodeResponseWriter

type WithCodeResponseWriter struct {
	Writer http.ResponseWriter
	Code   int
}

func (*WithCodeResponseWriter) Flush

func (w *WithCodeResponseWriter) Flush()

func (*WithCodeResponseWriter) Header

func (w *WithCodeResponseWriter) Header() http.Header

func (*WithCodeResponseWriter) Write

func (w *WithCodeResponseWriter) Write(bytes []byte) (int, error)

func (*WithCodeResponseWriter) WriteHeader

func (w *WithCodeResponseWriter) WriteHeader(code int)

Jump to

Keyboard shortcuts

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