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 download token's is one key in an item's download/, which no item token opens. 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 DownloadScope ¶
DownloadScope is the scope of a download token for key: the key itself, which no item scope equals.
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) VerifyDownload ¶ added in v0.90.0
VerifyDownload checks tok for the download key "{ns}/{kind}/{id}[/{version}]/download/{name}" at now: that one key's download token.
func (Ring) VerifyPrivate ¶ added in v0.62.0
VerifyPrivate checks tok for the private object key "{ns}/{kind}/{id}[/{version}]/private/{name}" at now: its item's token.