Automattic\WooCommerce\Internal\StockNotifications

Notification::check_verification_keypublicWC 1.0

Check if the given key is a valid verification key.

This method checks if the key is valid by verifying the hash and checking the expiration time.

Метод класса: Notification{}

Хуков нет.

Возвращает

true|false. True if the key is valid, false otherwise.

Использование

$Notification = new Notification();
$Notification->check_verification_key( $key ): bool;
$key(строка) (обязательный)
The key to check.

Код Notification::check_verification_key() WC 10.5.2

public function check_verification_key( string $key ): bool {
	$action_key = $this->get_meta( 'email_link_action_key' );

	if ( ! str_contains( $action_key, ':' ) ) {
		return false;
	}

	list( $timestamp, $hash ) = explode( ':', $action_key, 2 );

	$threshold = Config::get_verification_expiration_time_threshold();
	if ( time() - (int) $timestamp > $threshold ) {
		return false;
	}

	return HasherHelper::wp_verify_fast_hash( $key, $hash );
}