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
1 change: 0 additions & 1 deletion .cursorrules

This file was deleted.

9 changes: 9 additions & 0 deletions .windsurf/rules/cpp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
trigger: glob
globs: *.cpp,*.hpp
---

## C++
- Use smart pointers in C++.
- Use modern C++ features.
- Set up builds for C++ 20, no lower
12 changes: 12 additions & 0 deletions .windsurf/rules/local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
trigger: always_on
---

# Local Codebases

Use these instead of web searches for Node and 0.x branch:

- NodeJS code is located at `$HOME/dev/node`
- use its `deps/ncrypto` code as a bible for crypto operations, and update this library's copy occasionally when we're implementing new features

- The old 0.x branch codebase is located at `$HOME/dev/rnqc/0.x`
35 changes: 6 additions & 29 deletions .rules → .windsurf/rules/project.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
trigger: always_on
---

# React Native Quick Crypto

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.
Expand All @@ -10,6 +14,7 @@ Every time you choose to apply a rule(s), explicitly state the rule(s) in the ou
- Part of the API strives to be a polyfill of the Node.js `{crypto}` module.
- When in doubt, favor in order: WebCrypto API, NodeJS implementation, 0.x implementation
- The goal is to migrate 0.x of this library that uses OpenSSL 1.1.1 to now use OpenSSL 3.3 and modern C++ with Nitro Modules.
- NodeJS code has the `deps/ncrypto` library where they are externalizing cryptography code using OpenSSL from the main guts of Node. Try to use this before anything else when adding new features and/or troubleshooting. It may still need upgrading to OpenSSL 3.3+

## Tech Stack

Expand All @@ -19,39 +24,11 @@ Every time you choose to apply a rule(s), explicitly state the rule(s) in the ou
- C++ 20 and higher, modern
- OpenSSL 3.3 and higher
- TypeScript package manager is `bun` 1.2 or higher
- Don't ask to run tests. They have to be run in an example React Native app.

## Rules

- Use smart pointers in C++.
- Use modern C++ features.
- Attempt to reduce the amount of code rather than add more.
- Prefer iteration and modularization over code duplication.
- Do not add comments unless explicitly told to do so, or the code is sufficiently complex to warrant comments.
- Don't ask to run tests. They have to be run in an example React Native app.

## TypeScript Best Practices

- Use TypeScript for all code; prefer interfaces over types.
- Use lowercase with dashes for directories (e.g., `components/auth-wizard`).
- Favor named exports for components.
- Avoid `any` and enums; use explicit types and maps instead.
- Do not cast to `unknown` and then another type.
- Use functional components with TypeScript interfaces.
- Enable strict mode in TypeScript for better type safety.
- Suggest the optimal implementation considering:
- Performance impact
- Maintenance overhead
- Testing strategy
- Code examples should follow TypeScript best practices.

## React Best Practices

- Minimize the use of `useEffect`. They should be a last resort.
- Use named functions for `useEffect`s with a meaningful function name. Avoid adding unnecessary comments on effect behavior.

## Syntax & Formatting

- Use the `function` keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.
- Use Prettier for consistent code formatting.
31 changes: 31 additions & 0 deletions .windsurf/rules/typescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
trigger: glob
globs: *.ts,*.tsx
---

## TypeScript Best Practices

- Use TypeScript for all code; prefer interfaces over types.
- Use lowercase with dashes for directories (e.g., `components/auth-wizard`).
- Favor named exports for components.
- Avoid `any` and enums; use explicit types and maps instead.
- Do not cast to `unknown` and then another type.
- Use functional components with TypeScript interfaces.
- Enable strict mode in TypeScript for better type safety.
- Suggest the optimal implementation considering:
- Performance impact
- Maintenance overhead
- Testing strategy
- Code examples should follow TypeScript best practices.

## React Best Practices

- Minimize the use of `useEffect`. They should be a last resort.
- Use named functions for `useEffect`s with a meaningful function name. Avoid adding unnecessary comments on effect behavior.

## Syntax & Formatting

- Use the `function` keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.
- Use Prettier for consistent code formatting.
1 change: 0 additions & 1 deletion .windsurfrules

This file was deleted.

486 changes: 342 additions & 144 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/implementation-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
## `subtle.sign`
| Algorithm | Status |
| --------- | :----: |
| `ECDSA` | |
| `ECDSA` | |
| `Ed25519` | ❌ |
| `Ed448` | ❌ |
| `HMAC` | ❌ |
Expand Down Expand Up @@ -452,7 +452,7 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
## `subtle.verify`
| Algorithm | Status |
| --------- | :----: |
| `ECDSA` | |
| `ECDSA` | |
| `Ed25519` | ❌ |
| `Ed448` | ❌ |
| `HMAC` | ❌ |
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@ SPEC CHECKSUMS:
hermes-engine: 4f8246b1f6d79f625e0d99472d1f3a71da4d28ca
NitroModules: e74e119e5c9f75902ef828936f75e4e078f0c4fc
OpenSSL-Universal: 6082b0bf950e5636fe0d78def171184e2b3899c2
QuickCrypto: 55910fe2f97dc24a4e72cc1f1038a4a5b3fb8ebe
QuickCrypto: 4bd633b3a4532e137a53087da836e5c09d26ef62
RCTDeprecation: 24056820c873bf5115c0441651440bfde2b82d51
RCTRequired: d0b6e766be3c17896d92059c917d682433ff8a34
RCTTypeSafety: 1954dcf545fe67e969e11e1b4fe6cf864e1ac632
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-quick-crypto/QuickCrypto.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Pod::Spec.new do |s|
# implementation (C++)
"cpp/**/*.{hpp,cpp}",
# dependencies (C++)
"deps/**/*.{hpp,cpp}",
"deps/**/*.{h,cc,c}",
# dependencies (C)
"deps/**/*.{h,c}",
]
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-quick-crypto/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ add_library(
../cpp/random/HybridRandom.cpp
../cpp/rsa/HybridRsaKeyPair.cpp
../deps/fastpbkdf2/fastpbkdf2.c
../deps/ncrypto/src/ncrypto.cpp
../deps/ncrypto/ncrypto.cc
)

# add Nitrogen specs
Expand All @@ -45,7 +45,7 @@ include_directories(
"../cpp/rsa"
"../cpp/utils"
"../deps/fastpbkdf2"
"../deps/ncrypto/include"
"../deps/ncrypto"
)

# Third party libraries (Prefabs)
Expand Down
Loading
Loading