- md5
- f693e2cf5c75569457a7c6bbc73fc3cc
- sha1
- c14b7f41241d0567c050457f1b1272ce145bd9de
- sha256
- 1ad4aedfb3944c9e71f22887c00e3df47716b196e3f08b9bf1568d34073928c8
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
<?php
/**
* Secrets API: WP_Secrets_Store class
*
* @package WordPress
* @subpackage Secrets
* @since 7.2.0
*/
/**
* Where a secret's encrypted record lives.
*
* An implementation is never handed a plaintext secret, only the record array
* produced by WP_Secrets_Cipher and assembled by the functions in secrets.php, and
* cannot turn encryption off; there is no method here that accepts or returns
* anything but ciphertext-bearing structures.
*
* A platform store that is read-only from the application, with credentials managed
* by a separate CLI or dashboard, returns WP_Error from set() rather than pretending
* the write succeeded. Providers declare writability up front through
* WP_Secrets_Provider::is_writable().
*
* Implementations extend this class. It is abstract rather than an interface so
* that a later release can add a method with a default implementation, and every
* existing subclass keeps working.
*
* @since 7.2.0
*/
abstract class WP_Secrets_Store {
/**
* Reads a secret's stored record.
*
* @since 7.2.0
*
* @param string $name The secret's namespaced name.
* @param bool $network Whether this is a network-scope secret.
* @return array<mixed>|null|WP_Error The record array if it exists. Null if it does not.
* WP_Error if it could not be determined which.
*/
abstract public function get( string $name, bool $network = false );
/**
* Writes a secret's record.
*
* @since 7.2.0
*
* @param string $name The secret's namespaced name.
* @param array<mixed> $record The record to store.
* @param bool $network Whether this is a network-scope secret.
* @return bool|WP_Error True on success. WP_Error on failure, including when the
* store does not accept writes.
*/
abstract public function set( string $name, array $record, bool $network = false );
/**
* Deletes a secret's record.
*
* @since 7.2.0
*
* @param string $name The secret's namespaced name.
* @param bool $network Whether this is a network-scope secret.
* @return bool|WP_Error True on success (including if it did not exist).
* WP_Error on failure.
*/
abstract public function delete( string $name, bool $network = false );
/**
* Lists the names of every secret in this store, for this scope. Never a value.
*
* @since 7.2.0
*
* @param bool $network Whether to list network-scope secrets.
* @return string[]|WP_Error Array of secret names on success. WP_Error on failure.
*/
abstract public function list_names( bool $network = false );
}
No other release has this exact content. See every version of this file.