Skip to main content

Module token

Structs§

PreviewClaim
What a valid preview token lets its holder read without logging in: one page of a course, or all of its pages, as changeset_id stages them or as published.
PreviewToken
A preview link’s token and when it stops working.

Constants§

PREVIEW_TOKEN_BYTES 🔒
PREVIEW_TOKEN_LIFETIME_MINUTES 🔒
How long a preview link works. It may end up in agent transcripts, so it is bounded; publishing or discarding the changeset ends it earlier.

Functions§

hash_token 🔒
mint_preview_token
Mints a short-lived preview token for the page page_id of the course, or for all its pages with None, as changeset_id stages them or published without one. Also deletes expired tokens.
preview_path
Path of the main frontend page that previews the staged changeset, for a token from mint_preview_token.
validate_preview_token
Looks up an unexpired token. Errors with PreconditionFailed for an unknown or expired one.