diff --git a/pages/sessions/basic-api/drizzle-orm.md b/pages/sessions/basic-api/drizzle-orm.md index 27909ff..fa5a7bd 100644 --- a/pages/sessions/basic-api/drizzle-orm.md +++ b/pages/sessions/basic-api/drizzle-orm.md @@ -97,6 +97,14 @@ export type User = InferSelectModel; export type Session = InferSelectModel; ``` +## Install dependencies + +This page uses [Oslo](https://oslojs.dev) for various operations to support a wide range of runtimes. Oslo packages are fully-typed, lightweight, and has minimal dependencies. These packages are optional and can be replaced by runtime built-ins. + +``` +npm i @oslojs/encoding @oslojs/crypto +``` + ## Create your API Here's what our API will look like. What each method does should be pretty self explanatory. @@ -146,8 +154,6 @@ export function generateSessionToken(): string { } ``` -> Throughout the site, we will use packages from [Oslo](https://oslojs.dev) for various operations. Oslo packages are fully-typed, lightweight, and has minimal dependencies. You can of course replace them with your own code, runtime-specific modules, or your preferred library. - The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days. ```ts diff --git a/pages/sessions/basic-api/mysql.md b/pages/sessions/basic-api/mysql.md index 666cc7d..85f1c44 100644 --- a/pages/sessions/basic-api/mysql.md +++ b/pages/sessions/basic-api/mysql.md @@ -23,6 +23,14 @@ CREATE TABLE user_session ( ); ``` +## Install dependencies + +This page uses [Oslo](https://oslojs.dev) for various operations to support a wide range of runtimes. Oslo packages are fully-typed, lightweight, and has minimal dependencies. These packages are optional and can be replaced by runtime built-ins. + +``` +npm i @oslojs/encoding @oslojs/crypto +``` + ## Create your API Here's what our API will look like. What each method does should be pretty self explanatory. @@ -84,8 +92,6 @@ export function generateSessionToken(): string { } ``` -> Throughout the site, we will use packages from [Oslo](https://oslojs.dev) for various operations. Oslo packages are fully-typed, lightweight, and has minimal dependencies. You can of course replace them with your own code, runtime-specific modules, or your preferred library. - The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days. ```ts diff --git a/pages/sessions/basic-api/postgresql.md b/pages/sessions/basic-api/postgresql.md index 3be8c09..debd893 100644 --- a/pages/sessions/basic-api/postgresql.md +++ b/pages/sessions/basic-api/postgresql.md @@ -23,6 +23,14 @@ CREATE TABLE user_session ( ); ``` +## Install dependencies + +This page uses [Oslo](https://oslojs.dev) for various operations to support a wide range of runtimes. Oslo packages are fully-typed, lightweight, and has minimal dependencies. These packages are optional and can be replaced by runtime built-ins. + +``` +npm i @oslojs/encoding @oslojs/crypto +``` + ## Create your API Here's what our API will look like. What each method does should be pretty self explanatory. @@ -84,8 +92,6 @@ export function generateSessionToken(): string { } ``` -> Throughout the site, we will use packages from [Oslo](https://oslojs.dev) for various operations. Oslo packages are fully-typed, lightweight, and has minimal dependencies. You can of course replace them with your own code, runtime-specific modules, or your preferred library. - The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days. ```ts diff --git a/pages/sessions/basic-api/prisma.md b/pages/sessions/basic-api/prisma.md index bd2a820..834c1f2 100644 --- a/pages/sessions/basic-api/prisma.md +++ b/pages/sessions/basic-api/prisma.md @@ -25,6 +25,14 @@ model Session { } ``` +## Install dependencies + +This page uses [Oslo](https://oslojs.dev) for various operations to support a wide range of runtimes. Oslo packages are fully-typed, lightweight, and has minimal dependencies. These packages are optional and can be replaced by runtime built-ins. + +``` +npm i @oslojs/encoding @oslojs/crypto +``` + ## Create your API Here's what our API will look like. What each method does should be pretty self explanatory. @@ -76,8 +84,6 @@ export function generateSessionToken(): string { } ``` -> Throughout the site, we will use packages from [Oslo](https://oslojs.dev) for various operations. Oslo packages are fully-typed, lightweight, and has minimal dependencies. You can of course replace them with your own code, runtime-specific modules, or your preferred library. - The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days. ```ts diff --git a/pages/sessions/basic-api/redis.md b/pages/sessions/basic-api/redis.md index cf931e5..1b69389 100644 --- a/pages/sessions/basic-api/redis.md +++ b/pages/sessions/basic-api/redis.md @@ -6,6 +6,12 @@ title: "Sessions with Redis" Users will use a session token linked to a session instead of the ID directly. The session ID will be the SHA-256 hash of the token. SHA-256 is a one-way hash function. This ensures that even if the database contents were leaked, the attacker won't be able retrieve valid tokens. +This page uses [Oslo](https://oslojs.dev) for various operations to support a wide range of runtimes. Oslo packages are fully-typed, lightweight, and has minimal dependencies. These packages are optional and can be replaced by runtime built-ins. + +``` +npm i @oslojs/encoding @oslojs/crypto +``` + Here's what our API will look like. What each method does should be pretty self explanatory. ```ts diff --git a/pages/sessions/basic-api/sqlite.md b/pages/sessions/basic-api/sqlite.md index dd3407e..01d21e1 100644 --- a/pages/sessions/basic-api/sqlite.md +++ b/pages/sessions/basic-api/sqlite.md @@ -23,6 +23,14 @@ CREATE TABLE session ( ); ``` +## Install dependencies + +This page uses [Oslo](https://oslojs.dev) for various operations to support a wide range of runtimes. Oslo packages are fully-typed, lightweight, and has minimal dependencies. These packages are optional and can be replaced by runtime built-ins. + +``` +npm i @oslojs/encoding @oslojs/crypto +``` + ## Create your API Here's what our API will look like. What each method does should be pretty self explanatory. @@ -84,8 +92,6 @@ export function generateSessionToken(): string { } ``` -> Throughout the site, we will use packages from [Oslo](https://oslojs.dev) for various operations. Oslo packages are fully-typed, lightweight, and has minimal dependencies. You can of course replace them with your own code, runtime-specific modules, or your preferred library. - The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days. ```ts