mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-31 03:16:42 -05:00
fix: remove oslo dep (#973)
This commit is contained in:
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user