Have redeem_invite function also return user's bucket
This commit is contained in:
parent
5acbd6845c
commit
d0f7391f49
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue