MasterKale / SimpleWebAuthn

WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.
https://simplewebauthn.dev
MIT License
1.62k stars 137 forks source link

fix/427-fix-dynamic-webcrypto-import #428

Closed MasterKale closed 1 year ago

MasterKale commented 1 year ago

This PR fixes the dynamic import attempt I make in getWebCrypto() to correctly use import() instead of require().

It turns out this also fixed the "issue" that lead to me setting up a double-build in server, so this PR includes cleanup of that to get server back down to a single build.

Fixes #427.

Manual Test

I tested the fix with the following files and Node had no problem running either:

test_node.cjs

const { generateRegistrationOptions } = require('@simplewebauthn/server');

(async () => {
  console.log(await generateRegistrationOptions({
    rpID: '',
    rpName: '',
    userID: '',
    userName: '',
  }));
})();

test_node.mjs

import { generateRegistrationOptions } from '@simplewebauthn/server';

(async () => {
  console.log(await generateRegistrationOptions({
    rpID: '',
    rpName: '',
    userID: '',
    userName: '',
  }));
})();