Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Oct 7, 2024
1 parent a8b1629 commit bc652c4
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 10 deletions.
10 changes: 8 additions & 2 deletions pages/sessions/basic-api/drizzle-orm.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ export type User = InferSelectModel<typeof userTable>;
export type Session = InferSelectModel<typeof sessionTable>;
```

## 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.
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions pages/sessions/basic-api/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions pages/sessions/basic-api/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions pages/sessions/basic-api/prisma.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions pages/sessions/basic-api/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions pages/sessions/basic-api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bc652c4

Please sign in to comment.