-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
Private Key Gadgets currently uses TypeScript checks and the production build to protect the public package contract, browser application wiring, and reusable API surface.
Run the standard checks from the main repository:
npm run check
npm run buildThere is not currently a separate npm test script. Treat npm run check and npm run build as the required baseline before handing normal code changes back.
npm run check runs:
tsc --noEmitThis verifies the TypeScript project without writing build output.
The check protects exported TypeScript contracts for:
-
PvkGadgetsCorefrom@pkistudio/pvkgadgetsand@pkistudio/pvkgadgets/core. - PKCS#12 helpers from
@pkistudio/pvkgadgets/pkcs12. -
initPrivateKeyGadgetsfrom@pkistudio/pvkgadgets/app. - Local PkiStudioJS adapter and type definitions.
The check helps keep browser application code aligned with host callback types such as confirmation, file saving, and DER viewer opening.
VS Code-specific lifecycle and dialog behavior should remain outside this package and flow through those host callbacks.
The check protects the TypeScript shapes used for DER-backed data:
- PKCS#8 private keys.
- SPKI public keys.
- X.509 certificates.
- SubjectDN RDNSequence data.
- PKCS#10 CSRs.
- PKCS#12 import and export records.
npm run build runs:
tsc --noEmit
vite build
tsc -p tsconfig.types.jsonThis verifies both the browser bundle and generated declaration files.
The production build covers the browser application entries:
-
index.htmlandsrc/main.tsfor the main Private Key Gadgets app. -
viewer.htmlandsrc/viewer.tsfor the standalone PkiStudioJS viewer page.
The build verifies that package outputs can be produced for:
dist/core.jsdist/pkcs12.jsdist/app.jsdist/styles.css
It also generates declaration files through tsconfig.types.json.
The build catches integration issues with browser-shipped dependencies such as:
@pkistudio/pkistudiojsasn1jspkijspvtsutils
This is especially important because PKCS#12 parsing and writing should continue to use structured PKIjs and asn1js APIs.
The current checks do not replace full browser verification.
They do not currently cover:
- Full browser UI interaction flows.
- Visual regression checks.
- Cross-browser WebCrypto support differences.
- Clipboard permission behavior across browsers.
- Native save-file picker behavior and download fallback behavior.
- Real-world PKCS#12 file corpora.
- Certificate mismatch confirmation flows.
- SubjectDN editing synchronization through the embedded viewer.
- CSR and self-signed certificate creation from the UI.
- GitHub release or npm publish workflows.
Use browser verification when changing menus, dialogs, clipboard flows, save behavior, tree selection, splitters, embedded PkiStudioJS behavior, SubjectDN editing, certificate loading, CSR generation, or self-signed certificate generation.
For package or release-related changes, also run:
npm run pack:dry-runUse the local development server when browser verification is needed:
npm run dev -- --port 5173 --strictPortThen open:
http://localhost:5173/
In VS Code, the Start pvkgadgets server task starts the same server.
For user-facing application changes, verify the relevant parts of this list:
- Generate at least one supported key pair from
New. - Select PrivateKey and PublicKey child items and confirm the ASN.1 viewer updates.
- Create or edit a SubjectDN item.
- Generate a CSR when a usable SubjectDN exists.
- Generate a self-signed certificate when a usable SubjectDN exists.
- Import a PKCS#12 file with the expected password behavior.
- Export selected key pairs as PKCS#12.
- Confirm read-only viewer behavior for PrivateKey, PublicKey, Certificate, and CSR items.
- Confirm editable viewer behavior for SubjectDN items.
Update this page when the project adds a dedicated test suite, changes standard checks, adds package entry points, changes browser verification expectations, or adds important public API guarantees.