135 releases
new 0.7.5 | Apr 16, 2024 |
---|---|
0.7.1 | Mar 21, 2024 |
0.6.25 | Apr 16, 2024 |
0.6.7 | Dec 14, 2023 |
0.1.24 | Nov 16, 2022 |
#363 in Network programming
1,555 downloads per month
440KB
10K
SLoC
janus_collector
janus_collector
is a self-contained implementation of the Distributed Aggregation Protocol's collector role. It is intended for use with Janus and Divvi Up, ISRG's privacy-respecting metrics service. janus_collector
is published to crates.io by a GitHub Action that runs when a janus
release is created.
lib.rs
:
A DAP-PPM collector
This library implements the collector role of the DAP-PPM protocol. It works in concert with two DAP-PPM aggregator servers to compute a statistical aggregate over data from many clients, while preserving the privacy of each client's data.
Examples
use janus_collector::{AuthenticationToken, Collector};
use janus_core::{hpke::generate_hpke_config_and_private_key};
use janus_messages::{
Duration, HpkeAeadId, HpkeConfig, HpkeConfigId, HpkeKdfId, HpkeKemId, Interval, TaskId,
Time, Query,
};
use prio::vdaf::prio3::Prio3;
use rand::random;
use url::Url;
// Supply DAP task parameters.
let task_id = random();
let hpke_keypair = janus_core::hpke::generate_hpke_config_and_private_key(
HpkeConfigId::from(0),
HpkeKemId::X25519HkdfSha256,
HpkeKdfId::HkdfSha256,
HpkeAeadId::Aes128Gcm,
).unwrap();
// Supply a VDAF implementation, corresponding to this task.
let vdaf = Prio3::new_count(2).unwrap();
let collector = Collector::new(
task_id,
"https://example.com/dap/".parse().unwrap(),
AuthenticationToken::new_bearer_token_from_string("Y29sbGVjdG9yIHRva2Vu").unwrap(),
hpke_keypair,
vdaf,
)
.unwrap();
// Specify the time interval over which the aggregation should be calculated.
let interval = Interval::new(
Time::from_seconds_since_epoch(1_656_000_000),
Duration::from_seconds(3600),
)
.unwrap();
// Make the requests and retrieve the aggregated statistic.
let aggregation_result = collector.collect(Query::new_time_interval(interval), &()).await.unwrap();
Dependencies
~38–54MB
~1M SLoC