100-Sessions/

directory
v0.0.0-...-228c668 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2021 License: MIT

README

Session

This is how we create state:

We will store a unique ID in the cookie.

On our server, we will associate each user with a unique ID.

This will allow us to identify every user visiting our website.

Security

There are two factors which contribute to the security of a session created using a cookie and a unique ID:

  1. Uniqueness of the ID
  2. Encryption in transit with HTTPS

You can use any unique ID that you would like: a Universally unique identifier (UUID) or a database key. If you're using a database key, make sure it's not the key to your user but to a separate session table.

A UUID is very unique. Wikipedia says this about UUIDs: " ... only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%."

A UUID cannot be intercepted in transit if we are using HTTPS.

We will look at HTTPS in the next section.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL