|
@@ -9,38 +9,38 @@ encrypted bridge table.)
|
|
|
|
|
|
The user presents their current Lox credential:
|
|
|
- id: revealed
|
|
|
-- bucket: blinded
|
|
|
-- trust_level: blinded
|
|
|
-- level_since: blinded
|
|
|
-- invites_remaining: blinded, but proved in ZK that it's not zero
|
|
|
-- blockages: blinded
|
|
|
+- bucket: hidden
|
|
|
+- trust_level: hidden
|
|
|
+- level_since: hidden
|
|
|
+- invites_remaining: hidden, but proved in ZK that it's not zero
|
|
|
+- blockages: hidden
|
|
|
|
|
|
and a Bucket Reachability credential:
|
|
|
- date: revealed to be today
|
|
|
-- bucket: blinded, but proved in ZK that it's the same as in the Lox
|
|
|
+- bucket: hidden, but proved in ZK that it's the same as in the Lox
|
|
|
credential above
|
|
|
|
|
|
and a new Lox credential to be issued:
|
|
|
|
|
|
- id: jointly chosen by the user and BA
|
|
|
-- bucket: blinded, but proved in ZK that it's the same as in the Lox
|
|
|
+- bucket: hidden, but proved in ZK that it's the same as in the Lox
|
|
|
credential above
|
|
|
-- trust_level: blinded, but proved in ZK that it's the same as in the
|
|
|
+- trust_level: hidden, but proved in ZK that it's the same as in the
|
|
|
Lox credential above
|
|
|
-- level_since: blinded, but proved in ZK that it's the same as in the
|
|
|
+- level_since: hidden, but proved in ZK that it's the same as in the
|
|
|
Lox credential above
|
|
|
-- invites_remaining: blinded, but proved in ZK that it's one less than
|
|
|
+- invites_remaining: hidden, but proved in ZK that it's one less than
|
|
|
the number in the Lox credential above
|
|
|
-- blockages: blinded, but proved in ZK that it's the same as in the
|
|
|
+- blockages: hidden, but proved in ZK that it's the same as in the
|
|
|
Lox credential above
|
|
|
|
|
|
and a new Invitation credential to be issued:
|
|
|
|
|
|
- inv_id: jointly chosen by the user and BA
|
|
|
-- date: revealed to be today
|
|
|
-- bucket: blinded, but proved in ZK that it's the same as in the Lox
|
|
|
+- date: selected by the server to be today's date
|
|
|
+- bucket: hidden, but proved in ZK that it's the same as in the Lox
|
|
|
credential above
|
|
|
-- blockages: blinded, but proved in ZK that it's the same as in the Lox
|
|
|
+- blockages: hidden, but proved in ZK that it's the same as in the Lox
|
|
|
credential above
|
|
|
|
|
|
*/
|
|
@@ -54,7 +54,7 @@ use super::errors::CredentialError;
|
|
|
use crate::lox_creds::{BucketReachability, Invitation, Lox};
|
|
|
use cmz::*;
|
|
|
use group::Group;
|
|
|
-use rand_core::RngCore;
|
|
|
+use rand::{CryptoRng, RngCore};
|
|
|
use sha2::Sha512;
|
|
|
|
|
|
/// Invitations must be used within this many days of being issued.
|
|
@@ -66,11 +66,11 @@ muCMZProtocol! { issue_invite,
|
|
|
[L: Lox {id: R, bucket: H, trust_level: H, level_since: H, invites_remaining: H, blockages: H}, B: BucketReachability { date: R, bucket: H } ],
|
|
|
[ I: Invitation { inv_id: J, date: S, bucket: H, blockages: H }, N: Lox {id: J, bucket: H, trust_level: H, level_since: H, invites_remaining: H, blockages: H }],
|
|
|
L.bucket = B.bucket,
|
|
|
- //L.invites_remaining > 0,
|
|
|
+ L.invites_remaining != 0,
|
|
|
N.bucket = L.bucket,
|
|
|
N.trust_level = L.trust_level,
|
|
|
N.level_since = L.level_since,
|
|
|
- N.invites_remaining = L.invites_remaining - Scalar::ONE,
|
|
|
+ N.invites_remaining = L.invites_remaining - 1,
|
|
|
N.blockages = L.blockages,
|
|
|
I. bucket = L.bucket,
|
|
|
I.blockages = L.blockages
|
|
@@ -121,18 +121,13 @@ pub fn request(
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- //TODO check all values are not None
|
|
|
- let mut I = Invitation::using_pubkey(&inv_pub);
|
|
|
- let mut N = Lox::using_pubkey(&lox_pubkeys);
|
|
|
- N.bucket = L.bucket;
|
|
|
- N.trust_level = L.trust_level;
|
|
|
- N.level_since = L.level_since;
|
|
|
- N.invites_remaining = Some(L.invites_remaining.unwrap() - Scalar::ONE);
|
|
|
- N.blockages = L.blockages;
|
|
|
- I.bucket = L.bucket;
|
|
|
- I.blockages = L.blockages;
|
|
|
-
|
|
|
- match issue_invite::prepare(&mut rng, &L, &B, I, N) {
|
|
|
+ match issue_invite::prepare(
|
|
|
+ &mut rng,
|
|
|
+ &L,
|
|
|
+ &B,
|
|
|
+ Invitation::using_pubkey(&inv_pub),
|
|
|
+ Lox::using_pubkey(&lox_pubkeys),
|
|
|
+ ) {
|
|
|
Ok(req_state) => Ok(req_state),
|
|
|
Err(e) => Err(CredentialError::CMZError(e)),
|
|
|
}
|