From 4c3af0be5cb8411d337d079f6165dfa01409ddfd Mon Sep 17 00:00:00 2001 From: Julien Rousseau Date: Tue, 31 Oct 2023 13:42:45 -0400 Subject: [PATCH] renamed invalidRequest response --- src/auth/argon2.ts | 4 ++-- src/auth/bearer.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/auth/argon2.ts b/src/auth/argon2.ts index a12a049..9b4981d 100644 --- a/src/auth/argon2.ts +++ b/src/auth/argon2.ts @@ -1,6 +1,6 @@ // https://bun.sh/guides/util/hash-a-password import { config } from "../config.js"; -import { InvalidRequest, NoAuthorization, Unauthorized, getBearer } from "./bearer.js"; +import { InvalidAuthRequest, NoAuthorization, Unauthorized, getBearer } from "./bearer.js"; export function beforeHandle(request: Request): Response | undefined { if (!config.authKey) return; @@ -13,6 +13,6 @@ export function beforeHandle(request: Request): Response | undefined { return Unauthorized; } } catch { - return InvalidRequest; + return InvalidAuthRequest; } } diff --git a/src/auth/bearer.ts b/src/auth/bearer.ts index b04809b..68594d4 100644 --- a/src/auth/bearer.ts +++ b/src/auth/bearer.ts @@ -7,7 +7,7 @@ const REALM = "sign"; export const NoAuthorization = toText("Unauthorized", 400, new Headers({ "WWW-Authenticate": `${PREFIX} realm="${REALM}"` })); export const Unauthorized = toText("Unauthorized", 401, new Headers({ "WWW-Authenticate": `${PREFIX} error="invalid_token"` })); -export const InvalidRequest = toText("Bad Request", 400, new Headers({ "WWW-Authenticate": `${PREFIX} error="invalid_request"` })); +export const InvalidAuthRequest = toText("Bad Request", 400, new Headers({ "WWW-Authenticate": `${PREFIX} error="invalid_request"` })); export function getBearerToken(headerToken: string) { const regexp = new RegExp(`^${PREFIX} (${TOKEN_STRINGS}) *$`);