<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;

class SidHash implements Rule
{

    public function passes($attribute, $value)
    {
        if (!is_string($value)) {
            return false;
        }

        return preg_match('/^[a-f0-9]{128}$/i', $value) === 1;
    }

    public function message()
    {
        return 'The :attribute must be a valid SID hash.';
    }
}
