FINGERPRINT_CONTEXT
FINGERPRINT_CONTEXT = 'strata-key-fingerprint-v1'
Personalisation for the fingerprint, so it can never collide with another use of the key.
Holds a key in memory.
Used by the test lanes and by a CLI run that is handed a key directly. A site uses the key
module instead, so that the key is not in configuration a database dump would carry.
__construct(string $key) : mixed
Constructs a provider around raw key bytes.
| string | $key | Exactly KeyProviderInterface::KEY_BYTES bytes. |
When the key is the wrong length. Refused rather than stretched or truncated, because either would give a false impression of the strength in use.
fromStored(string $value) : self
Builds a provider from whatever a key entity holds.
A stored key is raw bytes or the hex of them, and which one it is has to be decided by looking
at it. This is the one place that decides, because the same ternary was written out in
Engine::keyProviderFor(), in strata_key_value_requirement() and on the storage form, and
three copies of an acceptance rule are how the form comes to accept a key the engine refuses.
| string | $value | The stored value. |
When the value is neither the right number of raw bytes nor the hex of them.
A provider holding the key.