From 69dc2d5690790c81106070f58a412cea4b3cc944 Mon Sep 17 00:00:00 2001 From: pilcrowOnPaper Date: Fri, 18 Oct 2024 08:52:07 +0900 Subject: [PATCH] fix redis code --- pages/sessions/basic-api/redis.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/sessions/basic-api/redis.md b/pages/sessions/basic-api/redis.md index e4fa91c..975e674 100644 --- a/pages/sessions/basic-api/redis.md +++ b/pages/sessions/basic-api/redis.md @@ -25,7 +25,7 @@ export async function createSession(token: string, userId: number): Promise { +export async function validateSessionToken(token: string): Promise { // TODO } @@ -72,7 +72,7 @@ import { sha256 } from "@oslojs/crypto/sha2"; // ... -export async function createSession(token: string, userId: number): Session { +export async function createSession(token: string, userId: number): Promise { const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token))); const session: Session = { id: sessionId, @@ -108,7 +108,7 @@ import { sha256 } from "@oslojs/crypto/sha2"; // ... -export async function validateSessionToken(token: string): Promise { +export async function validateSessionToken(token: string): Promise { const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token))); const item = await redis.get(`session:${sessionId}`); if (item === null) { @@ -168,7 +168,7 @@ export function generateSessionToken(): string { return token; } -export async function createSession(token: string, userId: number): Session { +export async function createSession(token: string, userId: number): Promise { const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token))); const session: Session = { id: sessionId, @@ -189,7 +189,7 @@ export async function createSession(token: string, userId: number): Session { return session; } -export async function validateSessionToken(token: string): Promise { +export async function validateSessionToken(token: string): Promise { const sessionId = encodeHexLowerCase(sha256(new TextEncoder().encode(token))); const item = await redis.get(`session:${sessionId}`); if (item === null) {