Skip to content

Commit ad5a961

Browse files
authored
feat: add ML-KEM/ML-DSA raw-public and raw-seed export/import (#943)
1 parent 34e61cd commit ad5a961

11 files changed

Lines changed: 587 additions & 86 deletions

File tree

.claude/commands/commit.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,32 @@ When activated, commit the current working tree changes:
2323
- If nothing is staged, run `git add -A` to stage everything
2424
- Run `git diff --staged --stat` to confirm what will be committed
2525

26-
4. **Generate commit message**:
26+
4. **Run code quality checks before committing**:
27+
- **C++ files**: If any `.cpp`/`.hpp`/`.h` files are staged, run:
28+
```bash
29+
clang-format -i <files>
30+
```
31+
Then re-stage them with `git add`.
32+
- **TypeScript files**: If any `.ts`/`.tsx` files are staged, run:
33+
```bash
34+
npx prettier --write <files>
35+
```
36+
Then re-stage them with `git add`.
37+
- **Type check**: Run `cd packages/react-native-quick-crypto && bun tsc --noEmit` to verify types.
38+
39+
5. **Generate commit message**:
2740
- Use conventional commit format: `type: short description`
2841
- Types: `feat`, `fix`, `refactor`, `chore`, `docs`, `test`
2942
- If the change is substantial, add a body paragraph separated by a blank line
3043
- Body should explain **what** changed and **why**, not how (the diff shows how)
3144
- Keep the subject line under 72 characters
3245

33-
5. **Commit**:
46+
6. **Commit** (with 120000ms timeout — pre-commit hooks run lint-staged, clang-format, tsc, and bob build):
3447
```bash
3548
git commit -m "<message>"
3649
```
50+
**NEVER use `--no-verify`.** Pre-commit hooks exist to catch errors. If they fail, fix the issue.
3751

38-
6. **Report** the commit hash and summary to the user
52+
7. **Report** the commit hash and summary to the user
3953

4054
If the user provides arguments (e.g., `/commit "fix: resolve race condition"`), use that as the commit message instead of generating one.

.claude/rules/git-safety.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<rules category="git">
2+
<rule severity="CRITICAL" enforcement="BLOCKING">
3+
<name>Never bypass pre-commit hooks</name>
4+
<description>NEVER use --no-verify on git commit or git push</description>
5+
<requirements>
6+
<requirement>NEVER pass --no-verify or -n to git commit</requirement>
7+
<requirement>NEVER pass --no-verify to git push</requirement>
8+
<requirement>If pre-commit hooks fail, fix the underlying issue</requirement>
9+
<requirement>Use 120000ms timeout for git commit — hooks run lint-staged, clang-format, tsc, and bob build</requirement>
10+
</requirements>
11+
<rationale>
12+
Pre-commit hooks enforce code quality (formatting, linting, type checking, build).
13+
Bypassing them hides errors that will surface later in CI or code review.
14+
</rationale>
15+
<mustAcknowledge>true</mustAcknowledge>
16+
</rule>
17+
18+
<rule severity="CRITICAL" enforcement="BLOCKING">
19+
<name>Never commit to main</name>
20+
<description>Always create a feature branch before committing</description>
21+
<requirements>
22+
<requirement>Check current branch before committing</requirement>
23+
<requirement>Create feat/, fix/, or refactor/ branch if on main</requirement>
24+
</requirements>
25+
</rule>
26+
27+
<rule severity="HIGH" enforcement="STRICT">
28+
<name>Pre-commit code quality</name>
29+
<description>Run formatters on changed files before committing</description>
30+
<requirements>
31+
<requirement>Run clang-format -i on all modified .cpp/.hpp/.h files before staging</requirement>
32+
<requirement>Run npx prettier --write on all modified .ts/.tsx files before staging</requirement>
33+
<requirement>Run tsc --noEmit to verify types compile</requirement>
34+
</requirements>
35+
<rationale>
36+
Running formatters proactively prevents pre-commit hook failures
37+
and avoids the need to amend commits.
38+
</rationale>
39+
</rule>
40+
</rules>

.docs/implementation-coverage.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,14 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
280280
-`subtle.digest(algorithm, data)`
281281
-`subtle.encapsulateBits(encapsulationAlgorithm, encapsulationKey)`
282282
-`subtle.encapsulateKey(encapsulationAlgorithm, encapsulationKey, sharedKeyAlgorithm, extractable, usages)`
283-
- 🚧 `subtle.encrypt(algorithm, key, data)`
284-
- 🚧 `subtle.exportKey(format, key)`
283+
- `subtle.encrypt(algorithm, key, data)`
284+
- `subtle.exportKey(format, key)`
285285
- 🚧 `subtle.generateKey(algorithm, extractable, keyUsages)`
286286
-`subtle.getPublicKey(key, keyUsages)`
287-
- 🚧 `subtle.importKey(format, keyData, algorithm, extractable, keyUsages)`
288-
- `subtle.sign(algorithm, key, data)`
287+
- `subtle.importKey(format, keyData, algorithm, extractable, keyUsages)`
288+
- 🚧 `subtle.sign(algorithm, key, data)`
289289
-`subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)`
290-
- `subtle.verify(algorithm, key, signature, data)`
290+
- 🚧 `subtle.verify(algorithm, key, signature, data)`
291291
-`subtle.wrapKey(format, key, wrappingKey, wrapAlgo)`
292292

293293
## `subtle.decrypt`
@@ -372,9 +372,9 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
372372
| `ML-DSA-44` |||| | |||
373373
| `ML-DSA-65` |||| | |||
374374
| `ML-DSA-87` |||| | |||
375-
| `ML-KEM-512` ||| | | | | |
376-
| `ML-KEM-768` ||| | | | | |
377-
| `ML-KEM-1024` ||| | | | | |
375+
| `ML-KEM-512` ||| | | | | |
376+
| `ML-KEM-768` ||| | | | | |
377+
| `ML-KEM-1024` ||| | | | | |
378378
| `RSA-OAEP` |||| | | | |
379379
| `RSA-PSS` |||| | | | |
380380
| `RSASSA-PKCS1-v1_5` |||| | | | |
@@ -441,9 +441,9 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
441441
| `ML-DSA-44` |||| | |||
442442
| `ML-DSA-65` |||| | |||
443443
| `ML-DSA-87` |||| | |||
444-
| `ML-KEM-512` ||| | | | | |
445-
| `ML-KEM-768` ||| | | | | |
446-
| `ML-KEM-1024` ||| | | | | |
444+
| `ML-KEM-512` ||| | | | | |
445+
| `ML-KEM-768` ||| | | | | |
446+
| `ML-KEM-1024` ||| | | | | |
447447
| `PBKDF2` | | | ||| | |
448448
| `RSA-OAEP` |||| | | | |
449449
| `RSA-PSS` |||| | | | |
@@ -499,9 +499,9 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
499499
| `ML-DSA-44` ||
500500
| `ML-DSA-65` ||
501501
| `ML-DSA-87` ||
502-
| `ML-KEM-512` | |
503-
| `ML-KEM-768` | |
504-
| `ML-KEM-1024` | |
502+
| `ML-KEM-512` | |
503+
| `ML-KEM-768` | |
504+
| `ML-KEM-1024` | |
505505
| `RSA-OAEP` ||
506506
| `RSA-PSS` ||
507507
| `RSASSA-PKCS1-v1_5` ||

0 commit comments

Comments
 (0)