Arcana::Auth::ApiKey
An API key. The full secret is shown exactly once (at creation time) and never stored — only its SHA-256 hash and a public prefix are persisted.
Format: ak_<32 random base36-ish chars>
prefix = first 11 characters (e.g. "ak_a1b2c3d4")
hash = SHA-256 of the full string
org_id is nullable to allow a system-wide platform admin key.
All other keys are scoped to exactly one org.
Constants
Constructors
Class methods
Create a new API key. Returns a tuple of {ApiKey, plaintext_secret} — the plaintext is only available here, exactly once.
Look up an active key by its prefix (the publicly visible part).
Instance methods
Generates an UInt64 hash value for this object.
This method must have the property that a == b implies a.hash == b.hash.
The hash value is used along with == by the Hash class to determine if two objects
reference the same hash key.
Subclasses must not override this method. Instead, they must define hash(hasher),
though usually the macro def_hash can be used to generate this method.