Documentation
¶
Overview ¶
Package token signs and verifies media access tokens, shared by the host signer and the media gateway so the format cannot drift:
{kid}.{exp}.base64url(HMAC-SHA256(secret, "{scope}|{exp}"))
An item token's scope is an item's, "{ns}/{kind}/{id}" or a version's "{ns}/{kind}/{id}/{version}": every file in the item's private/ or none. A private-file token covers one immutable key, never its siblings. Tokens are bearer tokens, revoked only by expiry.
Index ¶
Constants ¶
const CookieName = "mt"
CookieName carries an item token in cookie delivery mode.
const DefaultWindow = 4 * time.Hour
DefaultWindow aligns expiries so tokens and URLs repeat within a window.
Variables ¶
Functions ¶
func Expiry ¶
Expiry rounds now+ttl up to a window. Token timestamps store whole Unix seconds, so fractional-second windows round up to whole seconds.
func PrivateFileScope ¶ added in v0.114.0
PrivateFileScope covers one private object key, including tenant, app, kind, item and version. Its domain separator keeps it distinct from download and whole-item scopes.
Types ¶
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring signs with the current key and verifies with the current or previous one.
func (Ring) VerifyPrivate ¶ added in v0.62.0
VerifyPrivate checks an exact-file or whole-item token for a private key.