DEFAULT_ID
DEFAULT_ID = 'strata_backup'
Machine name a generated key takes when nothing else is asked for.
Creates the key entity Strata seals frames with.
Encryption ships on with no key, so the shipped state of a fresh install is "every flush refuses".
Getting out of it meant knowing that the fix lives in another module, that the key type is
encryption, that the size is 256 bits and that the value has to be exactly 32 bytes - four facts
an operator setting up a backup has no reason to know. This turns all four into one button.
The value is stored in configuration, which means it is exported with the site's configuration
and captured into the store it protects. A site that loses its config export loses the key and
with it every frame ever written. A deployment that keeps secrets out of config points the key
entity at the file or env provider instead, which is the key module's own job and needs no
help from here.
available() : bool
Whether a key can be created on this site at all.
The key module is a hard dependency, so this is FALSE only where the module list and the container disagree - which is the state the 1.0.2 install bug left sites in.
TRUE when the key entity type is installed.
create(string $wanted = \self::DEFAULT_ID) : string
Creates a key holding fresh random bytes.
| string | $wanted | The machine name to prefer. A suffix is added when it is taken, so calling this twice makes two keys rather than overwriting the first - the value inside an existing key is the only copy of it, and replacing one would make everything it sealed unreadable. |
When the key entity type is not installed, or every candidate id is taken.
The machine name the key was actually saved under.