Repository navigation
Commit cd402cc
authored
Lazily evaluate PQC support to prevent Node warnings on startup (#809)
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**
```js
// @simplewebauthn/server@14.0.2
import { generateRegistrationOptions } from '@simplewebauthn/server';
```
```sh
$ 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**
```js
// @simplewebauthn/server@"probably 14.0.3"
import { generateRegistrationOptions } from '@simplewebauthn/server';
```
```sh
$ node issue-807-postfix-1.mjs
# No output
```
**issue-807-postfix-2.mjs**
```js
// @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.1 parent 7e3c4c4 commit cd402cc
3 files changed
Lines changed: 13 additions & 16 deletions
File tree
- packages/server/src
- registration
- services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
35 | 34 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
41 | 39 | | |
42 | | - | |
43 | | - | |
| 40 | + | |
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
| |||
94 | 91 | | |
95 | 92 | | |
96 | 93 | | |
97 | | - | |
| 94 | + | |
98 | 95 | | |
99 | 96 | | |
100 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
0 commit comments