<?php

/**
 * Abstract class for a simple nonce route.
 *
 * @package northmill-online-shared
 */
declare (strict_types=1);
namespace Northmill_Online_Shared_Sync\Northmill_Online_Shared\Abstracts\REST;

use Northmill_Online_Shared_Sync\Northmill_Online_Shared\Helpers\Simple_Nonce;
defined('ABSPATH') || exit;
/**
 * Class Abstract_Simple_Nonce_Route
 *
 * @used Express Order
 */
abstract class Abstract_Route_Simple_Nonce extends Abstract_Route
{
    /**
     * {@inheritDoc}
     */
    protected function default_args(): array
    {
        return array('_nonce' => array('description' => 'Nonce for the request.', 'type' => 'string', 'required' => \true, 'validate_callback' => array($this, 'verify_nonce')));
    }
    /**
     * Verifies the provided nonce.
     *
     * @param string $param The nonce to verify.
     *
     * @return bool
     */
    public function verify_nonce(string $param): bool
    {
        return (bool) Simple_Nonce::verify($param, $this->api->get_nonce_action());
    }
}
