@@ -66,16 +66,16 @@ type sessionsDict struct {
6666 // If a UIA session is started by trying to delete device1, and then UIA is completed by deleting device2,
6767 // the delete request will fail for device2 since the UIA was initiated by trying to delete device1.
6868 deleteSessionToDeviceID map [string ]string
69- // allowedForCrossSigningKeysReplacement is a collection of sessions that MAS has authorised for updating
69+ // crossSigningKeysReplacement is a collection of sessions that MAS has authorised for updating
7070 // cross-signing keys without UIA.
71- allowedForCrossSigningKeysReplacement map [string ]* time.Timer
71+ crossSigningKeysReplacement map [string ]* time.Timer
7272}
7373
7474// defaultTimeout is the timeout used to clean up sessions
7575const defaultTimeOut = time .Minute * 5
7676
77- // allowedForCrossSigningKeysReplacementDuration is the timeout used for replacing cross signing keys without UIA
78- const allowedForCrossSigningKeysReplacementDuration = time .Minute * 10
77+ // crossSigningKeysReplacementDuration is the timeout used for replacing cross signing keys without UIA
78+ const crossSigningKeysReplacementDuration = time .Minute * 10
7979
8080// getCompletedStages returns the completed stages for a session.
8181func (d * sessionsDict ) getCompletedStages (sessionID string ) []authtypes.LoginType {
@@ -128,14 +128,14 @@ func (d *sessionsDict) deleteSession(sessionID string) {
128128func (d * sessionsDict ) allowCrossSigningKeysReplacement (userID string ) int64 {
129129 d .Lock ()
130130 defer d .Unlock ()
131- ts := time .Now ().Add (allowedForCrossSigningKeysReplacementDuration ).UnixMilli ()
132- t , ok := d .allowedForCrossSigningKeysReplacement [userID ]
131+ ts := time .Now ().Add (crossSigningKeysReplacementDuration ).UnixMilli ()
132+ t , ok := d .crossSigningKeysReplacement [userID ]
133133 if ok {
134- t .Reset (allowedForCrossSigningKeysReplacementDuration )
134+ t .Reset (crossSigningKeysReplacementDuration )
135135 return ts
136136 }
137- d .allowedForCrossSigningKeysReplacement [userID ] = time .AfterFunc (
138- allowedForCrossSigningKeysReplacementDuration ,
137+ d .crossSigningKeysReplacement [userID ] = time .AfterFunc (
138+ crossSigningKeysReplacementDuration ,
139139 func () {
140140 d .restrictCrossSigningKeysReplacement (userID )
141141 },
@@ -146,33 +146,33 @@ func (d *sessionsDict) allowCrossSigningKeysReplacement(userID string) int64 {
146146func (d * sessionsDict ) isCrossSigningKeysReplacementAllowed (userID string ) bool {
147147 d .RLock ()
148148 defer d .RUnlock ()
149- _ , ok := d .allowedForCrossSigningKeysReplacement [userID ]
149+ _ , ok := d .crossSigningKeysReplacement [userID ]
150150 return ok
151151}
152152
153153func (d * sessionsDict ) restrictCrossSigningKeysReplacement (userID string ) {
154154 d .Lock ()
155155 defer d .Unlock ()
156- t , ok := d .allowedForCrossSigningKeysReplacement [userID ]
156+ t , ok := d .crossSigningKeysReplacement [userID ]
157157 if ok {
158158 if ! t .Stop () {
159159 select {
160160 case <- t .C :
161161 default :
162162 }
163163 }
164- delete (d .allowedForCrossSigningKeysReplacement , userID )
164+ delete (d .crossSigningKeysReplacement , userID )
165165 }
166166}
167167
168168func newSessionsDict () * sessionsDict {
169169 return & sessionsDict {
170- sessions : make (map [string ][]authtypes.LoginType ),
171- sessionCompletedResult : make (map [string ]registerResponse ),
172- params : make (map [string ]registerRequest ),
173- timer : make (map [string ]* time.Timer ),
174- deleteSessionToDeviceID : make (map [string ]string ),
175- allowedForCrossSigningKeysReplacement : make (map [string ]* time.Timer ),
170+ sessions : make (map [string ][]authtypes.LoginType ),
171+ sessionCompletedResult : make (map [string ]registerResponse ),
172+ params : make (map [string ]registerRequest ),
173+ timer : make (map [string ]* time.Timer ),
174+ deleteSessionToDeviceID : make (map [string ]string ),
175+ crossSigningKeysReplacement : make (map [string ]* time.Timer ),
176176 }
177177}
178178
0 commit comments