Documentation
¶
Overview ¶
Package signedurl provides HMAC-signed URLs for media requests from devices that cannot pass cookies (AirPlay, Chromecast).
Index ¶
- Constants
- Variables
- func DerivePrefix(path string) string
- func GenerateCredentialID(secret []byte, username string) string
- func SignPrefix(prefix string, secret []byte, cid string, expires time.Time) url.Values
- func VerifyURL(requestPath string, queryParams url.Values, secret []byte) (string, error)
Constants ¶
View Source
const ( CIDParam = "cid" ExpiresParam = "expires" SigParam = "signature" )
Variables ¶
Functions ¶
func DerivePrefix ¶
DerivePrefix extracts the signing prefix from a request path by taking the first 3 segments and stripping the file extension from the 3rd.
func GenerateCredentialID ¶
GenerateCredentialID produces an opaque, deterministic identifier for a user. It is an HMAC-SHA256 of the username, truncated to 16 hex characters.
func SignPrefix ¶
SignPrefix signs a path prefix and returns url.Values containing the cid, expires, and signature parameters. The caller appends these to any URL whose path falls under the signed prefix.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.