Automattic\WooCommerce\Internal\StockNotifications

Notification::verification_key_matches │ public │ WC 11.3.0

Check whether the given key matches the stored verification key hash, ignoring expiration.

Method of the class: Notification{}

No Hooks.

Returns

bool. True if a verification key is stored and the given key matches it, false otherwise.

Usage

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

Changelog

Since 11.3.0 Introduced.

Notification::verification_key_matches() code WC 11.3.0

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

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

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

	return wp_verify_fast_hash( $key, $hash );
}