@ricsam/quickjs-crypto 0.2.16 → 0.2.17
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/README.md +18 -6
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/package.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @ricsam/quickjs-crypto
|
|
2
2
|
|
|
3
|
-
Web Crypto API implementation
|
|
3
|
+
Web Crypto API implementation for QuickJS runtime.
|
|
4
|
+
|
|
5
|
+
> **Note**: This is a low-level package. For most use cases, use [`@ricsam/quickjs-runtime`](../runtime) with `createRuntime()` instead.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @ricsam/quickjs-crypto
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
4
14
|
|
|
5
15
|
```typescript
|
|
6
16
|
import { setupCrypto } from "@ricsam/quickjs-crypto";
|
|
@@ -8,12 +18,13 @@ import { setupCrypto } from "@ricsam/quickjs-crypto";
|
|
|
8
18
|
const handle = setupCrypto(context);
|
|
9
19
|
```
|
|
10
20
|
|
|
11
|
-
|
|
21
|
+
## Injected Globals
|
|
22
|
+
|
|
12
23
|
- `crypto.getRandomValues(array)` - Fill a TypedArray with random bytes
|
|
13
24
|
- `crypto.randomUUID()` - Generate a random UUID v4
|
|
14
25
|
- `crypto.subtle` - SubtleCrypto interface for cryptographic operations
|
|
15
26
|
|
|
16
|
-
|
|
27
|
+
## Usage in QuickJS
|
|
17
28
|
|
|
18
29
|
```javascript
|
|
19
30
|
// Generate random bytes
|
|
@@ -51,7 +62,7 @@ const decrypted = await crypto.subtle.decrypt(
|
|
|
51
62
|
);
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
## SubtleCrypto Methods
|
|
55
66
|
|
|
56
67
|
| Method | Description |
|
|
57
68
|
|--------|-------------|
|
|
@@ -63,7 +74,8 @@ const decrypted = await crypto.subtle.decrypt(
|
|
|
63
74
|
| `deriveBits` / `deriveKey` | Derive keys (PBKDF2, ECDH) |
|
|
64
75
|
| `wrapKey` / `unwrapKey` | Wrap/unwrap keys for secure transport |
|
|
65
76
|
|
|
66
|
-
|
|
77
|
+
## Supported Algorithms
|
|
78
|
+
|
|
67
79
|
- **Encryption**: AES-GCM, AES-CBC
|
|
68
80
|
- **Signing**: HMAC, ECDSA
|
|
69
81
|
- **Hashing**: SHA-256, SHA-384, SHA-512
|
|
@@ -72,4 +84,4 @@ const decrypted = await crypto.subtle.decrypt(
|
|
|
72
84
|
|
|
73
85
|
> **Note**: Cryptographic operations are delegated to the host's native `crypto.subtle` implementation, ensuring secure and performant cryptography.
|
|
74
86
|
|
|
75
|
-
**See also:** [MDN Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
|
|
87
|
+
**See also:** [MDN Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
|
package/dist/cjs/package.json
CHANGED
package/dist/mjs/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/quickjs-crypto",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"main": "./dist/cjs/index.cjs",
|
|
5
5
|
"types": "./dist/types/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"typecheck": "tsc --noEmit"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@ricsam/quickjs-core": "^0.2.
|
|
22
|
+
"@ricsam/quickjs-core": "^0.2.17",
|
|
23
23
|
"quickjs-emscripten": "^0.31.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|