@@ -23,6 +23,7 @@ use crate::qr::check_qr;
23
23
use crate :: securejoin:: bob:: JoinerProgress ;
24
24
use crate :: sync:: Sync :: * ;
25
25
use crate :: token;
26
+ use crate :: tools:: create_id;
26
27
use crate :: tools:: time;
27
28
28
29
mod bob;
@@ -76,10 +77,21 @@ pub async fn get_securejoin_qr(context: &Context, group: Option<ChatId>) -> Resu
76
77
let sync_token = token:: lookup ( context, Namespace :: InviteNumber , grpid)
77
78
. await ?
78
79
. is_none ( ) ;
79
- // invitenumber will be used to allow starting the handshake,
80
- // auth will be used to verify the fingerprint
80
+ // Invite number is used to request the inviter key.
81
81
let invitenumber = token:: lookup_or_new ( context, Namespace :: InviteNumber , grpid) . await ?;
82
- let auth = token:: lookup_or_new ( context, Namespace :: Auth , grpid) . await ?;
82
+
83
+ // Auth token is used to verify the key-contact
84
+ // if the token is not old
85
+ // and add the contact to the group
86
+ // if there is an associated group ID.
87
+ //
88
+ // We always generate a new auth token
89
+ // because auth tokens "expire"
90
+ // and can only be used to join groups
91
+ // without verification afterwards.
92
+ let auth = create_id ( ) ;
93
+ token:: save ( context, Namespace :: Auth , grpid, & auth) . await ?;
94
+
83
95
let self_addr = context. get_primary_self_addr ( ) . await ?;
84
96
let self_name = context
85
97
. get_config ( Config :: Displayname )
0 commit comments