Session manager class.

Hierarchy

  • Session

Constructors

  • Parameters

    Returns Session

Properties

_app: WeakRef<App>
cookieName: string = 'mojo'

Name for session cookies, defaults to mojo.

cookiePath: string = '/'

Path for session cookies, defaults to /.

expiration: number = 3600

Default time for sessions to expire in seconds from now, defaults to 3600. The expiration timeout gets refreshed for every request. Setting the value to 0 will allow sessions to persist until the browser window is closed, this can have security implications though.

httpOnly: boolean = true

Set the HttpOnly value on all session cookies.

sameSite: "none" | "strict" | "lax" = 'lax'

Set the SameSite value on all session cookies, defaults to lax.

secure: boolean = false

Set the secure flag on all session cookies, so that browsers send them only over HTTPS connections.

Methods

  • Load session data from encrypted cookie.

    Parameters

    Returns Promise<null | SessionData>

  • Store session data in encrypted cookie.

    Parameters

    Returns Promise<void>

  • Decrypt cookie.

    Parameters

    • secrets: string[]
    • encrypted: string

    Returns Promise<null | string>

  • Encrypt cookie.

    Parameters

    • secret: string
    • value: string

    Returns Promise<string>

Generated using TypeDoc