Skip to content

Commit 6d22f87

Browse files
committed
fix: import randomBytes from crypto instead of using crypto.randomBytes (not a function)
1 parent fd805ef commit 6d22f87

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

routes/passkeys.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from '@simplewebauthn/server';
99
import { isoBase64URL } from '@simplewebauthn/server/helpers';
1010
import { authenticateToken } from '../middleware/auth.js';
11-
import { createHash } from 'crypto';
11+
import { createHash, randomBytes } from 'crypto';
1212
import { query } from '../config/db.js';
1313
import { generateToken } from '../middleware/auth.js';
1414
import { logActivity } from '../services/activity.js';
@@ -54,7 +54,7 @@ function getWebAuthnConfig(req) {
5454
const challengeMap = new Map();
5555

5656
function generateSessionToken() {
57-
return crypto.randomBytes(32).toString('hex');
57+
return randomBytes(32).toString('hex');
5858
}
5959

6060
function getClientIp(req) {

0 commit comments

Comments
 (0)