Skip to content

Lazily evaluate PQC support to prevent Node warnings on startup - #809

Merged
MasterKale merged 2 commits into
masterfrom
fix/lazy-evaluate-pqc-support
Sep 25, 2026
Merged

MasterKale merged 2 commits into
masterfrom
fix/lazy-evaluate-pqc-support

Conversation

@MasterKale

Copy link
Copy Markdown
Owner

This PR updates PQC support detection to only check for PQC support when a method that needs to know is actually invoked. Before, PQC support was checked by SettingsService when it was initialized. This lead to noisy warnings any time the Node process was started:

issue-807-prefix.mjs

// @simplewebauthn/server@14.0.2
import { generateRegistrationOptions } from '@simplewebauthn/server';
$ node issue-807-prefix.mjs
(node:16420) ExperimentalWarning: The supports Web Crypto API method is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16420) ExperimentalWarning: The ML-DSA-44 Web Crypto API algorithm is an experimental feature and might change at any time

With these changes, a method needs to be actually invoked before the warnings will be displayed (if the runtime emits them):

issue-807-postfix-1.mjs

// @simplewebauthn/server@"probably 14.0.3"
import { generateRegistrationOptions } from '@simplewebauthn/server';
$ node issue-807-postfix-1.mjs
# No output

issue-807-postfix-2.mjs

// @simplewebauthn/server@"probably 14.0.3"
import { generateRegistrationOptions } from '@simplewebauthn/server';

console.log('Calling generateRegistrationOptions()', await generateRegistrationOptions({}));
$ node issue-807-postfix-1.mjs
Calling generateRegistrationOptions() {
  # ...
}
(node:16489) ExperimentalWarning: The supports Web Crypto API method is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:16489) ExperimentalWarning: The ML-DSA-44 Web Crypto API algorithm is an experimental feature and might change at any time

Fixes #807.

@MasterKale
MasterKale merged commit cd402cc into master Sep 25, 2026
15 checks passed
@MasterKale
MasterKale deleted the fix/lazy-evaluate-pqc-support branch September 25, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PQC feature detection runs at import, emitting two ExperimentalWarnings on Node 24

1 participant