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.

Method of the class: Notification{}

No Hooks.

Returns

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

Usage

$Notification = new Notification();
$Notification->check_verification_key( $key ): bool;
$key(string) (required)
The key to check.

Notification::check_verification_key() code WC 10.3.6

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 );
}