Add README for rdsys-backend-api, lox-utils and switch to lox-zkp crate
This commit is contained in:
parent
a27df0b6c6
commit
472445a9a5
|
@ -1055,6 +1055,7 @@ dependencies = [
|
|||
"hyper",
|
||||
"julianday",
|
||||
"lox-library",
|
||||
"lox-zkp",
|
||||
"lox_utils",
|
||||
"prometheus",
|
||||
"prometheus-client",
|
||||
|
@ -1067,7 +1068,6 @@ dependencies = [
|
|||
"sled",
|
||||
"time",
|
||||
"tokio",
|
||||
"zkp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1082,6 +1082,7 @@ dependencies = [
|
|||
"ed25519-dalek",
|
||||
"hex_fmt",
|
||||
"lazy_static",
|
||||
"lox-zkp",
|
||||
"prometheus",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
|
@ -1091,7 +1092,6 @@ dependencies = [
|
|||
"subtle",
|
||||
"thiserror",
|
||||
"time",
|
||||
"zkp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1105,12 +1105,25 @@ dependencies = [
|
|||
"julianday",
|
||||
"lazy_static",
|
||||
"lox-library",
|
||||
"lox-zkp",
|
||||
"lox_utils",
|
||||
"rand 0.7.3",
|
||||
"serde_json",
|
||||
"time",
|
||||
"wasm-bindgen",
|
||||
"zkp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lox-zkp"
|
||||
version = "0.8.0"
|
||||
source = "git+https://gitlab.torproject.org/onyinyang/lox-zkp#10a8379081f079fc09669640f29c255897b3b454"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"merlin",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2529,16 +2542,3 @@ dependencies = [
|
|||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zkp"
|
||||
version = "0.8.0"
|
||||
source = "git+https://gitlab.torproject.org/onyinyang/lox-zkp#7dc7562ecdac3a6c7c7ecc31cace192174d34778"
|
||||
dependencies = [
|
||||
"curve25519-dalek",
|
||||
"merlin",
|
||||
"rand 0.8.5",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"thiserror",
|
||||
]
|
||||
|
|
|
@ -26,7 +26,7 @@ rand = "0.8.5"
|
|||
reqwest = { version = "0.11", features = ["json", "stream"]}
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
serde_with = "3.4.0"
|
||||
zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" }
|
||||
lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" }
|
||||
lox-library = { path = "../lox-library", version = "0.1.0"}
|
||||
lox_utils = { path = "../lox-utils", version = "0.1.0"}
|
||||
rdsys_backend = { path = "../rdsys-backend-api", version = "0.2"}
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::{
|
|||
collections::HashMap,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use zkp::ProofError;
|
||||
use lox_zkp::ProofError;
|
||||
|
||||
use crate::metrics::Metrics;
|
||||
use crate::resource_parser::{parse_into_bridgelines, sort_for_parsing};
|
||||
|
|
|
@ -31,7 +31,7 @@ time = "0.3.30"
|
|||
prometheus = "0.13.3"
|
||||
subtle = "2.5"
|
||||
thiserror = "1.0.50"
|
||||
zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" }
|
||||
lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" }
|
||||
|
||||
[features]
|
||||
fast = []
|
||||
|
|
|
@ -15,7 +15,7 @@ The notation follows that of the paper "Hyphae: Social Secret Sharing"
|
|||
#![allow(non_snake_case)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate zkp;
|
||||
extern crate lox_zkp;
|
||||
|
||||
pub mod bridge_table;
|
||||
pub mod cred;
|
||||
|
|
|
@ -37,9 +37,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -76,7 +76,7 @@ pub struct Request {
|
|||
EncBucket: (RistrettoPoint, RistrettoPoint),
|
||||
EncBlockages: (RistrettoPoint, RistrettoPoint),
|
||||
|
||||
// The combined ZKP
|
||||
// The combined lox_zkp
|
||||
piUser: CompactProof,
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ pub struct Response {
|
|||
TBucket: RistrettoPoint,
|
||||
TBlockages: RistrettoPoint,
|
||||
|
||||
// The ZKP
|
||||
// The lox_zkp
|
||||
piBlindIssue: CompactProof,
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ pub fn request(
|
|||
|
||||
// Form a Pedersen commitment to the MAC Q
|
||||
// We flip the sign of zQ from that of the Hyphae paper so that
|
||||
// the ZKP has a "+" instead of a "-", as that's what the zkp
|
||||
// the lox_zkp has a "+" instead of a "-", as that's what the zkp
|
||||
// macro supports.
|
||||
let negzQ_lox = Scalar::random(&mut rng);
|
||||
let CQ_lox = Q_lox - &negzQ_lox * Atable;
|
||||
|
@ -251,7 +251,7 @@ pub fn request(
|
|||
|
||||
// Form a Pedersen commitment to the MAC Q
|
||||
// We flip the sign of zQ from that of the Hyphae paper so that
|
||||
// the ZKP has a "+" instead of a "-", as that's what the zkp
|
||||
// the lox_zkp has a "+" instead of a "-", as that's what the zkp
|
||||
// macro supports.
|
||||
let negzQ_mig = Scalar::random(&mut rng);
|
||||
let CQ_mig = Q_mig - &negzQ_mig * Atable;
|
||||
|
@ -416,7 +416,7 @@ impl BridgeAuth {
|
|||
+ self.migration_priv.x[3] * req.CToBucket
|
||||
- req.CQ_mig;
|
||||
|
||||
// Verify the ZKP
|
||||
// Verify the zkp
|
||||
let mut transcript = Transcript::new(b"blockage migration request");
|
||||
requestproof::verify_compact(
|
||||
&req.piUser,
|
||||
|
|
|
@ -33,9 +33,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::serde_as;
|
||||
|
@ -69,7 +69,7 @@ pub struct Request {
|
|||
D: RistrettoPoint,
|
||||
EncBucket: (RistrettoPoint, RistrettoPoint),
|
||||
|
||||
// The combined ZKP
|
||||
// The combined lox_zkp
|
||||
piUser: CompactProof,
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ pub fn request(
|
|||
|
||||
// Form a Pedersen commitment to the MAC Q
|
||||
// We flip the sign of zQ from that of the Hyphae paper so that
|
||||
// the ZKP has a "+" instead of a "-", as that's what the zkp
|
||||
// the lox_zkp has a "+" instead of a "-", as that's what the lox_zkp
|
||||
// macro supports.
|
||||
let negzQ = Scalar::random(&mut rng);
|
||||
let CQ = Q - &negzQ * Atable;
|
||||
|
@ -268,7 +268,7 @@ impl BridgeAuth {
|
|||
+ self.lox_priv.x[6] * req.CBlockages
|
||||
- req.CQ;
|
||||
|
||||
// Verify the ZKP
|
||||
// Verify the zkp
|
||||
let mut transcript = Transcript::new(b"check blockage request");
|
||||
requestproof::verify_compact(
|
||||
&req.piUser,
|
||||
|
|
|
@ -50,9 +50,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::serde_as;
|
||||
|
|
|
@ -26,9 +26,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ use curve25519_dalek::ristretto::RistrettoPoint;
|
|||
use curve25519_dalek::scalar::Scalar;
|
||||
use curve25519_dalek::traits::IsIdentity;
|
||||
|
||||
use zkp::CompactProof;
|
||||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
use lox_zkp::CompactProof;
|
||||
use lox_zkp::ProofError;
|
||||
use lox_zkp::Transcript;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::serde_as;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Lox Utils
|
||||
|
||||
This crate contains a number of helper structs and functions that are used by multiple lox crates.
|
|
@ -27,7 +27,7 @@ serde_json = "1.0.108"
|
|||
console_error_panic_hook = "0.1.7"
|
||||
js-sys = "0.3.65"
|
||||
rand = { version = "0.7", features = ["wasm-bindgen"] }
|
||||
zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" }
|
||||
lox-zkp = { git = "https://gitlab.torproject.org/onyinyang/lox-zkp", version = "0.8.0" }
|
||||
|
||||
[dependencies.chrono]
|
||||
version = "0.4.31"
|
||||
|
|
|
@ -4,6 +4,7 @@ authors = ["Cecylia Bocovich <cohosh@torproject.org>, Lindsey Tulloch <onyinyang
|
|||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A backend API to receive resources from rdsys"
|
||||
homepage = "https://gitlab.torproject.org/tpo/anti-censorship/lox/-/wikis/home"
|
||||
keywords = ["tor", "lox", "bridges","censorship-resistance"]
|
||||
categories = ["api-bindings", "encoding"]
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
# rdsys backend API
|
||||
|
||||
### Usage
|
||||
The rdsys backend API allows a process to receive resources from rdsys through either of rdsys' two endpoints.
|
||||
|
||||
```rust
|
||||
### Usage with Stream Endpoint
|
||||
|
||||
To test or receive a resourcediff from rdsys, the rdsys `resource-stream` endpoint can be accessed with the following sample code:
|
||||
|
||||
```
|
||||
use rdsys_backend::start_stream;
|
||||
use tokio;
|
||||
|
||||
|
@ -18,3 +22,22 @@ async fn main() {
|
|||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Usage with Static Request Endpoint
|
||||
|
||||
To test or receive a ResourceState from rdsys, the `resources` endpoint can be accessed with the following sample code:
|
||||
|
||||
```
|
||||
use rdsys_backend::request_resources;
|
||||
use tokio;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let endpoint = String::from("http://127.0.0.1:7100/resources");
|
||||
let name = String::from("https");
|
||||
let token = String::from("HttpsApiTokenPlaceholder");
|
||||
let types = vec![String::from("obfs4"), String::from("scramblesuit")];
|
||||
let rx = request_resources(endpoint, name, token, types).await.unwrap();
|
||||
println!("Received ResourceState: {:?}", rx);
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue