Documentation
¶
Index ¶
- Variables
- type Digest
- type Options
- type Signer
- func (s *Signer) Authenticate(r *http.Request) (signed bool, err error)
- func (s *Signer) GCM() (gcm cipher.AEAD, err error)
- func (s *Signer) RawAuthenticate(signature string, ad []byte) ([]byte, error)
- func (s *Signer) RawSign(blob []byte, ad []byte) (string, error)
- func (s *Signer) Sign(o Options) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCorruptSignature = errors.New("corrupt signature")
View Source
var ErrExpiredSignature = errors.New("expired signature")
View Source
var ErrHeaderMismatch = errors.New("header mismatch")
View Source
var ErrInvalidSignature = errors.New("invalid signature")
View Source
var HdrSignature = "X-Psn"
View Source
var QuerySignature = "psn"
Functions ¶
This section is empty.
Types ¶
type Digest ¶
type Digest struct {
Expires *time.Time
Headers map[string]string
SecretHeaders map[string]string
Rewrite string
}
The signed digest included in the signature.
func (*Digest) MarshalBinary ¶
func (*Digest) UnmarshalBinary ¶
type Options ¶
type Options struct {
// The URL to sign.
URL string `json:"url"`
// The expiration time of the signed URL.
Expires *time.Time `json:"expires,omitempty"`
// Headers to include in the signed URL.
Headers map[string]string `json:"headers,omitempty"`
// Headers to include in the request after the signature is verified.
SecretHeaders map[string]string `json:"secrets,omitempty"`
// Secret internal location for the URL.
Rewrite string `json:"rewrite,omitempty"`
}
Defines the full set of options for signing a URL.
type Signer ¶
type Signer struct {
Key []byte // 16-byte key for AES-128-GCM
}
func (*Signer) Authenticate ¶
func (*Signer) RawAuthenticate ¶
Click to show internal directories.
Click to hide internal directories.