Automattic\WooCommerce\StoreApi\Utilities

AgenticCheckoutUtils::validate_jetpack_requestpublic staticWC 10.6.0

Validate that the request is signed with Jetpack blog token.

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

Хуков нет.

Возвращает

true|\WP_Error. True if valid, WP_Error otherwise.

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

$result = AgenticCheckoutUtils::validate_jetpack_request();

Список изменений

С версии 10.6.0 Введена.

Код AgenticCheckoutUtils::validate_jetpack_request() WC 11.0.1

public static function validate_jetpack_request() {
	if ( class_exists( 'Automattic\Jetpack\Connection\Rest_Authentication' ) ) {
		if ( \Automattic\Jetpack\Connection\Rest_Authentication::is_signed_with_blog_token() ) {
			return true;
		}
	}

	return new \WP_Error(
		'rest_forbidden',
		__( 'This endpoint requires Jetpack blog token authentication.', 'woocommerce' ),
		array( 'status' => 401 )
	);
}