function configureSessionCookie (app) {
  if (!isValidKey(SESSION_ENCRYPTION_KEY) && !isValidKey(SESSION_ENCRYPTION_KEY_2)) {
    throw new Error('cookie encryption key is not set')
  } else if (!COOKIE_MAX_AGE) {
    throw new Error('cookie max age is not set')
  }

  if (isValidKey(SESSION_ENCRYPTION_KEY)) app.use(clientSessions(namedCookie(SESSION_COOKIE_NAME_1, SESSION_ENCRYPTION_KEY)))
  if (isValidKey(SESSION_ENCRYPTION_KEY_2)) app.use(clientSessions(namedCookie(SESSION_COOKIE_NAME_2, SESSION_ENCRYPTION_KEY_2)))
}
/**
 * Initialises app with client_sessions middleware.
 * Configures one middleware per existing encryption key, to enable multiple
 * keys to exist simultaneously, allowing key rotation.
 *
 * @param {Express.App} app
 */
Initialises app with client_sessions middleware.
Configures one middleware per existing encryption key, to enable multiple
keys to exist simultaneously, allowing key rotation.


Initialises app with client_sessions middleware . Configures one middleware per existing encryption key to enable multiple keys to exist simultaneously allowing key rotation .
function configureSessionCookie (app) {
  if (!isValidKey(SESSION_ENCRYPTION_KEY) && !isValidKey(SESSION_ENCRYPTION_KEY_2)) {
    throw new Error('cookie encryption key is not set')
  } else if (!COOKIE_MAX_AGE) {
    throw new Error('cookie max age is not set')
  }
  if (isValidKey(SESSION_ENCRYPTION_KEY)) app.use(clientSessions(namedCookie(SESSION_COOKIE_NAME_1, SESSION_ENCRYPTION_KEY)))
  if (isValidKey(SESSION_ENCRYPTION_KEY_2)) app.use(clientSessions(namedCookie(SESSION_COOKIE_NAME_2, SESSION_ENCRYPTION_KEY_2)))
}
function configureSessionCookie ( app ) { if ( ! isValidKey ( SESSION_ENCRYPTION_KEY ) && ! isValidKey ( SESSION_ENCRYPTION_KEY_2 ) ) { throw new Error ( 'cookie encryption key is not set' ) } else if ( ! COOKIE_MAX_AGE ) { throw new Error ( 'cookie max age is not set' ) } if ( isValidKey ( SESSION_ENCRYPTION_KEY ) ) app . use ( clientSessions ( namedCookie ( SESSION_COOKIE_NAME_1 , SESSION_ENCRYPTION_KEY ) ) ) if ( isValidKey ( SESSION_ENCRYPTION_KEY_2 ) ) app . use ( clientSessions ( namedCookie ( SESSION_COOKIE_NAME_2 , SESSION_ENCRYPTION_KEY_2 ) ) ) }
Initialises app with client_sessions middleware.
Initialises app with client_sessions middleware .