public static function verify(
        string $message,
        AuthenticationKey $secretKey,
        string $mac,
        $encoding = Halite::ENCODE_BASE64URLSAFE,
        SymmetricConfig $config = null
    ): bool {
        $decoder = Halite::chooseEncoder($encoding, true);
        if ($decoder) {
            // We were given hex data:
            /** @var string $mac */
            $mac = $decoder($mac);
        }
        if ($config === null) {
            // Default to the current version
            $config = SymmetricConfig::getConfig(
                Halite::HALITE_VERSION,
                'auth'
            );
        }
        try {
            return self::verifyMAC(
                $mac,
                $message,
                $secretKey->getRawKeyMaterial(),
                $config
            );
        // @codeCoverageIgnoreStart
        } catch (InvalidMessage $ex) {
            return false;
        // @codeCoverageIgnoreEnd
        }
    }
public static function verify(
        string $message,
        AuthenticationKey $secretKey,
        string $mac,
        $encoding = Halite::ENCODE_BASE64URLSAFE,
        SymmetricConfig $config = null
    ): bool {
        $decoder = Halite::chooseEncoder($encoding, true);
        if ($decoder) {
            // We were given hex data:
            /** @var string $mac */
            $mac = $decoder($mac);
        }
        if ($config === null) {
            // Default to the current version
            $config = SymmetricConfig::getConfig(
                Halite::HALITE_VERSION,
                'auth'
            );
        }
        try {
            return self::verifyMAC(
                $mac,
                $message,
                $secretKey->getRawKeyMaterial(),
                $config
            );
        // @codeCoverageIgnoreStart
        } catch (InvalidMessage $ex) {
            return false;
        // @codeCoverageIgnoreEnd
        }
    }
public static function verify ( string $ message , AuthenticationKey $ secretKey , string $ mac , $ encoding = Halite :: ENCODE_BASE64URLSAFE , SymmetricConfig $ config = null ) : bool { $ decoder = Halite :: chooseEncoder ( $ encoding , true ) ; if ( $ decoder ) { // We were given hex data: /** @var string $mac */ $ mac = $ decoder ( $ mac ) ; } if ( $ config === null ) { // Default to the current version $ config = SymmetricConfig :: getConfig ( Halite :: HALITE_VERSION , 'auth' ) ; } try { return self :: verifyMAC ( $ mac , $ message , $ secretKey -> getRawKeyMaterial ( ) , $ config ) ; // @codeCoverageIgnoreStart } catch ( InvalidMessage $ ex ) { return false ; // @codeCoverageIgnoreEnd } }
Verify the authenticity of a message, given a shared MAC key

@param string $message
@param AuthenticationKey $secretKey
@param string $mac
@param mixed $encoding
@param SymmetricConfig $config
@return bool

@throws InvalidMessage
@throws InvalidSignature
@throws InvalidType
@throws \TypeError
Verify the authenticity of a message given a shared MAC key