use crate::FieldElement;
use ark_ff::PrimeField as _;
use eddsa_babyjubjub::EdDSASignature;
const OPRF_QUERY_DS: &[u8] = b"World ID Query";
#[must_use]
pub fn oprf_query_digest(
leaf_index: u64,
action: FieldElement,
query_origin_id: FieldElement,
) -> FieldElement {
let input = [
ark_babyjubjub::Fq::from_be_bytes_mod_order(OPRF_QUERY_DS),
leaf_index.into(),
*query_origin_id,
*action,
];
poseidon2::bn254::t4::permutation(&input)[1].into()
}
pub trait ProtocolSigner {
fn sign(&self, message: FieldElement) -> EdDSASignature
where
Self: Sized + Send + Sync;
}