import pytest
from app.core.grpc.utils.crypto import sign_bytes, verify_bytes_signature, sign_payload, verify_signature

def test_sign_and_verify_payload():
    payload = "hello world"
    sig = sign_payload(payload)
    assert verify_signature(payload, sig) is True
    assert verify_signature(payload + "x", sig) is False

def test_sign_and_verify_bytes():
    data = b"hello world"
    sig = sign_bytes(data)
    assert verify_bytes_signature(data, sig) is True
    assert verify_bytes_signature(data + b"x", sig) is False
