Skip to content

Commit

Permalink
feat: more explicit imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonraimondi committed Jun 13, 2024
1 parent 9563ec6 commit 83f3d0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jmondi/oauth2-server",
"version": "3.4.0-next.2",
"version": "3.4.0-next.3",
"type": "module",
"author": "Jason Raimondi <jason@raimondi.us>",
"funding": "https://github.com/sponsors/jasonraimondi",
Expand Down
4 changes: 2 additions & 2 deletions src/code_verifiers/S256.verifier.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import crypto from "node:crypto";
import { createHash } from "node:crypto";

import { base64urlencode } from "../utils/base64.js";
import { ICodeChallenge } from "./verifier.js";
Expand All @@ -7,7 +7,7 @@ export class S256Verifier implements ICodeChallenge {
public readonly method = "S256";

verifyCodeChallenge(codeVerifier: string, codeChallenge: string): boolean {
const codeHash = crypto.createHash("sha256").update(codeVerifier).digest();
const codeHash = createHash("sha256").update(codeVerifier).digest();
return codeChallenge === base64urlencode(codeHash);
}
}
4 changes: 2 additions & 2 deletions src/utils/token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import crypto from "node:crypto";
import { randomBytes } from "node:crypto";

export function generateRandomToken(len = 80): string {
return crypto.randomBytes(len / 2).toString("hex");
return randomBytes(len / 2).toString("hex");
}

0 comments on commit 83f3d0f

Please sign in to comment.