Module oprf

Module oprf 

Source
Expand description

Oblivious Pseudorandom Function (OPRF) implementation.

OPRF allows a client to compute PRF(key, input) where:

  • Server holds the secret key
  • Client provides the input
  • Server learns nothing about the input
  • Client learns only PRF(key, input), not the key

Perfect for:

  • Private rate limiting (check if user exceeded quota without revealing identity)
  • Password-authenticated key exchange
  • Anonymous credentials
  • Privacy-preserving set membership tests

§Example

use chie_crypto::oprf::{OprfServer, OprfClient};

// Server setup
let server = OprfServer::new();

// Client blind request
let input = b"user@example.com";
let (client, blinded_input) = OprfClient::blind(input);

// Server evaluates on blinded input
let blinded_output = server.evaluate(&blinded_input);

// Client unblinds to get PRF output
let prf_output = client.unblind(&blinded_output);

// Can verify this matches direct evaluation (for testing)
assert_eq!(prf_output, server.evaluate_direct(input));

Structs§

BatchOprfClient
Batch OPRF client for multiple inputs.
BlindedInput
Blinded input sent from client to server.
BlindedOutput
Blinded output sent from server to client.
OprfClient
OPRF client state during the protocol.
OprfOutput
PRF output after unblinding.
OprfServer
OPRF server holding the secret key.

Enums§

OprfError
OPRF error types.

Type Aliases§

OprfResult