Skip to content

Commit

Permalink
fix: crypto compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jun 21, 2024
1 parent 703ba11 commit 503f079
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/core/src/modules/authn/authn.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ import type {
VerifiedRegistrationResponse,
} from '@simplewebauthn/server'

// TODO support below the node v20

globalThis.crypto = require('node:crypto')
// TODO Compatible with versions below node v20
if (!globalThis.crypto) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
globalThis.crypto = require('node:crypto').webcrypto
}
@Injectable()
export class AuthnService {
constructor(
Expand Down

0 comments on commit 503f079

Please sign in to comment.