Vue 3 composables for client-side cryptography — key generation, encryption, signing, and hashing with reactive state.
Getting started
The Crypto Service ecosystem
Package reference
Operational
pnpm add @sebastienrousseau/crypto-vue
# or
npm install @sebastienrousseau/crypto-vue
# or
yarn add @sebastienrousseau/crypto-vue
^22.0.0 or >=24.0.0 (active and maintenance LTS releases)pnpm >=9 (recommended) or npm >=10>=5.0 (when compiling with TypeScript)<script setup lang="ts">
import { useKeypair } from "@sebastienrousseau/crypto-vue";
const { publicKey, privateKey, generate, isGenerating } = useKeypair();
</script>
<template>
<button @click="generate('ed25519')" :disabled="isGenerating">
Generate Key Pair
</button>
<pre v-if="publicKey">{{ publicKey }}</pre>
</template>
Crypto Service provides a complete cryptography stack across 14 specialized packages:
| Package | Role | Description |
|---|---|---|
@sebastienrousseau/crypto-api |
API docs | Postman collection types and a Postman-to-Markdown converter; the server's API contract is its OpenAPI document. |
@sebastienrousseau/crypto-benchmarks |
Benchmarks | Benchmarks comparing classical and post-quantum cryptography: ops/sec, latency and throughput. |
@sebastienrousseau/crypto-cbom |
CBOM | Cryptographic Bill of Materials generator and auditor (CycloneDX 1.6, SPDX 3.0). |
@sebastienrousseau/crypto-cli |
Terminal CLI | Command-line interface: hashing, key generation, encryption, signing, HPKE, Argon2id and CBOM scans, with an interactive menu. |
@sebastienrousseau/crypto-edge |
Edge Runtime | Edge-runtime cryptographic operations using the Web Crypto API, optimized for Cloudflare Workers, Vercel Edge, and Deno. |
@sebastienrousseau/crypto-kms |
Cloud KMS | Unified KMS interface: AWS KMS, Google Cloud KMS, Vault Transit and local providers; Azure is a stub. |
@sebastienrousseau/crypto-lib |
Core Library | Core library: post-quantum ML-KEM, ML-DSA and SLH-DSA, plus classical, modern and OpenPGP cryptography for TypeScript. |
@sebastienrousseau/crypto-lsp |
IDE Analysis | Language server that flags weak and quantum-vulnerable cryptography in the editor, with quick fixes. |
@sebastienrousseau/crypto-mcp |
AI Agents | Model Context Protocol server exposing cryptography tools to AI assistants and agents. |
@sebastienrousseau/crypto-middleware |
Middleware | Cryptographic middleware for Express and Fastify: decrypt requests, encrypt responses, verify HMAC signatures and JWTs. |
@sebastienrousseau/crypto-prisma |
ORM Adapter | Transparent field-level encryption extension for Prisma Client, using XChaCha20-Poly1305. |
@sebastienrousseau/crypto-react |
React Hooks | React hooks and context provider for client-side cryptographic operations with zero boilerplate. |
@sebastienrousseau/crypto-sdk |
Client SDK | A zero-dependency, typed HTTP client for the Crypto Service REST API, with full post-quantum support. |
@sebastienrousseau/crypto-server |
HTTP API | A hardened Fastify REST API for cryptographic operations, with rate limiting, OpenAPI schemas, and post-quantum endpoints. |
@sebastienrousseau/crypto-testing |
Test Support | Deterministic keys, fast mocks, and test fixtures for crypto-lib |
@sebastienrousseau/crypto-typeorm |
ORM Adapter | TypeORM column-level encryption with a single decorator, powered by crypto-lib. |
@sebastienrousseau/crypto-vue (this package) |
Vue Composables | Vue 3 composables for client-side cryptography |
@sebastienrousseau/crypto-wasm |
Acceleration | Placeholder for a WebAssembly accelerator; no WebAssembly module ships yet. |
crypto-vue provides Vue 3 composables for client-side cryptographic
operations. It wraps @sebastienrousseau/crypto-lib in a reactive
API with composables for key generation, symmetric encryption,
hashing, and digital signatures. An optional CryptoPlugin supplies
global configuration (default key, server URL, API key) via Vue's
provide/inject system.
An optional Vue plugin that provides global configuration to all
composables via inject/provide.
// main.ts
import { createApp } from "vue";
import { CryptoPlugin } from "@sebastienrousseau/crypto-vue";
import App from "./App.vue";
const app = createApp(App);
app.use(CryptoPlugin, { defaultKey: keyTheUserUnlocked });
app.mount("#app");
| Option | Type | Description |
|---|---|---|
defaultKey |
string |
Default encryption key (256-bit hex string) |
serverUrl |
string |
Deprecated: no composable reads it |
apiKey |
string |
Deprecated: no composable reads it, and an API key in a browser is public |
Everything these composables hold runs in the browser. A key written into
your bundle, such as a literal defaultKey, is public; pass keys the user
supplies or unlocks at runtime. Keys in reactive state, such as
useKeypair's privateKey, can be read by any script on the page and by
Vue DevTools, and JavaScript cannot wipe them: call clear() when you are
done, and keep long-lived keys on a server.
useKeypair()Reactive key pair generation for any supported algorithm.
Supported algorithms: ed25519, x25519, ed448, x448,
p256, p384, ml-kem-512, ml-kem-768, ml-kem-1024,
ml-dsa-44, ml-dsa-65, ml-dsa-87
useEncrypt()Symmetric encryption and decryption using XChaCha20-Poly1305 (secretbox).
useHash()Cryptographic hashing with multiple algorithms.
Supported algorithms: sha256, sha384, sha512, sha3-256,
sha3-512, blake2b, blake3
useSignature()Digital signature creation and verification.
Supported algorithms: ed25519, ed448, ecdsa-p256,
ecdsa-p384, schnorr, ml-dsa-44, ml-dsa-65, ml-dsa-87
All examples are self-contained TypeScript files in the examples/
directory. Run any example with:
npx ts-node examples/<name>.ts
| Category | Example | Purpose |
|---|---|---|
| Plugin | plugin.ts | CryptoPlugin setup and injection |
| Key Generation | keygen.ts | Generate Ed25519 and ML-DSA-65 key pairs |
| Encryption | encrypt.ts | Secretbox encrypt and decrypt round-trip |
| Hashing | hash.ts | SHA-256, SHA3-256, and BLAKE3 hashing |
| Signing | sign.ts | Ed25519 sign and verify with tamper detection |
pnpm --filter @sebastienrousseau/crypto-vue run build
pnpm --filter @sebastienrousseau/crypto-vue run test
pnpm --filter @sebastienrousseau/crypto-vue run lint
pnpm --filter @sebastienrousseau/crypto-vue run format
All 18 packages in the Crypto Service workspace maintain a 100% coverage floor across statements, branches, functions, and lines.
Report vulnerabilities privately via GitHub Security Advisories or according to SECURITY.md. Never report security issues publicly.
Cryptographic operations use the @noble/* libraries, Node.js crypto and OpenPGP.js. @noble/post-quantum has not been independently audited and does not guarantee constant-time execution, and no module in this suite is FIPS 140-3 validated. Key zeroization is limited: JavaScript strings and garbage-collected buffers cannot be reliably wiped. See SECURITY.md.
Versions advance strictly one step at a time on the 0.0.x line (v0.0.1 → v0.0.2 → v0.0.3 ... → v0.0.999 → v0.1.0). Work for every release iteration begins on a dedicated feat/v<version> branch.
All 18 packages in the workspace move in lockstep. Public API signatures, cipher output formats, and serialization schemas are strictly versioned. Breaking changes to serialized formats or algorithm defaults are considered major breaking changes. Minimum toolchain upgrades (e.g. Node.js LTS floor) are governed by POLICIES.md.
Dual-licensed under Apache 2.0 or MIT, at your option.
Copyright (c) 2022-2026 Sebastien Rousseau and The Crypto Service Suite contributors.