Skip to content

Development

dweller long gone edited this page May 22, 2026 · 1 revision

Development

This page summarizes local development and package conventions for Private Key Gadgets.

Project Shape

Key files:

  • src/core.ts: UI-independent PvkGadgetsCore API for WebCrypto key generation, key recognition, SubjectDN, CSR, self-signed certificates, PEM, and DER helpers.
  • src/pkcs12.ts: PKCS#12 import and export helpers built on PKIjs and asn1js.
  • src/app.ts: browser application shell, key tree UI, embedded PkiStudioJS viewer integration, host callbacks, and initPrivateKeyGadgets export.
  • src/main.ts: default app entry for index.html.
  • src/viewer.ts: standalone PkiStudioJS viewer entry for viewer.html.
  • src/pkistudio.ts: adapter for the @pkistudio/pkistudiojs dependency.
  • src/styles.css: application and viewer-host styling.
  • vite.config.ts: Vite build configuration, version injection, app entries, and package entry outputs.

Local Checks

Run these before handing normal code changes back:

npm run check
npm run build

For package or release-related changes, also run:

npm run pack:dry-run

Local Development Server

npm run dev -- --port 5173 --strictPort

Then open:

http://localhost:5173/

In VS Code, the Start pvkgadgets server task starts the same server.

Wiki Preview in Codespaces

The repository devcontainer can prepare Gollum and clone the GitHub Wiki repository into:

/workspaces/pvkgadgets.wiki

Start the local Wiki preview with the VS Code task:

Start pvkgadgets wiki

Gollum listens on port 4567.

Package Entry Points

The npm package is @pkistudio/pvkgadgets.

Exports:

  • @pkistudio/pvkgadgets: dist/core.js.
  • @pkistudio/pvkgadgets/core: dist/core.js.
  • @pkistudio/pvkgadgets/pkcs12: dist/pkcs12.js.
  • @pkistudio/pvkgadgets/app: dist/app.js.
  • @pkistudio/pvkgadgets/styles.css: dist/styles.css.

Version Metadata

When bumping versions, keep version metadata synchronized across:

  • package.json
  • package-lock.json
  • README.md

The package version is used for __PVKGADGETS_VERSION__, the app About display, and PvkGadgetsCore.version.

Release Notes

Release work normally follows a PR path: branch, focused commit, push, PR, CI, merge, annotated tag, GitHub Release, npm publication, and verification.

Verify published package state with:

npm view @pkistudio/pvkgadgets@<version> version dist-tags dist.tarball --json

PKCS#12 parsing and writing should continue to use PKIjs and asn1js structured APIs. Browser-shipped code should not gain Node-only runtime dependencies.

Clone this wiki locally