Crates.io | chalametpir_client |
lib.rs | chalametpir_client |
version | 0.8.0 |
created_at | 2025-05-11 18:27:08.251892+00 |
updated_at | 2025-07-11 06:03:06.051017+00 |
description | Client Implementation of ChalametPIR: Simple, Stateful, Single-Server Private Information Retrieval for Key-Value Databases |
homepage | |
repository | https://github.com/itzmeanjan/ChalametPIR.git |
max_upload_size | |
id | 1669608 |
size | 36,665 |
Client Implementation of ChalametPIR: Simple, Stateful, Single-Server Private Information Retrieval for Key-Value Databases.
This crate provides the client-side implementation for the ChalametPIR protocol. It includes functionality for:
Key components:
Client
: The main struct for interacting with the PIR client. It handles query generation and response processing.Query
: Represents a PIR query, containing the secret vector needed to recover the value from the server's response.Add these dependencies to your Cargo.toml
:
chalametpir_client = "=0.8.0"
use chalametpir_client::{Client, SEED_BYTE_LEN};
fn main() {
// Assume seed, hint_bytes and filter_param_bytes are received from the PIR server
let seed_μ = [0u8; SEED_BYTE_LEN];
let hint_bytes = vec![0u8; 0];
let filter_param_bytes = vec![0u8; 0];
match Client::setup(&seed_μ, &hint_bytes, &filter_param_bytes) {
Ok(mut client) => {
let key = b"example_key";
if let Ok(query) = client.query(key) {
println!("Generated query for key: {:?}", key);
// Send query to PIR server
let response = vec![0u8; 0];
if let Ok(value) = client.process_response(key, &response) {
println!("Received response {:?}", response);
}
}
}
Err(err) => {
println!("Client setup failed: {}", err);
}
};
}
[!IMPORTANT] ChalametPIR clients can run in-browser, by enabling
wasm
feature.
[!NOTE] More documentation on ChalametPIR here.