Skip to content

Commit 4c6f0e3

Browse files
authored
feat: x25519 shared secret (#731)
1 parent a6ccfa7 commit 4c6f0e3

Some content is hidden

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

77 files changed

+9564
-477
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Standard
44
BasedOnStyle: llvm
5-
Standard: c++14
5+
Standard: c++20
66

77
# Indentation
88
IndentWidth: 2

.clangd

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

.github/workflows/build-ios.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,35 @@ jobs:
5858
${{ runner.os }}-pods-
5959
6060
- name: Install Pods
61+
env:
62+
RCT_NEW_ARCH_ENABLED: 1
63+
SODIUM_ENABLED: 1
6164
run: bun pods
6265

6366
- name: Install xcpretty
6467
run: gem install xcpretty
6568

69+
- name: List available simulators
70+
run: xcrun simctl list devices available
71+
72+
- name: List available SDKs
73+
run: xcodebuild -showsdks
74+
6675
- name: Build App
6776
working-directory: example/ios
68-
run: "set -o pipefail && xcodebuild \
69-
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
70-
-derivedDataPath build -UseModernBuildSystem=YES \
71-
-workspace QuickCryptoExample.xcworkspace \
72-
-scheme QuickCryptoExample \
73-
-sdk iphonesimulator \
74-
-configuration Debug \
75-
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
76-
build \
77-
CODE_SIGNING_ALLOWED=NO | xcpretty"
77+
env:
78+
RCT_NEW_ARCH_ENABLED: 1
79+
SODIUM_ENABLED: 1
80+
run: |
81+
set -o pipefail
82+
sudo xcode-select --switch /Applications/Xcode_16.4.app
83+
xcodebuild \
84+
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
85+
-derivedDataPath build -UseModernBuildSystem=YES \
86+
-workspace QuickCryptoExample.xcworkspace \
87+
-scheme QuickCryptoExample \
88+
-sdk iphonesimulator \
89+
-configuration Debug \
90+
-destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.6' \
91+
build \
92+
CODE_SIGNING_ALLOWED=NO | xcpretty

.rules

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Every time you choose to apply a rule(s), explicitly state the rule(s) in the ou
2222

2323
## Rules
2424

25-
- For C++ includes, do not try to add absolute paths. They have to be resolved by the build system.
2625
- Use smart pointers in C++.
2726
- Use modern C++ features.
2827
- Attempt to reduce the amount of code rather than add more.

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ bun i
1212

1313
> While it's possible to use [`npm`](https://github.com/npm/cli), [`yarn`](https://classic.yarnpkg.com/), or [`pnpm`](https://pnpm.io), the tooling is built around [`bun`](https://bun.sh), so you'll have an easier time if you use `bun` for development.
1414
15+
If you are using a VSCode-flavored IDE and the `clangd` extension, you can use the `scripts/setup_clang_env.sh` script to set up the environment for C++ development. This will create a `compile_commands.json` file in the root directory of the project, which will allow the IDE to provide proper includes, better code completion and navigation. After that, add the following to your `.vscode/settings.json` file:
16+
17+
```json
18+
{
19+
"clangd.arguments": [
20+
"-log=verbose",
21+
"-pretty",
22+
"--background-index",
23+
"--compile-commands-dir=${workspaceFolder}/packages/react-native-quick-crypto/"
24+
],
25+
}
26+
```
27+
1528
While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
1629

1730
To start the packager:

bun.lock

Lines changed: 258 additions & 159 deletions
Large diffs are not rendered by default.

docs/implementation-coverage.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
108108
*`crypto.createSecretKey(key[, encoding])`
109109
*`crypto.createSign(algorithm[, options])`
110110
*`crypto.createVerify(algorithm[, options])`
111-
* `crypto.diffieHellman(options)`
111+
* 🚧 `crypto.diffieHellman(options[, callback])`
112112
*`crypto.hash(algorithm, data[, outputEncoding])`
113113
*`crypto.generateKey(type, options, callback)`
114114
* 🚧 `crypto.generateKeyPair(type, options, callback)`
@@ -149,6 +149,14 @@ This document attempts to describe the implementation status of Crypto APIs/Inte
149149

150150
🚧 Details below still a work in progress 🚧
151151

152+
## `crypto.diffieHellman`
153+
| type | Status |
154+
| --------- | :----: |
155+
| `dh` ||
156+
| `ec` ||
157+
| `x448` ||
158+
| `x25519` ||
159+
152160
## `crypto.generateKey`
153161
| type | Status |
154162
| --------- | :----: |
6.22 KB
Loading

docs/test_suite_results_ios.png

-638 Bytes
Loading

example/android/settings.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import com.facebook.react.ReactSettingsExtension
2+
13
pluginManagement { includeBuild("../../node_modules/@react-native/gradle-plugin") }
24
plugins { id("com.facebook.react.settings") }
3-
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
5+
extensions.configure(ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
46
rootProject.name = 'QuickCryptoExample'
5-
6-
77
include ':app'
88
includeBuild('../../node_modules/@react-native/gradle-plugin')

0 commit comments

Comments
 (0)