getRawFromStorage returns the raw value from the storage for the given token returns nil if the token does not exist, is expired or is invalid
(c fiber.Ctx, token string, cfg *Config, sessionManager *sessionManager, storageManager *storageManager)
| 263 | // getRawFromStorage returns the raw value from the storage for the given token |
| 264 | // returns nil if the token does not exist, is expired or is invalid |
| 265 | func getRawFromStorage(c fiber.Ctx, token string, cfg *Config, sessionManager *sessionManager, storageManager *storageManager) ([]byte, error) { |
| 266 | if cfg.Session != nil { |
| 267 | return sessionManager.getRaw(c, token, dummyValue), nil |
| 268 | } |
| 269 | raw, err := storageManager.getRaw(c, token) |
| 270 | if err != nil { |
| 271 | return nil, fmt.Errorf("csrf: failed to fetch token from storage: %w", err) |
| 272 | } |
| 273 | return raw, nil |
| 274 | } |
| 275 | |
| 276 | // createOrExtendTokenInStorage creates or extends the token in the storage |
| 277 | func createOrExtendTokenInStorage(c fiber.Ctx, token string, cfg *Config, sessionManager *sessionManager, storageManager *storageManager) error { |