Skip to content

Commit c35c43d

Browse files
committed
feat: subtle.importKey/exportKey
1 parent a057d71 commit c35c43d

File tree

21 files changed

+1892
-285
lines changed

21 files changed

+1892
-285
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# App Debug Specialist
2+
3+
**Use this agent for**: React Native app debugging, log analysis, test automation, and iterative development workflows.
4+
5+
## Responsibilities
6+
7+
### Test & Debug Workflow
8+
- Run Maestro tests and capture iOS simulator logs
9+
- Parse and analyze console output for specific issues
10+
- Set up automated logging with react-native-logs
11+
- Manage Metro bundler lifecycle (start, restart, monitor)
12+
- Coordinate test runs with log capture
13+
14+
### Log Management
15+
- Capture iOS simulator logs: `xcrun simctl spawn booted log stream --predicate 'processImagePath endswith "QuickCryptoExample"' --level debug`
16+
- Filter logs for relevant patterns
17+
- Save logs to `/tmp/rnqc-session.log` for analysis
18+
- Monitor Metro bundler output at `/tmp/metro.log`
19+
20+
### Iteration Speed Tools
21+
- Keep Metro running in background (PID in `/tmp/metro.pid`)
22+
- Reload app without full rebuild when possible
23+
- Use Maestro for automated UI testing
24+
- Chain commands efficiently (rebuild TS → rebuild iOS → run test → capture logs)
25+
26+
## Key Scripts
27+
28+
### Debug Test Runner
29+
```bash
30+
./scripts/debug-test.sh [test-flow] [--rebuild-ts]
31+
```
32+
33+
### Manual Workflow
34+
```bash
35+
# 1. Ensure Metro is running
36+
bun start > /tmp/metro.log 2>&1 & echo $! > /tmp/metro.pid
37+
38+
# 2. Capture logs
39+
xcrun simctl spawn booted log stream \
40+
--predicate 'processImagePath endswith "QuickCryptoExample"' \
41+
--level debug > /tmp/rnqc-session.log 2>&1 & LOG_PID=$!
42+
43+
# 3. Run test
44+
cd example && maestro test test/e2e/import-export-local.yml
45+
46+
# 4. Stop log capture and view
47+
kill $LOG_PID
48+
grep -E "pattern" /tmp/rnqc-session.log
49+
```
50+
51+
## Common Patterns
52+
53+
### Rebuild & Test Cycle
54+
```bash
55+
# Full rebuild (TypeScript + iOS)
56+
cd packages/react-native-quick-crypto && npm run prepare
57+
cd ../../example && bun ios
58+
59+
# Then run debug test
60+
./scripts/debug-test.sh
61+
```
62+
63+
### TypeScript-only Changes
64+
```bash
65+
# Rebuild TypeScript
66+
cd packages/react-native-quick-crypto && npm run prepare
67+
68+
# Metro will auto-reload, or manually restart it
69+
pkill -P $(cat /tmp/metro.pid) && bun start & echo $! > /tmp/metro.pid
70+
```
71+
72+
### C++ Changes
73+
```bash
74+
# Requires full iOS rebuild
75+
cd example && bun ios
76+
```
77+
78+
## Log Filtering Patterns
79+
80+
### JavaScript Console Logs
81+
```bash
82+
grep -i "javascript" /tmp/rnqc-session.log
83+
```
84+
85+
### Specific Debug Messages
86+
```bash
87+
grep -E "asymmetricKeyDetails|keyDetail|rsaImportKey" /tmp/rnqc-session.log
88+
```
89+
90+
### All App Logs (with context)
91+
```bash
92+
tail -f /tmp/rnqc-session.log
93+
```
94+
95+
## Metro Management
96+
97+
### Check if Running
98+
```bash
99+
[ -f /tmp/metro.pid ] && ps -p $(cat /tmp/metro.pid) && echo "Running" || echo "Not running"
100+
```
101+
102+
### Start Metro
103+
```bash
104+
cd example && bun start > /tmp/metro.log 2>&1 & echo $! > /tmp/metro.pid
105+
```
106+
107+
### Stop Metro
108+
```bash
109+
kill $(cat /tmp/metro.pid) 2>/dev/null && rm /tmp/metro.pid
110+
```
111+
112+
### View Metro Logs
113+
```bash
114+
tail -f /tmp/metro.log
115+
```
116+
117+
## Maestro Tests
118+
119+
### Available Flows
120+
- `test/e2e/import-export-local.yml` - Just the importKey/exportKey suite
121+
- `test/e2e/test-suites-flow.yml` - Full test suite
122+
123+
### Run Specific Test
124+
```bash
125+
cd example && maestro test test/e2e/import-export-local.yml
126+
```
127+
128+
## Debugging Tips
129+
130+
1. **Always keep Metro running** - Don't kill it between test runs
131+
2. **TypeScript changes** - Require Metro reload, not full rebuild
132+
3. **C++ changes** - Require full iOS rebuild
133+
4. **Log capture timing** - Start before test, stop 3-5s after test completes
134+
5. **Check PID files** - Metro and log capture PIDs in `/tmp/`
135+
136+
## Files to Monitor
137+
138+
- `/tmp/rnqc-session.log` - iOS simulator logs
139+
- `/tmp/metro.log` - Metro bundler output
140+
- `/tmp/metro.pid` - Metro process ID
141+
- `example/test/e2e/*.yml` - Maestro test flows
142+
143+
## Integration with Main Workflow
144+
145+
This specialist works with:
146+
- **cpp-specialist** - For C++ debugging and OpenSSL issues
147+
- **typescript-specialist** - For TS/JS debugging
148+
- **crypto-specialist** - For crypto correctness verification
149+
- **testing-specialist** - For test strategy and assertion design

.claude/agents/typescript-specialist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Before marking task complete:
236236

237237
## Tools Available
238238

239-
- Use `bun` as package manager (1.2+)
239+
- Use `bun` as package manager (1.3+)
240240
- TypeScript strict mode enabled
241241
- Prettier for formatting
242242
- Access to Nitro Modules documentation via `llms.txt` if available

docs/implementation-coverage.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -312,26 +312,26 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
312312
## `subtle.exportKey`
313313
| Key Type | `spki` | `pkcs8` | `jwk` | `raw` | `raw-secret` | `raw-public` | `raw-seed` |
314314
| ------------------- | :----: | :-----: | :---: | :---: | :---: | :---: | :---: |
315-
| `AES-CBC` | | | | | | | |
316-
| `AES-CTR` | | | | | | | |
317-
| `AES-GCM` | | | | | | | |
318-
| `AES-KW` | | | | | | | |
315+
| `AES-CBC` | | | | | | | |
316+
| `AES-CTR` | | | | | | | |
317+
| `AES-GCM` | | | | | | | |
318+
| `AES-KW` | | | | | | | |
319319
| `AES-OCB` | | || || | |
320320
| `ChaCha20-Poly1305` | | || || | |
321-
| `ECDH` | | | | | | | |
322-
| `ECDSA` | | | | | | | |
321+
| `ECDH` | | | | | | | |
322+
| `ECDSA` | | | | | | | |
323323
| `Ed25519` ||||| || |
324324
| `Ed448` ||||| || |
325-
| `HMAC` | | | | | | | |
325+
| `HMAC` | | | | | | | |
326326
| `ML-DSA-44` |||| | |||
327327
| `ML-DSA-65` |||| | |||
328328
| `ML-DSA-87` |||| | |||
329329
| `ML-KEM-512` ||| | | |||
330330
| `ML-KEM-768` ||| | | |||
331331
| `ML-KEM-1024` ||| | | |||
332-
| `RSA-OAEP` | | | | | | | |
333-
| `RSA-PSS` | | | | | | | |
334-
| `RSASSA-PKCS1-v1_5` | | | | | | | |
332+
| `RSA-OAEP` | | | | | | | |
333+
| `RSA-PSS` | | | | | | | |
334+
| `RSASSA-PKCS1-v1_5` | | | | | | | |
335335

336336
* ` ` - not implemented in Node
337337
* ❌ - implemented in Node, not RNQC
@@ -372,28 +372,28 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
372372
## `subtle.importKey`
373373
| Key Type | `spki` | `pkcs8` | `jwk` | `raw` | `raw-secret` | `raw-public` | `raw-seed` |
374374
| ------------------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
375-
| `AES-CBC` | | | | | | | |
376-
| `AES-CTR` | | | | | | | |
377-
| `AES-GCM` | | | | | | | |
378-
| `AES-KW` | | | | | | | |
375+
| `AES-CBC` | | | | | | | |
376+
| `AES-CTR` | | | | | | | |
377+
| `AES-GCM` | | | | | | | |
378+
| `AES-KW` | | | | | | | |
379379
| `AES-OCB` | | || || | |
380380
| `ChaCha20-Poly1305` | | || || | |
381-
| `ECDH` | | | | | | | |
382-
| `ECDSA` | | | | | | | |
381+
| `ECDH` | | | | | | | |
382+
| `ECDSA` | | | | | | | |
383383
| `Ed25519` ||||| || |
384384
| `Ed448` ||||| || |
385385
| `HDKF` | | | ||| | |
386-
| `HMAC` | | | | | | | |
386+
| `HMAC` | | | | | | | |
387387
| `ML-DSA-44` |||| | |||
388388
| `ML-DSA-65` |||| | |||
389389
| `ML-DSA-87` |||| | |||
390390
| `ML-KEM-512` ||| | | |||
391391
| `ML-KEM-768` ||| | | |||
392392
| `ML-KEM-1024` ||| | | |||
393-
| `PBKDF2` | | | | | | | |
394-
| `RSA-OAEP` | || | | | | |
395-
| `RSA-PSS` | || | | | | |
396-
| `RSASSA-PKCS1-v1_5` | || | | | | |
393+
| `PBKDF2` | | | | | | | |
394+
| `RSA-OAEP` | || | | | | |
395+
| `RSA-PSS` | || | | | | |
396+
| `RSASSA-PKCS1-v1_5` | || | | | | |
397397
| `X25519` ||||| || |
398398
| `X448` ||||| || |
399399

example/.bundle/config

Lines changed: 0 additions & 4 deletions
This file was deleted.

example/ios/QuickCryptoExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@
396396
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
397397
);
398398
OTHER_LDFLAGS = "$(inherited)";
399-
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
399+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native";
400400
SDKROOT = iphoneos;
401401
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
402402
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
@@ -481,7 +481,7 @@
481481
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
482482
);
483483
OTHER_LDFLAGS = "$(inherited)";
484-
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
484+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native";
485485
SDKROOT = iphoneos;
486486
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
487487
USE_HERMES = true;

example/src/hooks/useTestsList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import '../tests/subtle/deriveBits';
1616
import '../tests/subtle/digest';
1717
// import '../tests/subtle/encrypt_decrypt';
1818
import '../tests/subtle/generateKey';
19-
// import '../tests/subtle/import_export';
19+
import '../tests/subtle/import_export';
2020
import '../tests/subtle/sign_verify';
2121

2222
export const useTestsList = (): [

example/src/tests/hash/hash_tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ test(SUITE, 'update - calling update without argument', () => {
217217
expect(() => {
218218
// @ts-expect-error calling update without argument
219219
hash.update();
220-
}).to.throw(/input could not be converted/);
220+
}).to.throw(/Invalid argument type/);
221221
});
222222
test(SUITE, 'digest - calling update after digest', () => {
223223
const hash = createHash('sha256');

0 commit comments

Comments
 (0)