From 16bb1ca1dc9891392d421cb2af43a233c7bd5525 Mon Sep 17 00:00:00 2001 From: Bereket Engida <86073083+Bekacru@users.noreply.github.com> Date: Sat, 21 Dec 2024 07:58:13 +0300 Subject: [PATCH] fix: remove oslo dep (#973) --- packages/better-auth/src/plugins/oidc-provider/index.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/better-auth/src/plugins/oidc-provider/index.ts b/packages/better-auth/src/plugins/oidc-provider/index.ts index f2c5527f14..6565095480 100644 --- a/packages/better-auth/src/plugins/oidc-provider/index.ts +++ b/packages/better-auth/src/plugins/oidc-provider/index.ts @@ -18,8 +18,7 @@ import type { } from "./types"; import { authorize } from "./authorize"; import { parseSetCookieHeader } from "../../cookies"; -import { sha256 } from "oslo/crypto"; -import type { Endpoint } from "better-call"; +import { createHash } from "@better-auth/utils/hash"; const getMetadata = ( ctx: GenericEndpointContext, @@ -471,9 +470,9 @@ export const oidcProvider = (options: OIDCOptions) => { const challenge = value.codeChallengeMethod === "plain" ? code_verifier - : Buffer.from( - await sha256(new TextEncoder().encode(code_verifier || "")), - ).toString("base64url"); + : await createHash("SHA-256", "base64urlnopad").digest( + code_verifier, + ); if (challenge !== value.codeChallenge) { throw new APIError("UNAUTHORIZED", {