cred.rs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*! The various credentials used by the system.
  2. In each case, (P,Q) forms the MAC on the credential. This MAC is
  3. verifiable only by the issuing party, or if the issuing party issues a
  4. zero-knowledge proof of its correctness (as it does at issuing time). */
  5. use curve25519_dalek::ristretto::RistrettoPoint;
  6. use curve25519_dalek::scalar::Scalar;
  7. /// A migration credential. This credential authorizes the holder of
  8. /// the Lox credential with the given id to switch from bucket
  9. /// from_bucket to bucket to_bucket.
  10. #[derive(Debug)]
  11. pub struct Migration {
  12. pub P: RistrettoPoint,
  13. pub Q: RistrettoPoint,
  14. pub lox_id: Scalar,
  15. pub from_bucket: Scalar,
  16. pub to_bucket: Scalar,
  17. }
  18. /// The main user credential in the Lox system. Its id is jointly
  19. /// generated by the user and the BA (bridge authority), but known only
  20. /// to the user. The level_since date is the Julian date of when this
  21. /// user was changed to the current trust level. (P_noopmigration,
  22. /// Q_noopmigration) are the MAC on the implicit no-op migration
  23. /// credential formed by the attributes (id, bucket, bucket), which
  24. /// authorizes the user to switch from its current bucket to the same
  25. /// bucket (i.e., a no-op). This can be useful for hiding from the BA
  26. /// whether or not the user is performing a bucket migration.
  27. #[derive(Debug)]
  28. pub struct Lox {
  29. pub P: RistrettoPoint,
  30. pub Q: RistrettoPoint,
  31. pub id: Scalar,
  32. pub bucket: Scalar,
  33. pub trust_level: Scalar,
  34. pub level_since: Scalar,
  35. pub invites_remaining: Scalar,
  36. pub invites_issued: Scalar,
  37. pub P_noopmigration: RistrettoPoint,
  38. pub Q_noopmigration: RistrettoPoint,
  39. }