@mojojs/core
    Preparing search index...

    Class Session

    Session manager class.

    Index
    • Parameters

      Returns Session

    _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.

    partitioned: boolean = false

    Set the Partitioned value on all session cookies, to be used in accordance with the CHIPS amendment to RFC 6265. Note that this property is EXPERIMENTAL and might change without warning!

    sameSite: "lax" | "none" | "strict" = '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.

    • Load session data from encrypted cookie.

      Parameters

      Returns Promise<SessionData | null>

    • Store session data in encrypted cookie.

      Parameters

      Returns Promise<void>

    • Decrypt cookie.

      Parameters

      • secrets: string[]
      • encrypted: string

      Returns Promise<string | null>

    • Encrypt cookie.

      Parameters

      • secret: string
      • value: string

      Returns Promise<string>