Skip to content

Commit c2828e6

Browse files
authored
feat: add pbkdf2 (#451)
1 parent 7187258 commit c2828e6

File tree

128 files changed

+4484
-2748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+4484
-2748
lines changed

.github/workflows/build-ios.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
- '*.podspec'
2121
- 'example/ios/**'
2222

23+
defaults:
24+
run:
25+
working-directory: example
26+
2327
jobs:
2428
build_ios_example:
2529
name: Build iOS Example App
@@ -40,7 +44,7 @@ jobs:
4044
with:
4145
ruby-version: 3.3
4246
bundler-cache: true
43-
working-directory: example/ios
47+
working-directory: example
4448

4549
- name: Restore Pods cache
4650
uses: actions/cache@v4
@@ -53,10 +57,6 @@ jobs:
5357
restore-keys: |
5458
${{ runner.os }}-pods-
5559
56-
- name: Install Gems
57-
working-directory: example
58-
run: bundle config set deployment 'true' && bundle install
59-
6060
- name: Install Pods
6161
run: bun pods
6262

@@ -72,6 +72,6 @@ jobs:
7272
-scheme QuickCryptoExample \
7373
-sdk iphonesimulator \
7474
-configuration Debug \
75-
-destination 'platform=iOS Simulator,name=iPhone 11 Pro' \
75+
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
7676
build \
7777
CODE_SIGNING_ALLOWED=NO | xcpretty"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Update Lockfiles (bun.lockb + Podfile.lock)'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/update-lockfiles.yml"
9+
pull_request:
10+
paths:
11+
- ".github/workflows/update-lockfiles.yml"
12+
- "package.json"
13+
- "**/package.json"
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
update-lockfiles:
20+
name: "Update lockfiles (bun.lockb + Podfile.lock)"
21+
if: github.actor == 'dependabot[bot]'
22+
runs-on: macOS-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
ref: ${{ github.event.pull_request.head.ref }}
28+
29+
- uses: oven-sh/setup-bun@v2
30+
with:
31+
bun-version: 1.1.26
32+
33+
- name: Setup Ruby (bundle)
34+
uses: ruby/setup-ruby@v1
35+
with:
36+
ruby-version: 3.3
37+
bundler-cache: true
38+
working-directory: example/ios
39+
40+
- run: |
41+
bun install
42+
git add bun.lockb
43+
44+
cd example
45+
bundle install
46+
bun pods
47+
git add ios/Podfile.lock
48+
49+
cd ..
50+
git config --global user.name 'dependabot[bot]'
51+
git config --global user.email 'dependabot[bot]@users.noreply.github.com'
52+
git commit --amend --no-edit
53+
git push --force

.github/workflows/validate-js.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,29 @@ jobs:
5858
name: JS Lint (eslint, prettier)
5959
runs-on: ubuntu-latest
6060
steps:
61-
- uses: actions/checkout@v4
61+
- name: Checkout
62+
uses: actions/checkout@v4
6263

63-
- uses: oven-sh/setup-bun@v2
64+
- name: Setup Bun
65+
uses: oven-sh/setup-bun@v2
6466
with:
6567
bun-version: 1.1.26
6668

6769
- name: Bootstrap JS
6870
run: |
69-
bun install
71+
bun install --frozen-lockfile
7072
7173
- name: Run ESLint (rnqc)
72-
run: cd packages/react-native-quick-crypto && bun lint-fix
74+
run: |
75+
cd packages/react-native-quick-crypto
76+
bun lint:fix
77+
bun format:fix
7378
7479
- name: Run ESLint (example)
75-
run: cd example && bun lint-fix
80+
run: |
81+
cd example
82+
bun lint:fix
83+
bun format:fix
7684
7785
- name: Verify no files have changed after auto-fix
7886
run: git diff --exit-code HEAD

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ bun example
2323
Make sure your code passes TypeScript and ESLint. Run the following to verify:
2424

2525
```sh
26-
bun tsx
26+
bun tsc
2727
bun lint
28+
bun format
2829
```
2930

3031
To fix formatting errors, run the following:
3132

3233
```sh
33-
bun lint-fix
34+
bun lint:fix
35+
bun format:fix
3436
```
3537

3638
Remember to add tests for your change if possible. Run the unit tests by:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ A fast implementation of Node's `crypto` module.
88

99
> Note: This version `1.x` is undergoing a major refactor, porting to New Architecture, Bridgeless, and [`Nitro Modules`](https://github.com/mrousavy/react-native-nitro) and is incomplete compared to the `0.x` version. Status, as always, will be represented in [implementation-coverage.md](../main/docs/implementation-coverage.md).
1010
11+
> Note: Minimum supported version of React Native is `0.75`. If you need to use earlier versions, please use `0.x` versions of this library.
12+
1113
## Features
1214

1315
Unlike any other current JS-based polyfills, react-native-quick-crypto is written in C/C++ JSI and provides much greater performance - especially on mobile devices.

bun.lockb

24.3 KB
Binary file not shown.

config/tsconfig.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"exclude": [
3+
"**/node_modules",
4+
"**/lib",
5+
"**/.eslintrc.js",
6+
"**/.prettierrc.js",
7+
"**/jest.config.js",
8+
"**/babel.config.js",
9+
"**/metro.config.js",
10+
"**/tsconfig.json"
11+
],
12+
"compilerOptions": {
13+
"composite": true,
14+
"allowUnreachableCode": false,
15+
"allowUnusedLabels": false,
16+
"esModuleInterop": true,
17+
"forceConsistentCasingInFileNames": true,
18+
"lib": ["ESNext"],
19+
"module": "ESNext",
20+
"moduleResolution": "Node",
21+
"noEmit": false,
22+
"noFallthroughCasesInSwitch": true,
23+
"noImplicitReturns": true,
24+
"noImplicitUseStrict": false,
25+
"noStrictGenericChecks": false,
26+
"noUncheckedIndexedAccess": true,
27+
"noUnusedLocals": true,
28+
"noUnusedParameters": true,
29+
"resolveJsonModule": true,
30+
"skipLibCheck": true,
31+
"strict": true,
32+
"target": "esnext",
33+
"verbatimModuleSyntax": true
34+
}
35+
}

docs/implementation-coverage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
125125
*`crypto.getRandomValues(typedArray)`
126126
*`crypto.hkdf(digest, ikm, salt, info, keylen, callback)`
127127
*`crypto.hkdfSync(digest, ikm, salt, info, keylen)`
128-
* `crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)`
129-
* `crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)`
128+
* `crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)`
129+
* `crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)`
130130
*`crypto.privateDecrypt(privateKey, buffer)`
131131
*`crypto.privateEncrypt(privateKey, buffer)`
132132
*`crypto.publicDecrypt(key, buffer)`

docs/test_suite_results.png

115 KB
Loading

example/Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7-
# bound in the template on Cocoapods with next React Native release.
8-
gem 'cocoapods', '>= 1.13', '< 1.15'
9-
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9+
gem 'xcodeproj', '< 1.26.0'

0 commit comments

Comments
 (0)