Remove node forge dependency #648
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaced the
node-forgedependency with@peculiar/x509, which is more modern, lightweight, and still widely adopted (600K+ downloads). I initially attempted to use Node.js's built-incryptomodule, but encountered an issue wherekeyUsageconsistently returnedundefinedin Electron environments.Testing in Electron Environments
Added comprehensive testing for Electron environments. In the latest commit, all
vitesttests now run in Electron, which mirrors the environment VS Code operates in. This introduces a few seconds of additional overhead compared to running them in pure NodeJS env. An alternative approach would be to create a separate command (e.g.,yarn test:electron) that runs only the relevant tests in Electron, but this is less robust and could result in missed test coverage as the codebase evolves.I also explored running these as VS Code integration tests, but this approach has significant limitations. It would require converting the test suite to Mocha and rewriting tests to use VS Code API calls, which would make it difficult to write focused unit tests.
Electron Dependency
Added
electronas a dev dependency to ensure proper BoringSSL usage (rather than OpenSSL, which Node.js uses). Note that the current version is the latest release, while VS Code may be running an older version. We should consider pinning to an older Electron version that more closely matches VS Code's environment.