[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/secrets/ -> class-wp-secrets-config-key-provider.php (summary)

Secrets API: WP_Secrets_Config_Key_Provider class

File Size: 406 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 10 functions

  __construct()
  wrap()
  unwrap()
  get_key_status()
  get_key_source()
  get_site_key()
  is_usable_key_value()
  get_auth_constant_values()
  is_canonical_base64_32()
  decode_canonical_base64_32()

Functions
Functions that are not part of a class:

__construct( bool $use_previous_key = false )   X-Ref
Constructor.

param: bool $use_previous_key Derive from WP_SECRETS_KEY_PREVIOUS rather than

wrap(string $key_material)   X-Ref
Wraps raw key material under the derived site key.

param: string $key_material Raw key material to protect.
return: string|WP_Error

unwrap( string $wrapped )   X-Ref
Unwraps key material previously wrapped by wrap().

param: string $wrapped An opaque value previously returned by wrap().
return: string|WP_Error

get_key_status()   X-Ref
Reports the state of WP_SECRETS_KEY.

Site Health and wp_is_secrets_api_available() use this rather than the text of
get_key_source(), which is translated.

return: string One of the KEY_STATUS_* constants.

get_key_source()   X-Ref
Describes the active key source, for Site Health.

return: string

get_site_key()   X-Ref
Derives the 32-byte site key per the rules documented on this class.

return: string|WP_Error

is_usable_key_value( $value, array $auth_values )   X-Ref
Whether a candidate key constant value is usable as key material.

It must be a string that is not empty or only whitespace, must not be the
wp-config-sample.php placeholder, and must not equal any of the authentication
keys and salts.

Takes explicit arguments rather than reading the constants directly so the
decision logic is testable without touching real constants, which – once
WordPress has bootstrapped once in a process – can never be redefined to a
different value for a test.

param: mixed    $value       Candidate value of WP_SECRETS_KEY or WP_SECRETS_KEY_PREVIOUS.
param: string[] $auth_values Values of the authentication keys and salts that are defined.
return: bool

get_auth_constant_values()   X-Ref
Returns the values of the authentication keys and salts that are defined.

return: string[]

is_canonical_base64_32( $value )   X-Ref
Whether $value is the canonical base64 encoding of exactly 32 bytes.

Uses strict-mode decoding plus a re-encode comparison, rather than a bare
base64_decode(), so that a malformed or non-canonically-padded constant falls
through to the legacy (hashed) interpretation instead of being silently
accepted as 32 bytes of something else.

param: mixed $value Candidate value.
return: bool

decode_canonical_base64_32( $value )   X-Ref
Decodes $value if it is the canonical base64 encoding of exactly 32 bytes.

param: mixed $value Candidate value.
return: string|null The 32 decoded bytes, or null if $value is anything else.



Generated : Mon Nov 16 08:20:01 2026 Cross-referenced by PHPXref