Yoast\WP\SEO\MyYoast_Client\Infrastructure\Crypto
Key_Pair_Manager::store_key_pair
Persists a key pair (encrypting the private key).
Метод класса: Key_Pair_Manager{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Key_Pair_Manager = new Key_Pair_Manager(); $Key_Pair_Manager->store_key_pair( $purpose, $key_pair ): void;
- $purpose(строка) (обязательный)
- One of the PURPOSE_* constants.
- $key_pair(Key_Pair) (обязательный)
- The key pair to store.
Код Key_Pair_Manager::store_key_pair() Key Pair Manager::store key pair Yoast 27.7
public function store_key_pair( string $purpose, Key_Pair $key_pair ): void {
$option_key = $this->get_option_key( $purpose );
$encrypted_private = $this->encryption->encrypt(
$key_pair->get_private_key(),
self::CONTEXT_PREFIX . $purpose,
);
\update_option(
$option_key,
[
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- Binary Ed25519 key needs safe encoding.
'public_key' => \base64_encode( $key_pair->get_public_key() ),
'private_key_encrypted' => $encrypted_private,
'kid' => $key_pair->get_kid(),
'created_at' => \time(),
],
false,
);
$this->cached_key_pairs[ $option_key ] = $key_pair;
}