loadSession loads a session from the disk store via the passed loadFunc using the ticket.id as the key. It then decodes the SessionState using ticket.secret to make the AES-GCM cipher. finally it appends a lock implementation
(loader loadFunc, initLock initLockFunc)
| 178 | // ticket.secret to make the AES-GCM cipher. |
| 179 | // finally it appends a lock implementation |
| 180 | func (t *ticket) loadSession(loader loadFunc, initLock initLockFunc) (*sessions.SessionState, error) { |
| 181 | ciphertext, err := loader(t.id) |
| 182 | if err != nil { |
| 183 | return nil, fmt.Errorf("failed to load the session state with the ticket: %v", err) |
| 184 | } |
| 185 | c, err := t.makeCipher() |
| 186 | if err != nil { |
| 187 | return nil, err |
| 188 | } |
| 189 | |
| 190 | sessionState, err := sessions.DecodeSessionState(ciphertext, c, false) |
| 191 | if err != nil { |
| 192 | return nil, err |
| 193 | } |
| 194 | lock := initLock(t.id) |
| 195 | sessionState.Lock = lock |
| 196 | return sessionState, nil |
| 197 | } |
| 198 | |
| 199 | // clearSession uses the passed clearFunc to delete a session stored with a |
| 200 | // key of ticket.id |
no test coverage detected