Services

Secrets

v1.0.0

Default SecretsInterface implementation. Uses AES-256-GCM encryption with a site-specific key derived from WordPress salts.

Methods

public function get(string $key): ?string

Decrypt and return a stored secret. Returns null if not found.

public function set(string $key, string $value): void

Encrypt with AES-256-GCM and store.

Example

secrets.php
// Encryption is transparent:
$this->secrets->set('webhook_secret', 'whsec_...');
$secret = $this->secrets->get('webhook_secret');