Skip to content

Commit 7a9b509

Browse files
add note on uuid
1 parent 2ae9c85 commit 7a9b509

File tree

6 files changed

+11
-1
lines changed

6 files changed

+11
-1
lines changed

pages/sessions/basic-api/drizzle-orm.md

+2
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ export function generateSessionToken(): string {
154154
}
155155
```
156156

157+
> You can use UUID v4 here but the RFC does not mandate that IDs are generated using a secure random source. Do not use libraries that are not clear on the source they use. Do not use other UUID versions as they do not offer the same entropy size as v4. Consider using [`Crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID).
158+
157159
The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days.
158160

159161
```ts

pages/sessions/basic-api/mysql.md

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ export function generateSessionToken(): string {
9292
}
9393
```
9494

95+
> You can use UUID v4 here but the RFC does not mandate that IDs are generated using a secure random source. Do not use libraries that are not clear on the source they use. Do not use other UUID versions as they do not offer the same entropy size as v4. Consider using [`Crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID).
96+
9597
The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days.
9698

9799
```ts

pages/sessions/basic-api/postgresql.md

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ export function generateSessionToken(): string {
9292
}
9393
```
9494

95+
> You can use UUID v4 here but the RFC does not mandate that IDs are generated using a secure random source. Do not use libraries that are not clear on the source they use. Do not use other UUID versions as they do not offer the same entropy size as v4. Consider using [`Crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID).
96+
9597
The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days.
9698

9799
```ts

pages/sessions/basic-api/prisma.md

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ export function generateSessionToken(): string {
8484
}
8585
```
8686

87+
> You can use UUID v4 here but the RFC does not mandate that IDs are generated using a secure random source. Do not use libraries that are not clear on the source they use. Do not use other UUID versions as they do not offer the same entropy size as v4. Consider using [`Crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID).
88+
8789
The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days.
8890

8991
```ts

pages/sessions/basic-api/redis.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function generateSessionToken(): string {
6161
}
6262
```
6363

64-
> 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.
64+
> You can use UUID v4 here but the RFC does not mandate that IDs are generated using a secure random source. Do not use libraries that are not clear on the source they use. Do not use other UUID versions as they do not offer the same entropy size as v4. Consider using [`Crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID).
6565
6666
The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days.
6767

pages/sessions/basic-api/sqlite.md

+2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ export function generateSessionToken(): string {
9292
}
9393
```
9494

95+
> You can use UUID v4 here but the RFC does not mandate that IDs are generated using a secure random source. Do not use libraries that are not clear on the source they use. Do not use other UUID versions as they do not offer the same entropy size as v4. Consider using [`Crypto.randomUUID()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID).
96+
9597
The session ID will be SHA-256 hash of the token. We'll set the expiration to 30 days.
9698

9799
```ts

0 commit comments

Comments
 (0)