Verifies the launch token Dialecto mints for an editor (spec-0025 §3), with no call to Dialecto:
token = base64url(payload) "." base64url(signature)
signed = "dialecto-live-edit-v1." base64url(payload)The signature is Ed25519 under the repo's key. The purpose prefix keeps a signature made for another purpose (a release manifest, say) from verifying here. Pure: the caller passes the key, the site's origin and the time.
Summary
Functions
The Unix time the token's session ends.
Checks token against public_key (32 bytes), the configured origin and
now (Unix seconds). phase is :start when the token first arrives, which
also requires start_by not to have passed, or :session for the cookie
on later requests, which only needs exp. With repo ("owner/name") the
token's repo claim must match it, ignoring case: a cheap check against a key
pasted from the wrong repo.
Types
Functions
The Unix time the token's session ends.
@spec verify(term(), binary(), String.t(), integer(), phase(), String.t() | nil) :: {:ok, claims()} | {:error, reason()}
Checks token against public_key (32 bytes), the configured origin and
now (Unix seconds). phase is :start when the token first arrives, which
also requires start_by not to have passed, or :session for the cookie
on later requests, which only needs exp. With repo ("owner/name") the
token's repo claim must match it, ignoring case: a cheap check against a key
pasted from the wrong repo.