Added Bridgeline to open-entry
This commit is contained in:
parent
a56ac87868
commit
3eb6aedfaf
|
@ -22,7 +22,7 @@ use zkp::CompactProof;
|
|||
use zkp::ProofError;
|
||||
use zkp::Transcript;
|
||||
|
||||
use super::super::bridge_table;
|
||||
use super::super::{{bridge_table, BridgeLine}};
|
||||
use super::super::cred;
|
||||
use super::super::dup_filter::SeenType;
|
||||
use super::super::OPENINV_LENGTH;
|
||||
|
@ -55,6 +55,7 @@ pub struct Response {
|
|||
bucket: Scalar,
|
||||
level_since: Scalar,
|
||||
piBlindIssue: CompactProof,
|
||||
bridge_line: BridgeLine,
|
||||
}
|
||||
|
||||
// The userblinding ZKP
|
||||
|
@ -189,6 +190,8 @@ impl BridgeAuth {
|
|||
// of the bucket id (u32) and the bucket's decryption key ([u8; 16])
|
||||
let bucket_key = self.bridge_table.keys[bucket_id];
|
||||
let bucket: Scalar = bridge_table::to_scalar(bucket_id_u32, &bucket_key);
|
||||
let pre_line = self.bridge_table.decrypt_bucket_id(bucket_id_u32, &bucket_key).unwrap().0;
|
||||
let bridge_line: BridgeLine = pre_line[0];
|
||||
|
||||
// Create the level_since attribute (Scalar), which is today's
|
||||
// Julian date
|
||||
|
@ -253,6 +256,7 @@ impl BridgeAuth {
|
|||
bucket,
|
||||
level_since,
|
||||
piBlindIssue,
|
||||
bridge_line,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +267,7 @@ pub fn handle_response(
|
|||
state: State,
|
||||
resp: Response,
|
||||
lox_pub: &IssuerPubKey,
|
||||
) -> Result<cred::Lox, ProofError> {
|
||||
) -> Result<(cred::Lox, bridge_table::BridgeLine), ProofError> {
|
||||
let A: &RistrettoPoint = &CMZ_A;
|
||||
let B: &RistrettoPoint = &CMZ_B;
|
||||
let Btable: &RistrettoBasepointTable = &CMZ_B_TABLE;
|
||||
|
@ -307,7 +311,7 @@ pub fn handle_response(
|
|||
// Decrypt EncQ
|
||||
let Q = resp.EncQ.1 - (state.d * resp.EncQ.0);
|
||||
|
||||
Ok(cred::Lox {
|
||||
Ok((cred::Lox {
|
||||
P: resp.P,
|
||||
Q,
|
||||
id,
|
||||
|
@ -316,5 +320,7 @@ pub fn handle_response(
|
|||
level_since: resp.level_since,
|
||||
invites_remaining: Scalar::zero(),
|
||||
blockages: Scalar::zero(),
|
||||
})
|
||||
},
|
||||
resp.bridge_line,
|
||||
))
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ impl TestHarness {
|
|||
self.ba.advance_days(days);
|
||||
}
|
||||
|
||||
fn open_invite(&mut self) -> cred::Lox {
|
||||
fn open_invite(&mut self) -> (cred::Lox, bridge_table::BridgeLine) {
|
||||
// Issue an open invitation
|
||||
let inv = self.bdb.invite();
|
||||
|
||||
|
@ -141,7 +141,7 @@ fn test_open_invite() {
|
|||
let mut th = TestHarness::new();
|
||||
|
||||
// Join an untrusted user
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
|
||||
// Check that we can use the credential to read a bucket
|
||||
let (id, key) = bridge_table::from_scalar(cred.bucket).unwrap();
|
||||
|
@ -158,7 +158,7 @@ fn test_open_invite() {
|
|||
fn test_trust_promotion() {
|
||||
let mut th = TestHarness::new();
|
||||
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
assert!(th.ba.verify_lox(&cred));
|
||||
|
||||
// Time passes
|
||||
|
@ -181,7 +181,7 @@ fn test_trust_promotion() {
|
|||
fn test_level0_migration() {
|
||||
let mut th = TestHarness::new();
|
||||
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
assert!(th.ba.verify_lox(&cred));
|
||||
|
||||
// Time passes
|
||||
|
@ -208,7 +208,7 @@ fn test_level_up() {
|
|||
let mut th = TestHarness::new();
|
||||
|
||||
// Join an untrusted user
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
|
||||
// Time passes
|
||||
th.advance_days(47);
|
||||
|
@ -248,7 +248,7 @@ fn test_issue_invite() {
|
|||
let mut th = TestHarness::new();
|
||||
|
||||
// Join an untrusted user
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
|
||||
// Time passes
|
||||
th.advance_days(47);
|
||||
|
@ -280,7 +280,7 @@ fn test_redeem_invite() {
|
|||
let mut th = TestHarness::new();
|
||||
|
||||
// Join an untrusted user
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
|
||||
// Time passes
|
||||
th.advance_days(47);
|
||||
|
@ -370,7 +370,7 @@ fn test_blockage_migration() {
|
|||
let mut th = TestHarness::new();
|
||||
|
||||
// Join an untrusted user
|
||||
let cred = th.open_invite();
|
||||
let cred = th.open_invite().0;
|
||||
|
||||
// Time passes
|
||||
th.advance_days(47);
|
||||
|
|
Loading…
Reference in New Issue