@sebastienrousseau/crypto-react 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +377 -0
- package/dist/hooks/useEncrypt.d.ts +9 -0
- package/dist/hooks/useEncrypt.d.ts.map +1 -0
- package/dist/hooks/useEncrypt.js +45 -0
- package/dist/hooks/useHash.d.ts +8 -0
- package/dist/hooks/useHash.d.ts.map +1 -0
- package/dist/hooks/useHash.js +25 -0
- package/dist/hooks/useKeypair.d.ts +10 -0
- package/dist/hooks/useKeypair.d.ts.map +1 -0
- package/dist/hooks/useKeypair.js +25 -0
- package/dist/hooks/useSignature.d.ts +10 -0
- package/dist/hooks/useSignature.d.ts.map +1 -0
- package/dist/hooks/useSignature.js +34 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/provider.d.ts +12 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +15 -0
- package/package.json +81 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
<!-- SPDX-License-Identifier: Apache-2.0 OR MIT -->
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/sebastienrousseau/crypto-service/main/assets/crypto-react-logo.svg" alt="crypto-react logo" width="360" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">@sebastienrousseau/crypto-react</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
React hooks and context provider for client-side cryptographic operations with zero boilerplate.
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://github.com/sebastienrousseau/crypto-service/actions"><img src="https://img.shields.io/github/actions/workflow/status/sebastienrousseau/crypto-service/ci.yml?branch=main&style=for-the-badge&logo=github" alt="Build" /></a>
|
|
15
|
+
<a href="https://coveralls.io/github/sebastienrousseau/crypto-service?branch=main"><img src="https://img.shields.io/coveralls/github/sebastienrousseau/crypto-service?branch=main&style=for-the-badge" alt="Coverage" /></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/@sebastienrousseau/crypto-react"><img src="https://img.shields.io/npm/v/@sebastienrousseau/crypto-react.svg?style=for-the-badge&color=f14041&logo=npm" alt="Registry" /></a>
|
|
17
|
+
<a href="https://sebastienrousseau.github.io/crypto-service/"><img src="https://img.shields.io/badge/docs-TypeDoc-blue.svg?style=for-the-badge&labelColor=555555&logo=typescript" alt="Docs" /></a>
|
|
18
|
+
<a href="https://scorecard.dev/viewer/?uri=github.com/sebastienrousseau/crypto-service" title="ossf-scorecard"><img src="https://img.shields.io/badge/OpenSSF-Scorecard-blue?style=for-the-badge&logo=openssf" alt="OpenSSF Scorecard" /></a>
|
|
19
|
+
<a href="https://github.com/sebastienrousseau/crypto-service/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0%20OR%20MIT-blue.svg?style=for-the-badge" alt="License: Apache-2.0 OR MIT" /></a>
|
|
20
|
+
<a href="https://github.com/sebastienrousseau/crypto-service/blob/main/docs/POLICIES.md"><img src="https://img.shields.io/badge/Node.js-%3E%3D22-93450a.svg?style=for-the-badge&logo=node.js" alt="Node.js 22 or newer" /></a>
|
|
21
|
+
<a href="https://react.dev/"><img src="https://img.shields.io/badge/react-%3E%3D18-61dafb.svg?style=for-the-badge&logo=react" alt="React >= 18" /></a>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Contents
|
|
27
|
+
|
|
28
|
+
**Getting started**
|
|
29
|
+
|
|
30
|
+
- [Install](#install) — installation via pnpm, npm, or yarn
|
|
31
|
+
- [Requirements](#requirements) — runtime floor and environment prerequisites
|
|
32
|
+
- [Quick Start](#quick-start) — minimal working usage sample
|
|
33
|
+
|
|
34
|
+
**The Crypto Service ecosystem**
|
|
35
|
+
|
|
36
|
+
- [The Crypto Service ecosystem](#the-crypto-service-ecosystem) — full 14-package suite overview
|
|
37
|
+
|
|
38
|
+
**Package reference**
|
|
39
|
+
|
|
40
|
+
- [Reference & Usage](#overview) — features, configuration, and capabilities
|
|
41
|
+
- [Examples](#examples) — runnable sample code
|
|
42
|
+
|
|
43
|
+
**Operational**
|
|
44
|
+
|
|
45
|
+
- [Development](#development) — build, lint, format, and test targets
|
|
46
|
+
- [Security](#security) — vulnerability disclosure and cryptographic invariants
|
|
47
|
+
- [Documentation](#documentation) — TypeDoc API docs and ecosystem guides
|
|
48
|
+
- [Stability guarantees](#stability-guarantees) — SemVer axis and release policy
|
|
49
|
+
- [License](#license)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm add @sebastienrousseau/crypto-react
|
|
57
|
+
# or
|
|
58
|
+
npm install @sebastienrousseau/crypto-react
|
|
59
|
+
# or
|
|
60
|
+
yarn add @sebastienrousseau/crypto-react
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Requirements
|
|
68
|
+
|
|
69
|
+
- **Node.js**: `^22.0.0` or `>=24.0.0` (active and maintenance LTS releases)
|
|
70
|
+
- **Package Manager**: `pnpm >=9` (recommended) or `npm >=10`
|
|
71
|
+
- **TypeScript**: `>=5.0` (when compiling with TypeScript)
|
|
72
|
+
|
|
73
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import {
|
|
81
|
+
CryptoProvider,
|
|
82
|
+
useKeypair,
|
|
83
|
+
useEncrypt,
|
|
84
|
+
useHash,
|
|
85
|
+
useSignature,
|
|
86
|
+
} from "@sebastienrousseau/crypto-react";
|
|
87
|
+
|
|
88
|
+
function App() {
|
|
89
|
+
return (
|
|
90
|
+
<CryptoProvider defaultKey="deadbeef...64-hex-chars">
|
|
91
|
+
<MyComponent />
|
|
92
|
+
</CryptoProvider>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function MyComponent() {
|
|
97
|
+
const { generate, publicKey } = useKeypair("ed25519");
|
|
98
|
+
const { encrypt, decrypt } = useEncrypt();
|
|
99
|
+
const { hash, digest } = useHash("sha3-256");
|
|
100
|
+
const { sign, verify } = useSignature();
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<div>
|
|
104
|
+
<button onClick={() => generate()}>Generate Ed25519 Key Pair</button>
|
|
105
|
+
{publicKey && <code>{publicKey}</code>}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## The Crypto Service ecosystem
|
|
116
|
+
|
|
117
|
+
Crypto Service provides a complete cryptography stack across 14 specialized packages:
|
|
118
|
+
|
|
119
|
+
| Package | Role | Description |
|
|
120
|
+
| :------------------------------------------------------------------------ | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------- |
|
|
121
|
+
| [`@sebastienrousseau/crypto-api`](../crypto-api) | API Schemas | Shared TypeScript types and utilities for the Crypto Service Suite, defining the canonical API surface. |
|
|
122
|
+
| [`@sebastienrousseau/crypto-cli`](../crypto-cli) | Terminal CLI | An interactive command-line interface for cryptographic operations, supporting both legacy OpenPGP and modern post-quantum algorithms. |
|
|
123
|
+
| [`@sebastienrousseau/crypto-edge`](../crypto-edge) | Edge Runtime | Edge-runtime cryptographic operations using the Web Crypto API, optimized for Cloudflare Workers, Vercel Edge, and Deno. |
|
|
124
|
+
| [`@sebastienrousseau/crypto-kms`](../crypto-kms) | Cloud KMS | Unified Key Management Service interface for AWS KMS, GCP Cloud KMS, Azure Key Vault, and HashiCorp Vault. |
|
|
125
|
+
| [`@sebastienrousseau/crypto-lib`](../crypto-lib) | Core Library | A modern cryptographic library for TypeScript, with post-quantum support, zero unsafe dependencies, and 100% test coverage. |
|
|
126
|
+
| [`@sebastienrousseau/crypto-middleware`](../crypto-middleware) | Middleware | Framework-agnostic cryptographic middleware for Express, Fastify, and Koa applications. |
|
|
127
|
+
| [`@sebastienrousseau/crypto-prisma`](../crypto-prisma) | ORM Adapter | Transparent field-level encryption extension for Prisma Client, using XChaCha20-Poly1305. |
|
|
128
|
+
| **[`@sebastienrousseau/crypto-react`](../crypto-react)** _(this package)_ | **React Hooks** | **React hooks and context provider for client-side cryptographic operations with zero boilerplate.** |
|
|
129
|
+
| [`@sebastienrousseau/crypto-sdk`](../crypto-sdk) | Client SDK | A zero-dependency, typed HTTP client for the Crypto Service REST API, with full post-quantum support. |
|
|
130
|
+
| [`@sebastienrousseau/crypto-server`](../crypto-server) | HTTP API | A hardened Fastify REST API for cryptographic operations, with rate limiting, OpenAPI schemas, and post-quantum endpoints. |
|
|
131
|
+
| [`@sebastienrousseau/crypto-testing`](../crypto-testing) | Test Support | Deterministic keys, fast mocks, and test fixtures for crypto-lib |
|
|
132
|
+
| [`@sebastienrousseau/crypto-typeorm`](../crypto-typeorm) | ORM Adapter | TypeORM column-level encryption with a single decorator, powered by crypto-lib. |
|
|
133
|
+
| [`@sebastienrousseau/crypto-vue`](../crypto-vue) | Vue Composables | Vue 3 composables for client-side cryptography |
|
|
134
|
+
| [`@sebastienrousseau/crypto-wasm`](../crypto-wasm) | Acceleration | WebAssembly performance accelerator for crypto-lib |
|
|
135
|
+
|
|
136
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Overview
|
|
141
|
+
|
|
142
|
+
crypto-react provides React hooks for client-side cryptographic
|
|
143
|
+
operations. It wraps `@sebastienrousseau/crypto-lib` in a reactive
|
|
144
|
+
API with hooks for key generation, symmetric encryption, hashing,
|
|
145
|
+
and digital signatures. A `CryptoProvider` component supplies shared
|
|
146
|
+
configuration (default key, server URL, API key) to all hooks via
|
|
147
|
+
React context.
|
|
148
|
+
|
|
149
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
150
|
+
|
|
151
|
+
## CryptoProvider
|
|
152
|
+
|
|
153
|
+
Wrap your component tree with `<CryptoProvider>` to supply shared
|
|
154
|
+
configuration to all hooks.
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
<CryptoProvider
|
|
158
|
+
defaultKey="a1b2c3d4...64-hex-chars"
|
|
159
|
+
serverUrl="https://crypto.example.com"
|
|
160
|
+
apiKey="my-api-key"
|
|
161
|
+
>
|
|
162
|
+
<App />
|
|
163
|
+
</CryptoProvider>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
| Prop | Type | Description |
|
|
167
|
+
| :----------- | :---------- | :--------------------------------------- |
|
|
168
|
+
| `defaultKey` | `string` | Hex-encoded 256-bit key for `useEncrypt` |
|
|
169
|
+
| `serverUrl` | `string` | Server URL for SDK-backed operations |
|
|
170
|
+
| `apiKey` | `string` | API key for server authentication |
|
|
171
|
+
| `children` | `ReactNode` | Child components |
|
|
172
|
+
|
|
173
|
+
Access the context from any child via `useCryptoContext()`.
|
|
174
|
+
|
|
175
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
176
|
+
|
|
177
|
+
## Hooks Reference
|
|
178
|
+
|
|
179
|
+
| Hook | Purpose | Returns |
|
|
180
|
+
| :------------- | :----------------------------------- | :------------------------------------------------------------- |
|
|
181
|
+
| `useKeypair` | Key pair generation (all algorithms) | `{ publicKey, privateKey, algorithm, generate, isGenerating }` |
|
|
182
|
+
| `useEncrypt` | Symmetric encryption (secretbox) | `{ encrypt, decrypt, ciphertext, plaintext, isProcessing }` |
|
|
183
|
+
| `useHash` | Cryptographic hashing | `{ hash, digest, isHashing }` |
|
|
184
|
+
| `useSignature` | Digital signatures (sign + verify) | `{ sign, verify, signature, isValid, isProcessing }` |
|
|
185
|
+
|
|
186
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
187
|
+
|
|
188
|
+
## Usage
|
|
189
|
+
|
|
190
|
+
<details>
|
|
191
|
+
<summary><b>Generate a key pair</b></summary>
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { useKeypair } from "@sebastienrousseau/crypto-react";
|
|
195
|
+
|
|
196
|
+
function KeygenPage() {
|
|
197
|
+
const { publicKey, generate, isGenerating } = useKeypair("ed25519");
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<div>
|
|
201
|
+
<button onClick={() => generate()} disabled={isGenerating}>
|
|
202
|
+
Generate Ed25519
|
|
203
|
+
</button>
|
|
204
|
+
{publicKey && <code>{publicKey.slice(0, 64)}...</code>}
|
|
205
|
+
</div>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
</details>
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary><b>Encrypt and decrypt</b></summary>
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
import { useEncrypt } from "@sebastienrousseau/crypto-react";
|
|
217
|
+
|
|
218
|
+
function EncryptPage() {
|
|
219
|
+
const { encrypt, decrypt, ciphertext, plaintext, isProcessing } =
|
|
220
|
+
useEncrypt();
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<div>
|
|
224
|
+
<button onClick={() => encrypt("secret message")} disabled={isProcessing}>
|
|
225
|
+
Encrypt
|
|
226
|
+
</button>
|
|
227
|
+
{ciphertext && (
|
|
228
|
+
<button onClick={() => decrypt(ciphertext)} disabled={isProcessing}>
|
|
229
|
+
Decrypt
|
|
230
|
+
</button>
|
|
231
|
+
)}
|
|
232
|
+
{plaintext && <p>Decrypted: {plaintext}</p>}
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
</details>
|
|
239
|
+
|
|
240
|
+
<details>
|
|
241
|
+
<summary><b>Hash data</b></summary>
|
|
242
|
+
|
|
243
|
+
```tsx
|
|
244
|
+
import { useHash } from "@sebastienrousseau/crypto-react";
|
|
245
|
+
|
|
246
|
+
function HashPage() {
|
|
247
|
+
const { hash, digest, isHashing } = useHash("sha3-256");
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div>
|
|
251
|
+
<button onClick={() => hash("Hello")} disabled={isHashing}>
|
|
252
|
+
SHA3-256
|
|
253
|
+
</button>
|
|
254
|
+
{digest && <code>{digest}</code>}
|
|
255
|
+
</div>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
</details>
|
|
261
|
+
|
|
262
|
+
<details>
|
|
263
|
+
<summary><b>Sign and verify</b></summary>
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { useKeypair, useSignature } from "@sebastienrousseau/crypto-react";
|
|
267
|
+
|
|
268
|
+
function SignPage() {
|
|
269
|
+
const { publicKey, privateKey, generate } = useKeypair("ed25519");
|
|
270
|
+
const { sign, verify, signature, isValid, isProcessing } = useSignature();
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<div>
|
|
274
|
+
<button onClick={() => generate()}>Generate Keys</button>
|
|
275
|
+
{privateKey && (
|
|
276
|
+
<button
|
|
277
|
+
onClick={() => sign(privateKey, "my message")}
|
|
278
|
+
disabled={isProcessing}
|
|
279
|
+
>
|
|
280
|
+
Sign
|
|
281
|
+
</button>
|
|
282
|
+
)}
|
|
283
|
+
{signature && publicKey && (
|
|
284
|
+
<button
|
|
285
|
+
onClick={() => verify(publicKey, "my message", signature)}
|
|
286
|
+
disabled={isProcessing}
|
|
287
|
+
>
|
|
288
|
+
Verify
|
|
289
|
+
</button>
|
|
290
|
+
)}
|
|
291
|
+
{isValid !== null && <p>Valid: {isValid ? "Yes" : "No"}</p>}
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
</details>
|
|
298
|
+
|
|
299
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
300
|
+
|
|
301
|
+
## Examples
|
|
302
|
+
|
|
303
|
+
All examples are self-contained TypeScript files in the `examples/`
|
|
304
|
+
directory. Run any example with:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
npx ts-node examples/<name>.ts
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
| Category | Example | Purpose |
|
|
311
|
+
| :------------- | :---------------------------------- | :-------------------------------------------- |
|
|
312
|
+
| Provider | [provider.ts](examples/provider.ts) | CryptoProvider context setup and access |
|
|
313
|
+
| Key Generation | [keygen.ts](examples/keygen.ts) | Generate Ed25519 and ML-DSA-65 key pairs |
|
|
314
|
+
| Encryption | [encrypt.ts](examples/encrypt.ts) | Secretbox encrypt and decrypt round-trip |
|
|
315
|
+
| Hashing | [hash.ts](examples/hash.ts) | SHA-256, SHA3-256, and BLAKE3 hashing |
|
|
316
|
+
| Signing | [sign.ts](examples/sign.ts) | Ed25519 sign and verify with tamper detection |
|
|
317
|
+
|
|
318
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
319
|
+
|
|
320
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Development
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
pnpm --filter @sebastienrousseau/crypto-react run build
|
|
328
|
+
pnpm --filter @sebastienrousseau/crypto-react run test
|
|
329
|
+
pnpm --filter @sebastienrousseau/crypto-react run lint
|
|
330
|
+
pnpm --filter @sebastienrousseau/crypto-react run format
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
All 18 packages in the Crypto Service workspace maintain a **100% coverage floor** across statements, branches, functions, and lines.
|
|
334
|
+
|
|
335
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Security
|
|
340
|
+
|
|
341
|
+
Report vulnerabilities privately via [GitHub Security Advisories](https://github.com/sebastienrousseau/crypto-service/security/advisories) or according to [`SECURITY.md`](../../SECURITY.md). Never report security issues publicly.
|
|
342
|
+
|
|
343
|
+
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`](../../SECURITY.md).
|
|
344
|
+
|
|
345
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Documentation
|
|
350
|
+
|
|
351
|
+
- [Full Suite Documentation](https://sebastienrousseau.github.io/crypto-service/)
|
|
352
|
+
- [API Reference (TypeDoc)](https://sebastienrousseau.github.io/crypto-service/)
|
|
353
|
+
- [Developer Guide](../../DEVELOPMENT.md)
|
|
354
|
+
- [Security Policy](../../SECURITY.md)
|
|
355
|
+
- [Architecture & Design](../../ARCHITECTURE.md)
|
|
356
|
+
|
|
357
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Stability guarantees
|
|
362
|
+
|
|
363
|
+
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.
|
|
364
|
+
|
|
365
|
+
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](../../docs/POLICIES.md).
|
|
366
|
+
|
|
367
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## License
|
|
372
|
+
|
|
373
|
+
Dual-licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) or [MIT](https://opensource.org/licenses/MIT), at your option.
|
|
374
|
+
|
|
375
|
+
Copyright (c) 2022-2026 Sebastien Rousseau and The Crypto Service Suite contributors.
|
|
376
|
+
|
|
377
|
+
<p align="right"><a href="#contents">Back to Top</a></p>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface UseEncryptResult {
|
|
2
|
+
encrypt: (plaintext: string | Uint8Array, key?: string) => string;
|
|
3
|
+
decrypt: (ciphertext: string, key?: string) => string;
|
|
4
|
+
ciphertext: string | null;
|
|
5
|
+
plaintext: string | null;
|
|
6
|
+
isProcessing: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function useEncrypt(): UseEncryptResult;
|
|
9
|
+
//# sourceMappingURL=useEncrypt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEncrypt.d.ts","sourceRoot":"","sources":["../../src/hooks/useEncrypt.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAE/B,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAElE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,YAAY,EAAE,OAAO,CAAC;CACvB;AAgBD,wBAAgB,UAAU,IAAI,gBAAgB,CAgD7C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useEncrypt = useEncrypt;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const secretbox_1 = require("@sebastienrousseau/crypto-lib/dist/high-level/secretbox");
|
|
6
|
+
const provider_1 = require("../provider");
|
|
7
|
+
function useEncrypt() {
|
|
8
|
+
const { defaultKey } = (0, provider_1.useCryptoContext)();
|
|
9
|
+
const [ciphertext, setCiphertext] = (0, react_1.useState)(null);
|
|
10
|
+
const [plaintext, setPlaintext] = (0, react_1.useState)(null);
|
|
11
|
+
const [isProcessing, setIsProcessing] = (0, react_1.useState)(false);
|
|
12
|
+
const encrypt = (0, react_1.useCallback)((pt, key) => {
|
|
13
|
+
const k = key ?? defaultKey;
|
|
14
|
+
if (!k) {
|
|
15
|
+
throw new Error("No encryption key provided. Pass a key argument or set defaultKey via CryptoProvider.");
|
|
16
|
+
}
|
|
17
|
+
setIsProcessing(true);
|
|
18
|
+
try {
|
|
19
|
+
const result = (0, secretbox_1.seal)(k, pt);
|
|
20
|
+
setCiphertext(result.sealed);
|
|
21
|
+
return result.sealed;
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
setIsProcessing(false);
|
|
25
|
+
}
|
|
26
|
+
}, [defaultKey]);
|
|
27
|
+
const decrypt = (0, react_1.useCallback)((ct, key) => {
|
|
28
|
+
const k = key ?? defaultKey;
|
|
29
|
+
if (!k) {
|
|
30
|
+
throw new Error("No decryption key provided. Pass a key argument or set defaultKey via CryptoProvider.");
|
|
31
|
+
}
|
|
32
|
+
setIsProcessing(true);
|
|
33
|
+
try {
|
|
34
|
+
const raw = (0, secretbox_1.open)(k, ct);
|
|
35
|
+
const text = Buffer.from(raw).toString("utf8");
|
|
36
|
+
setPlaintext(text);
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
setIsProcessing(false);
|
|
41
|
+
}
|
|
42
|
+
}, [defaultKey]);
|
|
43
|
+
return { encrypt, decrypt, ciphertext, plaintext, isProcessing };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=useEncrypt.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HashAlgorithm } from "@sebastienrousseau/crypto-lib/dist/modern/hash";
|
|
2
|
+
export interface UseHashResult {
|
|
3
|
+
hash: (data: string | Uint8Array, algorithm?: HashAlgorithm) => string;
|
|
4
|
+
digest: string | null;
|
|
5
|
+
isHashing: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useHash(defaultAlgorithm?: HashAlgorithm): UseHashResult;
|
|
8
|
+
//# sourceMappingURL=useHash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHash.d.ts","sourceRoot":"","sources":["../../src/hooks/useHash.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,gDAAgD,CAAC;AAUxD,MAAM,WAAW,aAAa;IAE5B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,SAAS,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;IAEvE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB,SAAS,EAAE,OAAO,CAAC;CACpB;AAeD,wBAAgB,OAAO,CACrB,gBAAgB,GAAE,aAAwB,GACzC,aAAa,CAsBf"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useHash = useHash;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const hash_1 = require("@sebastienrousseau/crypto-lib/dist/modern/hash");
|
|
6
|
+
function useHash(defaultAlgorithm = "sha256") {
|
|
7
|
+
const [digest, setDigest] = (0, react_1.useState)(null);
|
|
8
|
+
const [isHashing, setIsHashing] = (0, react_1.useState)(false);
|
|
9
|
+
const hash = (0, react_1.useCallback)((data, algorithm) => {
|
|
10
|
+
setIsHashing(true);
|
|
11
|
+
try {
|
|
12
|
+
const result = (0, hash_1.hash)({
|
|
13
|
+
algorithm: algorithm ?? defaultAlgorithm,
|
|
14
|
+
data,
|
|
15
|
+
});
|
|
16
|
+
setDigest(result.digest);
|
|
17
|
+
return result.digest;
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
setIsHashing(false);
|
|
21
|
+
}
|
|
22
|
+
}, [defaultAlgorithm]);
|
|
23
|
+
return { hash, digest, isHashing };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=useHash.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type KeyAlgorithm } from "@sebastienrousseau/crypto-lib/dist/keys/keygen";
|
|
2
|
+
export interface UseKeypairResult {
|
|
3
|
+
publicKey: string | null;
|
|
4
|
+
privateKey: string | null;
|
|
5
|
+
algorithm: string | null;
|
|
6
|
+
generate: (algorithm?: KeyAlgorithm) => void;
|
|
7
|
+
isGenerating: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function useKeypair(defaultAlgorithm?: KeyAlgorithm): UseKeypairResult;
|
|
10
|
+
//# sourceMappingURL=useKeypair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKeypair.d.ts","sourceRoot":"","sources":["../../src/hooks/useKeypair.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,gDAAgD,CAAC;AAUxD,MAAM,WAAW,gBAAgB;IAE/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;IAE7C,YAAY,EAAE,OAAO,CAAC;CACvB;AAeD,wBAAgB,UAAU,CACxB,gBAAgB,GAAE,YAAwB,GACzC,gBAAgB,CAsBlB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useKeypair = useKeypair;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const keygen_1 = require("@sebastienrousseau/crypto-lib/dist/keys/keygen");
|
|
6
|
+
function useKeypair(defaultAlgorithm = "ed25519") {
|
|
7
|
+
const [publicKey, setPublicKey] = (0, react_1.useState)(null);
|
|
8
|
+
const [privateKey, setPrivateKey] = (0, react_1.useState)(null);
|
|
9
|
+
const [algorithm, setAlgorithm] = (0, react_1.useState)(null);
|
|
10
|
+
const [isGenerating, setIsGenerating] = (0, react_1.useState)(false);
|
|
11
|
+
const generate = (0, react_1.useCallback)((algo = defaultAlgorithm) => {
|
|
12
|
+
setIsGenerating(true);
|
|
13
|
+
try {
|
|
14
|
+
const kp = (0, keygen_1.generateKeyPair)(algo);
|
|
15
|
+
setPublicKey(kp.publicKey);
|
|
16
|
+
setPrivateKey(kp.privateKey);
|
|
17
|
+
setAlgorithm(kp.algorithm);
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
setIsGenerating(false);
|
|
21
|
+
}
|
|
22
|
+
}, [defaultAlgorithm]);
|
|
23
|
+
return { publicKey, privateKey, algorithm, generate, isGenerating };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=useKeypair.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SignAlgorithm } from "@sebastienrousseau/crypto-lib/dist/crypto";
|
|
2
|
+
export interface UseSignatureResult {
|
|
3
|
+
sign: (privateKey: string, message: string | Uint8Array, algorithm?: SignAlgorithm) => string;
|
|
4
|
+
verify: (publicKey: string, message: string | Uint8Array, signature: string, algorithm?: SignAlgorithm) => boolean;
|
|
5
|
+
signature: string | null;
|
|
6
|
+
isValid: boolean | null;
|
|
7
|
+
isProcessing: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function useSignature(defaultAlgorithm?: SignAlgorithm): UseSignatureResult;
|
|
10
|
+
//# sourceMappingURL=useSignature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignature.d.ts","sourceRoot":"","sources":["../../src/hooks/useSignature.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,2CAA2C,CAAC;AAUnD,MAAM,WAAW,kBAAkB;IAEjC,IAAI,EAAE,CACJ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,SAAS,CAAC,EAAE,aAAa,KACtB,MAAM,CAAC;IAEZ,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,aAAa,KACtB,OAAO,CAAC;IAEb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAExB,YAAY,EAAE,OAAO,CAAC;CACvB;AAgBD,wBAAgB,YAAY,CAC1B,gBAAgB,GAAE,aAAyB,GAC1C,kBAAkB,CAoDpB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSignature = useSignature;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const crypto_1 = require("@sebastienrousseau/crypto-lib/dist/crypto");
|
|
6
|
+
function useSignature(defaultAlgorithm = "ed25519") {
|
|
7
|
+
const [signature, setSignature] = (0, react_1.useState)(null);
|
|
8
|
+
const [isValid, setIsValid] = (0, react_1.useState)(null);
|
|
9
|
+
const [isProcessing, setIsProcessing] = (0, react_1.useState)(false);
|
|
10
|
+
const sign = (0, react_1.useCallback)((privateKey, message, algorithm) => {
|
|
11
|
+
setIsProcessing(true);
|
|
12
|
+
try {
|
|
13
|
+
const sig = crypto_1.crypto.sign(algorithm ?? defaultAlgorithm, privateKey, message);
|
|
14
|
+
setSignature(sig);
|
|
15
|
+
return sig;
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
setIsProcessing(false);
|
|
19
|
+
}
|
|
20
|
+
}, [defaultAlgorithm]);
|
|
21
|
+
const verify = (0, react_1.useCallback)((publicKey, message, sig, algorithm) => {
|
|
22
|
+
setIsProcessing(true);
|
|
23
|
+
try {
|
|
24
|
+
const valid = crypto_1.crypto.verify(algorithm ?? defaultAlgorithm, publicKey, message, sig);
|
|
25
|
+
setIsValid(valid);
|
|
26
|
+
return valid;
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
setIsProcessing(false);
|
|
30
|
+
}
|
|
31
|
+
}, [defaultAlgorithm]);
|
|
32
|
+
return { sign, verify, signature, isValid, isProcessing };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=useSignature.js.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CryptoProvider, useCryptoContext, type CryptoContextValue, type CryptoProviderProps, } from "./provider";
|
|
2
|
+
export { useKeypair, type UseKeypairResult } from "./hooks/useKeypair";
|
|
3
|
+
export { useEncrypt, type UseEncryptResult } from "./hooks/useEncrypt";
|
|
4
|
+
export { useHash, type UseHashResult } from "./hooks/useHash";
|
|
5
|
+
export { useSignature, type UseSignatureResult } from "./hooks/useSignature";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSignature = exports.useHash = exports.useEncrypt = exports.useKeypair = exports.useCryptoContext = exports.CryptoProvider = void 0;
|
|
4
|
+
var provider_1 = require("./provider");
|
|
5
|
+
Object.defineProperty(exports, "CryptoProvider", { enumerable: true, get: function () { return provider_1.CryptoProvider; } });
|
|
6
|
+
Object.defineProperty(exports, "useCryptoContext", { enumerable: true, get: function () { return provider_1.useCryptoContext; } });
|
|
7
|
+
var useKeypair_1 = require("./hooks/useKeypair");
|
|
8
|
+
Object.defineProperty(exports, "useKeypair", { enumerable: true, get: function () { return useKeypair_1.useKeypair; } });
|
|
9
|
+
var useEncrypt_1 = require("./hooks/useEncrypt");
|
|
10
|
+
Object.defineProperty(exports, "useEncrypt", { enumerable: true, get: function () { return useEncrypt_1.useEncrypt; } });
|
|
11
|
+
var useHash_1 = require("./hooks/useHash");
|
|
12
|
+
Object.defineProperty(exports, "useHash", { enumerable: true, get: function () { return useHash_1.useHash; } });
|
|
13
|
+
var useSignature_1 = require("./hooks/useSignature");
|
|
14
|
+
Object.defineProperty(exports, "useSignature", { enumerable: true, get: function () { return useSignature_1.useSignature; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface CryptoContextValue {
|
|
3
|
+
defaultKey?: string;
|
|
4
|
+
serverUrl?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CryptoProviderProps extends CryptoContextValue {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function CryptoProvider({ children, ...config }: CryptoProviderProps): import("react").JSX.Element;
|
|
11
|
+
export declare function useCryptoContext(): CryptoContextValue;
|
|
12
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAU3E,MAAM,WAAW,kBAAkB;IAEjC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAYD,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAE7D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAgBD,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,mBAAmB,+BAM1E;AAaD,wBAAgB,gBAAgB,IAAI,kBAAkB,CAErD"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CryptoProvider = CryptoProvider;
|
|
4
|
+
exports.useCryptoContext = useCryptoContext;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const CryptoContext = (0, react_1.createContext)({});
|
|
8
|
+
function CryptoProvider({ children, ...config }) {
|
|
9
|
+
const value = (0, react_1.useMemo)(() => config, [config.defaultKey, config.serverUrl, config.apiKey]);
|
|
10
|
+
return (0, jsx_runtime_1.jsx)(CryptoContext.Provider, { value: value, children: children });
|
|
11
|
+
}
|
|
12
|
+
function useCryptoContext() {
|
|
13
|
+
return (0, react_1.useContext)(CryptoContext);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=provider.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sebastienrousseau/crypto-react",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "React hooks for client-side cryptography -- key generation, encryption, signing, and hashing in a single import.",
|
|
5
|
+
"author": "Sebastien Rousseau <sebastienrousseau@users.noreply.github.com>",
|
|
6
|
+
"license": "MIT OR Apache-2.0",
|
|
7
|
+
"homepage": "https://github.com/sebastienrousseau/crypto-service/tree/main/packages/crypto-react",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sebastienrousseau/crypto-service.git",
|
|
11
|
+
"directory": "packages/crypto-react"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/sebastienrousseau/crypto-service/issues"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=22.0.0"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"require": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist/**/*.js",
|
|
31
|
+
"dist/**/*.d.ts",
|
|
32
|
+
"dist/**/*.d.ts.map"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@sebastienrousseau/crypto-lib": "0.0.8"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "^19.3.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@sebastienrousseau/mocha-config": "^0.0.5",
|
|
42
|
+
"@types/chai": "^4.3.7",
|
|
43
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
44
|
+
"@types/mocha": "^10.0.2",
|
|
45
|
+
"@types/node": "^26.6.3",
|
|
46
|
+
"@types/react": "^19.3.0",
|
|
47
|
+
"c8": "^12.0.0",
|
|
48
|
+
"chai": "^4.5.0",
|
|
49
|
+
"chai-as-promised": "^7.1.2",
|
|
50
|
+
"mocha": "^10.8.2",
|
|
51
|
+
"react": "^19.3.0",
|
|
52
|
+
"rimraf": "^6.1.3",
|
|
53
|
+
"ts-node": "^10.9.2",
|
|
54
|
+
"typedoc": "^0.28.20",
|
|
55
|
+
"typescript": "~5.9.3"
|
|
56
|
+
},
|
|
57
|
+
"keywords": [
|
|
58
|
+
"react",
|
|
59
|
+
"hooks",
|
|
60
|
+
"cryptography",
|
|
61
|
+
"encryption",
|
|
62
|
+
"signing",
|
|
63
|
+
"hashing",
|
|
64
|
+
"keygen",
|
|
65
|
+
"crypto"
|
|
66
|
+
],
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
},
|
|
70
|
+
"private": false,
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsc --build tsconfig.json",
|
|
73
|
+
"clean": "rimraf ./coverage ./dist ./docs",
|
|
74
|
+
"test": "c8 --check-coverage --lines 100 --branches 100 --functions 100 --reporter=lcov --reporter=text mocha --config=.mocharc.cjs",
|
|
75
|
+
"docs": "typedoc",
|
|
76
|
+
"lint": "eslint --ext .ts src __tests__",
|
|
77
|
+
"lint:fix": "eslint --cache --fix --ext .ts src __tests__",
|
|
78
|
+
"format": "prettier --write src/**/*.ts",
|
|
79
|
+
"format:check": "prettier --check \"src/**/*.ts\""
|
|
80
|
+
}
|
|
81
|
+
}
|