19declare(strict_types=1);
68 $stored = is_file($path) ? @include $path : [];
72 array_values(array_filter(is_array($stored) ? $stored : [],
'is_string'))
77 return new self($current_key, ...$keys);
82 return new SecretKey(bin2hex(random_bytes(32)));
87 return array_merge([$this->current_key], $this->older_keys);
97 return $this->current_key;
Key rotation can provide an extra layer of mitigation against an attacker discovering a secret key.
__construct(private SecretKey $current_key, SecretKey ... $older_keys)
static fromArtefact(string $path)
Load a rotation from a static PHP artefact written by the setup, newest key first.
Signatures are secured by the secret_key.