fix: crypto compatible

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-06-21 20:03:27 +08:00
parent 703ba11e6e
commit 503f0798e6

View File

@@ -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(