瀏覽代碼

Have redeem_invite function also return user's bucket

Vecna 8 月之前
父節點
當前提交
d0f7391f49
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 4 2
      src/client_lib.rs
  2. 1 2
      src/main.rs

+ 4 - 2
src/client_lib.rs

@@ -252,14 +252,16 @@ pub async fn redeem_invite(
     invite: &lox_library::cred::Invitation,
     lox_pub: &IssuerPubKey,
     invitation_pub: &IssuerPubKey,
-) -> lox_library::cred::Lox {
+) -> (lox_library::cred::Lox, [BridgeLine; MAX_BRIDGES_PER_BUCKET]) {
     let (req, state) =
         redeem_invite::request(invite, invitation_pub, get_today(net).await).unwrap();
     let encoded_req: Vec<u8> = serde_json::to_vec(&req).unwrap();
     let encoded_resp = net.request("/redeem".to_string(), encoded_req).await;
     let decoded_resp: redeem_invite::Response = serde_json::from_slice(&encoded_resp).unwrap();
     let cred = redeem_invite::handle_response(state, decoded_resp, lox_pub).unwrap();
-    cred
+
+    let bucket = get_bucket(net, &cred).await;
+    (cred, bucket)
 }
 
 // Check for a migration credential to move to a new bucket

+ 1 - 2
src/main.rs

@@ -108,14 +108,13 @@ async fn main() {
         // redeem invite
         let invite_infile = File::open(invite_filename).unwrap();
         let invite = serde_json::from_reader(invite_infile).unwrap();
-        let cred = redeem_invite(
+        let (cred, bucket) = redeem_invite(
             &net,
             &invite,
             get_lox_pub(&lox_auth_pubkeys),
             get_invitation_pub(&lox_auth_pubkeys),
         )
         .await;
-        let bucket = get_bucket(&net, &cred).await;
 
         // save to files for future use
         save_object(&cred, &lox_cred_filename);