MCPcopy
hub / github.com/gofiber/fiber / getRawFromStorage

Function getRawFromStorage

middleware/csrf/csrf.go:265–274  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
265func 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
277func createOrExtendTokenInStorage(c fiber.Ctx, token string, cfg *Config, sessionManager *sessionManager, storageManager *storageManager) error {

Callers 1

NewFunction · 0.85

Calls 2

ErrorfMethod · 0.65
getRawMethod · 0.45

Tested by

no test coverage detected