Crate janus_collector

source ·
Expand description

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();

Re-exports§

Structs§

  • The result of a collection operation.
  • Collector state related to a collection job that is in progress.
  • A DAP collector.
  • Builder for configuring a Collector.
  • Serializable representation of a private collector credential, which contains all secrets a collector uses to interact with an aggregator. It contains the BearerToken for authorization to an aggregator, and the private HPKE configuration for decrypting aggregate shares.

Enums§

  • Different modes of authentication supported by Janus for either sending requests (e.g., leader to helper) or receiving them (e.g., collector to leader).
  • Errors that may occur when performing collections.
  • The result of a collection request poll operation. This will either provide the collection result or indicate that the collection is still being processed.

Functions§

Type Aliases§