Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (lazyKeys.length) {
request.yar._store._lazyKeys = lazyKeys;
}
}
// Store session data in cookie
const settings = request.yar._settings;
if (settings.maxCookieSize) {
const content = {
id: request.yar.id,
_store: request.yar._store
};
const value = await Statehood.prepareValue(settings.name, content, settings.cookieOptions);
if (value.length <= settings.maxCookieSize) {
h.state(settings.name, value, settings.rawCookieOptions);
return h.continue;
}
}
// Store session data in cache
const cache = request.yar._cache;
if (!settings.errorOnCacheNotReady &&
!cache.isReady()) {
request.log('Cache is not ready: not storing sessions to cache');
return h.continue;
}