Documentation
¶
Overview ¶
Package token is the mAPI-ng ingest-key wire format, shared by the client SDK (which derives its collector endpoint from the key) and the server (which authenticates the key). Keeping it in the proto module — the one module both sides already import — means client and server agree on the grammar by construction.
A key is:
mk_live_<base64url(origin)>.<secret>
where origin is the full collector origin (scheme://host[:port]) and secret is the random credential. The origin is client-only routing metadata: the server hashes and stores ONLY the secret (see Decode), so the embedded origin never affects auth and can change without invalidating a key. A key with no origin segment (mk_live_<secret>) and a bare legacy key with no prefix (e.g. the dev "dev-key") both decode to that whole value as the secret, so old keys keep working.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode parses a key into its origin (empty if none) and secret. It accepts three forms: a structured token (mk_live_<b64(origin)>.<secret>), a prefixed keyless-origin token (mk_live_<secret>), and a bare legacy secret (no prefix). ok is false only for an empty token or a structured token whose origin segment is not valid base64url or whose secret is empty.
Types ¶
This section is empty.