Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 149 additions & 0 deletions .claude/agents/app-debug-specialist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# App Debug Specialist

**Use this agent for**: React Native app debugging, log analysis, test automation, and iterative development workflows.

## Responsibilities

### Test & Debug Workflow
- Run Maestro tests and capture iOS simulator logs
- Parse and analyze console output for specific issues
- Set up automated logging with react-native-logs
- Manage Metro bundler lifecycle (start, restart, monitor)
- Coordinate test runs with log capture

### Log Management
- Capture iOS simulator logs: `xcrun simctl spawn booted log stream --predicate 'processImagePath endswith "QuickCryptoExample"' --level debug`
- Filter logs for relevant patterns
- Save logs to `/tmp/rnqc-session.log` for analysis
- Monitor Metro bundler output at `/tmp/metro.log`

### Iteration Speed Tools
- Keep Metro running in background (PID in `/tmp/metro.pid`)
- Reload app without full rebuild when possible
- Use Maestro for automated UI testing
- Chain commands efficiently (rebuild TS → rebuild iOS → run test → capture logs)

## Key Scripts

### Debug Test Runner
```bash
./scripts/debug-test.sh [test-flow] [--rebuild-ts]
```

### Manual Workflow
```bash
# 1. Ensure Metro is running
bun start > /tmp/metro.log 2>&1 & echo $! > /tmp/metro.pid

# 2. Capture logs
xcrun simctl spawn booted log stream \
--predicate 'processImagePath endswith "QuickCryptoExample"' \
--level debug > /tmp/rnqc-session.log 2>&1 & LOG_PID=$!

# 3. Run test
cd example && maestro test test/e2e/import-export-local.yml

# 4. Stop log capture and view
kill $LOG_PID
grep -E "pattern" /tmp/rnqc-session.log
```

## Common Patterns

### Rebuild & Test Cycle
```bash
# Full rebuild (TypeScript + iOS)
cd packages/react-native-quick-crypto && npm run prepare
cd ../../example && bun ios

# Then run debug test
./scripts/debug-test.sh
```

### TypeScript-only Changes
```bash
# Rebuild TypeScript
cd packages/react-native-quick-crypto && npm run prepare

# Metro will auto-reload, or manually restart it
pkill -P $(cat /tmp/metro.pid) && bun start & echo $! > /tmp/metro.pid
```

### C++ Changes
```bash
# Requires full iOS rebuild
cd example && bun ios
```

## Log Filtering Patterns

### JavaScript Console Logs
```bash
grep -i "javascript" /tmp/rnqc-session.log
```

### Specific Debug Messages
```bash
grep -E "asymmetricKeyDetails|keyDetail|rsaImportKey" /tmp/rnqc-session.log
```

### All App Logs (with context)
```bash
tail -f /tmp/rnqc-session.log
```

## Metro Management

### Check if Running
```bash
[ -f /tmp/metro.pid ] && ps -p $(cat /tmp/metro.pid) && echo "Running" || echo "Not running"
```

### Start Metro
```bash
cd example && bun start > /tmp/metro.log 2>&1 & echo $! > /tmp/metro.pid
```

### Stop Metro
```bash
kill $(cat /tmp/metro.pid) 2>/dev/null && rm /tmp/metro.pid
```

### View Metro Logs
```bash
tail -f /tmp/metro.log
```

## Maestro Tests

### Available Flows
- `test/e2e/import-export-local.yml` - Just the importKey/exportKey suite
- `test/e2e/test-suites-flow.yml` - Full test suite

### Run Specific Test
```bash
cd example && maestro test test/e2e/import-export-local.yml
```

## Debugging Tips

1. **Always keep Metro running** - Don't kill it between test runs
2. **TypeScript changes** - Require Metro reload, not full rebuild
3. **C++ changes** - Require full iOS rebuild
4. **Log capture timing** - Start before test, stop 3-5s after test completes
5. **Check PID files** - Metro and log capture PIDs in `/tmp/`

## Files to Monitor

- `/tmp/rnqc-session.log` - iOS simulator logs
- `/tmp/metro.log` - Metro bundler output
- `/tmp/metro.pid` - Metro process ID
- `example/test/e2e/*.yml` - Maestro test flows

## Integration with Main Workflow

This specialist works with:
- **cpp-specialist** - For C++ debugging and OpenSSL issues
- **typescript-specialist** - For TS/JS debugging
- **crypto-specialist** - For crypto correctness verification
- **testing-specialist** - For test strategy and assertion design
2 changes: 1 addition & 1 deletion .claude/agents/typescript-specialist.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Before marking task complete:

## Tools Available

- Use `bun` as package manager (1.2+)
- Use `bun` as package manager (1.3+)
- TypeScript strict mode enabled
- Prettier for formatting
- Access to Nitro Modules documentation via `llms.txt` if available
Expand Down
42 changes: 21 additions & 21 deletions docs/implementation-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,26 +312,26 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
## `subtle.exportKey`
| Key Type | `spki` | `pkcs8` | `jwk` | `raw` | `raw-secret` | `raw-public` | `raw-seed` |
| ------------------- | :----: | :-----: | :---: | :---: | :---: | :---: | :---: |
| `AES-CBC` | | | | | | | |
| `AES-CTR` | | | | | | | |
| `AES-GCM` | | | | | | | |
| `AES-KW` | | | | | | | |
| `AES-CBC` | | | | | | | |
| `AES-CTR` | | | | | | | |
| `AES-GCM` | | | | | | | |
| `AES-KW` | | | | | | | |
| `AES-OCB` | | | ❌ | | ❌ | | |
| `ChaCha20-Poly1305` | | | ❌ | | ❌ | | |
| `ECDH` | | | | | | | |
| `ECDSA` | | | | | | | |
| `ECDH` | | | | | | | |
| `ECDSA` | | | | | | | |
| `Ed25519` | ❌ | ❌ | ❌ | ❌ | | ❌ | |
| `Ed448` | ❌ | ❌ | ❌ | ❌ | | ❌ | |
| `HMAC` | | | | | | | |
| `HMAC` | | | | | | | |
| `ML-DSA-44` | ❌ | ❌ | ❌ | | | ❌ | ❌ |
| `ML-DSA-65` | ❌ | ❌ | ❌ | | | ❌ | ❌ |
| `ML-DSA-87` | ❌ | ❌ | ❌ | | | ❌ | ❌ |
| `ML-KEM-512` | ❌ | ❌ | | | | ❌ | ❌ |
| `ML-KEM-768` | ❌ | ❌ | | | | ❌ | ❌ |
| `ML-KEM-1024` | ❌ | ❌ | | | | ❌ | ❌ |
| `RSA-OAEP` | | | | | | | |
| `RSA-PSS` | | | | | | | |
| `RSASSA-PKCS1-v1_5` | | | | | | | |
| `RSA-OAEP` | | | | | | | |
| `RSA-PSS` | | | | | | | |
| `RSASSA-PKCS1-v1_5` | | | | | | | |

* ` ` - not implemented in Node
* ❌ - implemented in Node, not RNQC
Expand Down Expand Up @@ -372,28 +372,28 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
## `subtle.importKey`
| Key Type | `spki` | `pkcs8` | `jwk` | `raw` | `raw-secret` | `raw-public` | `raw-seed` |
| ------------------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| `AES-CBC` | | | | | | | |
| `AES-CTR` | | | | | | | |
| `AES-GCM` | | | | | | | |
| `AES-KW` | | | | | | | |
| `AES-CBC` | | | | | | | |
| `AES-CTR` | | | | | | | |
| `AES-GCM` | | | | | | | |
| `AES-KW` | | | | | | | |
| `AES-OCB` | | | ❌ | | ❌ | | |
| `ChaCha20-Poly1305` | | | ❌ | | ❌ | | |
| `ECDH` | | | | | | | |
| `ECDSA` | | | | | | | |
| `ECDH` | | | | | | | |
| `ECDSA` | | | | | | | |
| `Ed25519` | ❌ | ❌ | ❌ | ❌ | | ❌ | |
| `Ed448` | ❌ | ❌ | ❌ | ❌ | | ❌ | |
| `HDKF` | | | | ❌ | ❌ | | |
| `HMAC` | | | | | | | |
| `HMAC` | | | | | | | |
| `ML-DSA-44` | ❌ | ❌ | ❌ | | | ❌ | ❌ |
| `ML-DSA-65` | ❌ | ❌ | ❌ | | | ❌ | ❌ |
| `ML-DSA-87` | ❌ | ❌ | ❌ | | | ❌ | ❌ |
| `ML-KEM-512` | ❌ | ❌ | | | | ❌ | ❌ |
| `ML-KEM-768` | ❌ | ❌ | | | | ❌ | ❌ |
| `ML-KEM-1024` | ❌ | ❌ | | | | ❌ | ❌ |
| `PBKDF2` | | | | | | | |
| `RSA-OAEP` | | ❌ | | | | | |
| `RSA-PSS` | | ❌ | | | | | |
| `RSASSA-PKCS1-v1_5` | | ❌ | | | | | |
| `PBKDF2` | | | | | | | |
| `RSA-OAEP` | | ❌ | | | | | |
| `RSA-PSS` | | ❌ | | | | | |
| `RSASSA-PKCS1-v1_5` | | ❌ | | | | | |
| `X25519` | ❌ | ❌ | ❌ | ❌ | | ❌ | |
| `X448` | ❌ | ❌ | ❌ | ❌ | | ❌ | |

Expand Down
4 changes: 0 additions & 4 deletions example/.bundle/config

This file was deleted.

4 changes: 2 additions & 2 deletions example/ios/QuickCryptoExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
Expand Down Expand Up @@ -481,7 +481,7 @@
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ENABLE_EXPLICIT_MODULES = NO;
USE_HERMES = true;
Expand Down
2 changes: 1 addition & 1 deletion example/src/hooks/useTestsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import '../tests/subtle/deriveBits';
import '../tests/subtle/digest';
// import '../tests/subtle/encrypt_decrypt';
import '../tests/subtle/generateKey';
// import '../tests/subtle/import_export';
import '../tests/subtle/import_export';
import '../tests/subtle/sign_verify';

export const useTestsList = (): [
Expand Down
2 changes: 1 addition & 1 deletion example/src/tests/hash/hash_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ test(SUITE, 'update - calling update without argument', () => {
expect(() => {
// @ts-expect-error calling update without argument
hash.update();
}).to.throw(/input could not be converted/);
}).to.throw(/Invalid argument type/);
});
test(SUITE, 'digest - calling update after digest', () => {
const hash = createHash('sha256');
Expand Down
Loading