CoolrfulDARkness/moonvoprf/voprf does not have a README file

    VoprfError

    pub suberror VoprfError {
    InvalidElement
    InvalidScalar
    InvalidInput
    InvalidProof
    DeriveKeyPairError
    InverseError
    ModeMismatch
    LengthMismatch
    EmptyBatch
    InternalError(String)
    } derive(Eq,
    Debug
    )

    BlindState

    pub(all) struct BlindState {
    suite : CipherSuite
    mode : Mode
    blind : Bytes
    input : Bytes
    blinded_element : Bytes
    } derive(Eq,
    Debug
    )

    Client blinding state retained between Blind and Finalize.

    CipherSuite

    pub(all) enum CipherSuite {
    Ristretto255Sha512
    P256Sha256
    } derive(Eq,
    Debug
    )

    CipherSuite::element_size

    fn CipherSuite::element_size(self : CipherSuite) -> Int

    Serialized group element length Ne in bytes (32 for Ristretto255, 33 for P-256).

    CipherSuite::hash_size

    fn CipherSuite::hash_size(self : CipherSuite) -> Int

    Hash output length Nh in bytes (64 for SHA-512, 32 for SHA-256).

    CipherSuite::identifier

    fn CipherSuite::identifier(self : CipherSuite) -> Bytes

    Returns the exact RFC 9497 §4 ASCII ciphersuite identifier string.

    CipherSuite::proof_size

    fn CipherSuite::proof_size(self : CipherSuite) -> Int

    Serialized DLEQ proof length 2 * Ns in bytes (64 for both suites).

    CipherSuite::scalar_size

    fn CipherSuite::scalar_size(self : CipherSuite) -> Int

    Serialized scalar length Ns in bytes (32 for both suites).

    KeyPair

    pub(all) struct KeyPair {
    sk : Bytes
    pk : Bytes
    suite : CipherSuite
    } derive(Eq,
    Debug
    )

    Server key pair (sk, pk) bound to a specific CipherSuite.

    Mode

    pub(all) enum Mode {
    Oprf
    Voprf
    Poprf
    } derive(Eq,
    Debug
    )

    Mode::to_byte

    fn Mode::to_byte(self : Mode) -> Byte

    Returns the RFC 9497 §3.1 1-byte protocol mode identifier (0x00/0x01/0x02).

    Proof

    pub(all) struct Proof {
    c : Bytes
    s : Bytes
    } derive(Eq,
    Debug
    )

    RFC 9497 §2.2 DLEQ zero-knowledge proof (c, s) serialized as canonical scalars.

    Proof::from_bytes

    fn Proof::from_bytes(suite : CipherSuite, data : Bytes) -> Proof raise VoprfError

    Strictly deserializes a Proof (c || s) for suite, validating that both c and s are canonical scalars for suite.

    Proof::to_bytes

    fn Proof::to_bytes(self : Proof) -> Bytes

    Serializes a DLEQ proof as c || s (2 * Ns bytes).

    derive_key_pair

    fn derive_key_pair(suite : CipherSuite, seed : Bytes, info : Bytes) -> KeyPair raise VoprfError

    RFC 9497 §3.2.1 DeriveKeyPair(seed, info) using the default Voprf mode context. Use derive_key_pair_for_mode when deriving mode-specific OPRF or POPRF keys.

    derive_key_pair_for_mode

    fn derive_key_pair_for_mode(suite : CipherSuite, mode : Mode, seed : Bytes, info : Bytes) -> KeyPair raise VoprfError

    RFC 9497 §3.2.1 DeriveKeyPair(seed, info) parameterized by mode (DST = "DeriveKeyPair" || CreateContextString(mode, suite)). Iterates counter = 0..255 rejecting zero scalars; raises DeriveKeyPairError if all 256 iterations yield zero.

    oprf_blind

    fn oprf_blind(suite : CipherSuite, input : Bytes, seed : Bytes) -> BlindState raise VoprfError

    oprf_blind_evaluate

    fn oprf_blind_evaluate(suite : CipherSuite, sk : Bytes, blinded_element : Bytes) -> Bytes raise VoprfError

    oprf_blind_with_scalar

    fn oprf_blind_with_scalar(suite : CipherSuite, input : Bytes, blind_scalar_bytes : Bytes) -> BlindState raise VoprfError

    oprf_finalize

    fn oprf_finalize(state : BlindState, evaluated_element : Bytes) -> Bytes raise VoprfError

    oprf_full_evaluate

    fn oprf_full_evaluate(suite : CipherSuite, sk : Bytes, input : Bytes) -> Bytes raise VoprfError

    poprf_blind

    fn poprf_blind(suite : CipherSuite, input : Bytes, seed : Bytes) -> BlindState raise VoprfError

    poprf_blind_evaluate

    fn poprf_blind_evaluate(suite : CipherSuite, sk : Bytes, pk : Bytes, blinded_elements : Array[Bytes], info : Bytes, seed : Bytes) -> (Array[Bytes], Proof) raise VoprfError

    poprf_blind_evaluate_with_r

    fn poprf_blind_evaluate_with_r(suite : CipherSuite, sk : Bytes, pk : Bytes, blinded_elements : Array[Bytes], info : Bytes, proof_r : Bytes) -> (Array[Bytes], Proof) raise VoprfError

    poprf_blind_with_scalar

    fn poprf_blind_with_scalar(suite : CipherSuite, input : Bytes, blind_scalar_bytes : Bytes) -> BlindState raise VoprfError

    poprf_finalize

    fn poprf_finalize(state : BlindState, pk : Bytes, evaluated_element : Bytes, info : Bytes, proof : Proof) -> Bytes raise VoprfError

    poprf_finalize_batch

    fn poprf_finalize_batch(states : Array[BlindState], pk : Bytes, evaluated_elements : Array[Bytes], info : Bytes, proof : Proof) -> Array[Bytes] raise VoprfError

    poprf_full_evaluate

    fn poprf_full_evaluate(suite : CipherSuite, sk : Bytes, input : Bytes, info : Bytes) -> Bytes raise VoprfError

    public_key_from_sk

    fn public_key_from_sk(suite : CipherSuite, sk : Bytes) -> Bytes raise VoprfError

    Computes the serialized public key pk = sk * G from a canonical non-zero secret key sk.

    validate_public_key

    fn validate_public_key(suite : CipherSuite, pk : Bytes) -> Unit raise VoprfError

    Strictly validates that pk is a canonical, non-identity prime-order group element for suite.

    voprf_blind

    fn voprf_blind(suite : CipherSuite, input : Bytes, seed : Bytes) -> BlindState raise VoprfError

    voprf_blind_evaluate

    fn voprf_blind_evaluate(suite : CipherSuite, sk : Bytes, pk : Bytes, blinded_elements : Array[Bytes], seed : Bytes) -> (Array[Bytes], Proof) raise VoprfError

    voprf_blind_evaluate_with_r

    fn voprf_blind_evaluate_with_r(suite : CipherSuite, sk : Bytes, pk : Bytes, blinded_elements : Array[Bytes], proof_r : Bytes) -> (Array[Bytes], Proof) raise VoprfError

    voprf_blind_with_scalar

    fn voprf_blind_with_scalar(suite : CipherSuite, input : Bytes, blind_scalar_bytes : Bytes) -> BlindState raise VoprfError

    voprf_finalize

    fn voprf_finalize(state : BlindState, pk : Bytes, evaluated_element : Bytes, proof : Proof) -> Bytes raise VoprfError

    voprf_finalize_batch

    fn voprf_finalize_batch(states : Array[BlindState], pk : Bytes, evaluated_elements : Array[Bytes], proof : Proof) -> Array[Bytes] raise VoprfError

    voprf_full_evaluate

    fn voprf_full_evaluate(suite : CipherSuite, sk : Bytes, input : Bytes) -> Bytes raise VoprfError