private static function verifySignature($signature, $expectedSignature = null)
    {
        if (!isset($expectedSignature) && !isset(RpayLite::$webhookSignature)) {
            throw new Error\SignatureVerification('Webhook Signature is not defined.');
        }
        $expected = $expectedSignature ? $expectedSignature : RpayLite::$webhookSignature;
        if (!is_string($signature) || !is_string($expected)) {
            throw new Error\SignatureVerification('Webhook Signature is not string.');
        }
        if ($signature !== $expected) {
            throw new Error\SignatureVerification("Webhook Signature is invalid.");
        }
        return true;
    }