Documentation
¶
Overview ¶
Package signed creates and verifies signed URLs: links that carry an expiry and an HMAC-SHA256 signature over their path and query, for email verification, unsubscribe links or temporary downloads.
s := signed.New(app.Key.Derive("signed.urls", 32))
link, _ := s.Sign(appURL+"/email/verify/42", time.Hour)
r.Get("/email/verify/{id}", verify).Use(s.Middleware())
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalid = &errs.HTTPError{Status: http.StatusForbidden, Message: "Invalid signature."} ErrExpired = &errs.HTTPError{Status: http.StatusForbidden, Message: "This link has expired."} )
Errors returned by Verify (403 for clients).
Functions ¶
This section is empty.
Types ¶
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer signs and verifies URLs with one key.
func (*Signer) Middleware ¶
Middleware rejects requests whose URL signature is missing, wrong or expired with 403 (and an "url.signature_invalid" security event).
Click to show internal directories.
Click to hide internal directories.