@wireapp/core-crypto 1.0.0-rc.8 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,94 +34,208 @@ See [ARCHITECTURE.md](docs/ARCHITECTURE.md)
34
34
 
35
35
  Install Android SDK and Build-Tools for API level 30+
36
36
 
37
- NOTE: If you are building on macOS you'll need to setup $ANDROID_SDK_ROOT path variable manually:
37
+ > [!important]
38
+ > If you are building on macOS you'll need to setup `$ANDROID_SDK_ROOT` path variable manually:
39
+ > ```ignore
40
+ > export ANDROID_SDK_ROOT=~/Android/Sdk
41
+ > ```
42
+
43
+ Install android rust targets:
38
44
  ```ignore
39
- export ANDROID_SDK_ROOT=~/Android/Sdk
45
+ rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android
40
46
  ```
41
- Install android rust targets
47
+ Build:
42
48
  ```ignore
43
- rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android
49
+ cd crypto-ffi
50
+ cargo make android
51
+ cd bindings
52
+ ./gradlew android:build
44
53
  ```
45
54
 
46
55
  ### iOS
47
56
 
48
- Install Xcode & it's commandline tools: [https://developer.apple.com/xcode/](https://developer.apple.com/xcode/)
49
-
50
- Install iOS rust targets
57
+ Install Xcode & its command-line tools: [https://developer.apple.com/xcode/](https://developer.apple.com/xcode/).
51
58
 
59
+ Install iOS rust targets:
52
60
  ```ignore
53
61
  rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
54
62
  ```
55
63
 
64
+ Build:
65
+ ```ignore
66
+ cd crypto-ffi
67
+ cargo make ios
68
+ # Additionally, if you want to export a .XCFramework:
69
+ cargo make ios-create-xcframework
70
+ ```
71
+
56
72
  ### MacOS
57
73
 
58
- Install macOS rust targets
74
+ Install macOS rust targets:
59
75
  ```ignore
60
- rustup target add x86_64-apple-darwin
61
- rustup target add aarch64-apple-darwin
76
+ rustup target add x86_64-apple-darwin aarch64-apple-darwin
62
77
  ```
63
78
 
64
79
  ### Linux
65
80
 
66
- If cross-compiling from macOS you'll need install: [https://github.com/messense/homebrew-macos-cross-toolchains](https://github.com/messense/homebrew-macos-cross-toolchains)
67
-
68
- Install linux targets
81
+ > [!note]
82
+ > If cross-compiling from macOS, you'll need to install
83
+ > [https://github.com/messense/homebrew-macos-cross-toolchains](https://github.com/messense/homebrew-macos-cross-toolchains).
69
84
 
85
+ Install Linux targets:
70
86
  ```ignore
71
87
  rustup target add x86_64-unknown-linux-gnu
72
88
  ```
73
89
 
74
90
  ### WASM
75
91
 
92
+ Make sure you have all prerequisites:
76
93
  * Install [wasm-pack](https://rustwasm.github.io/wasm-pack/)
77
- * Install the wasm32-unknown-unknown toolchain `rustup target add wasm32-unknown-unknown`
94
+ * Install the `wasm32-unknown-unknown` toolchain: `rustup target add wasm32-unknown-unknown`
78
95
  * Install node.js (recommended way is via [Volta](https://volta.sh/))
96
+ * Install Bun (follow the instructions on [Bun's website](https://bun.sh/))
97
+
98
+ Build:
99
+ ```ignore
100
+ cd crypto-ffi
101
+ cargo make wasm
102
+ ```
79
103
 
80
104
  ### Bindings
81
105
 
82
106
  Build bindings for Android, JVM, iOS and WASM
83
107
 
84
108
  ```ignore
85
- cd crypto-ffi
109
+ cd crypto-ffi
86
110
 
87
111
  # builds bindings and targets for the JVM (macOS / Linux)
88
- cargo make "copy-jvm-resources"
112
+ cargo make jvm
89
113
 
90
114
  # builds bindings and targets for Android
91
- cargo make "copy-android-resources"
115
+ cargo make android
92
116
 
93
117
  # builds iOS framework
94
- cargo make "create-swift-package"
118
+ cargo make ios-create-xcframework
95
119
 
96
- # builds wasm binary
120
+ # builds wasm binary & TS bindings
97
121
  cargo make wasm
98
122
  ```
99
123
 
100
- ## Publishing
124
+ ## Testing
101
125
 
102
- ### Versioning
126
+ ### General testing
127
+
128
+ ```ignore
129
+ # Install cargo-nextest if you haven't done so, it yields some substantial speedup
130
+ cargo install cargo-nextest
131
+ cargo nextest run
132
+ ```
103
133
 
104
- * Run `cargo xtask release bump [major|minor|patch|rc|pre]`
105
- * Update the internal dependencies of the updated crates to use the new version
106
- * Update the version in the `package.json`
107
- * Update the version in the `build.gradle.kts` inside `./kotlin/android` and `./kotlin/jvm`
134
+ #### Addendum: testing all ciphersuites
108
135
 
109
- ### Changelog
136
+ > [!warning]
137
+ > This takes quite a while.
110
138
 
111
- * Update <CHANGELOG.tpl> accordingly
112
- * Fetch the latest tags from the remote
113
- * run `cargo xtask documentation changelog` to update <CHANGELOG.md> with the git-conventional history
139
+ ```ignore
140
+ cargo nextest run --features test-all-cipher
141
+ ```
114
142
 
115
- ### Android / JVM
143
+ ### Platform-specific testing
116
144
 
117
- You can publish the JVM and Android bindings to maven using gradle after you've built the corresponding target.
145
+ ### Kotlin/Android
118
146
 
147
+ * Take the steps to compile for Kotlin/Android
148
+ * Then:
119
149
  ```ignore
120
- cd kotlin
150
+ cd crypto-ffi/bindings
151
+ ./gradlew test
152
+ ```
153
+
154
+ ### Swift/iOS
155
+
156
+ *No E2E testing is available as of now on Swift.*
157
+
158
+ ### WASM/Web
159
+
160
+ * Take the steps to compile for WASM/Web
161
+ * Then:
162
+ ```ignore
163
+ cd crypto-ffi
164
+ bun test
165
+ ```
166
+
167
+ ## Benchmarks
168
+ There are benches implemented in [`crypto/benches`](crypto/benches/) for several operations on mls groups with varying sizes or proteus.
169
+ Parameters like minimum or maximum group sizes and step sizes are defined in [`crypto/benches/utils/mod.rs`](crypto/benches/utils/mod.rs).
170
+
171
+ ### Executing Benches
172
+ To execute the benches, e.g. for creating commits, run
173
+ ```bash
174
+ cargo bench --bench=commit -- --quick
175
+ ```
176
+ where `commit` is the name of the bench specified in [`crypto/Cargo.toml`](crypto/Cargo.toml), and the corresponding file in [`crypto/benches`](crypto/benches/).
177
+ In case you're interested in higher accuracy, and willing to trade it for execution speed, omit the `--quick` flag.
178
+ The reports generated by criterion will be located in `target/criterion`.
179
+
180
+ ## Git workflow
181
+
182
+ * The `main` branch is only updated when making a release and should always point to the latest release.
183
+ * The `develop` branch is used as the everyday development branch.
184
+ * No merge commits. Always rebase on top of `develop`.
185
+ * Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) -- those are picked up by the changelog generator.
186
+ * If there is a JIRA ticket related to the change, you should mention it in either the PR title or the commit(s),
187
+ with the following format: `[TICKET_ID]`.
188
+ * Sign your [commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
189
+ and [tags](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-tags).
190
+ * Remove branches from the remote once you don't need them anymore.
191
+
192
+
193
+ ## Publishing
194
+
195
+ ### Versioning
196
+
197
+ The versioning scheme used is [SemVer AKA Semantic Versioning](https://semver.org).
198
+
199
+ ### Making a new release
200
+
201
+ 1. Make a release branch started from `develop` (`git checkout -b release/X.Y.Z`)
202
+ 1. Run `cargo xtask release bump [major|minor|patch|rc|pre] --dry-run`, check if it's the expected result
203
+ 1. If all seems fine, re-run the previous command without the `--dry-run` argument.
204
+ This will bump the versions of:
205
+ - all workspace member crates
206
+ - `package.json`
207
+ - `crypto-ffi/bindings/gradle.properties`
208
+ 1. Edit `CHANGELOG.tpl` with the contents of the release.
209
+ - Copy the git-conventional block from the previous release to your new release, modify the version tag
210
+ - Remove the `unreleased=true` from the previous release
211
+ - Try to write some human concise documentation so that client teams understand the changes at a glance
212
+ 1. Run `cargo xtask documentation changelog` to generate the corresponding `CHANGELOG.md`
213
+ 1. Make sure the changes look reasonable and complete; you can use
214
+ [this commit](https://github.com/wireapp/core-crypto/commit/e680590ba6969ca2dc47aa38c7f220ea8974b369)
215
+ as a reference.
216
+ 1. Push your `release/X.Y.Z` branch and create a PR for it
217
+ 1. Get it reviewed, then merge it into `develop` and remove the release branch from the remote.
218
+ 1. Now, pull your local develop `git checkout develop && git pull`
219
+ 1. Update the `main` branch: `git checkout main && git pull && git merge --ff-only develop`
220
+ 1. Create the release tag: `git tag -s vX.Y.Z`
221
+ 1. Push the branch and the new tag: `git push origin main && git push --tags`
222
+ 1. Voilà!
223
+
224
+
225
+ ### Publishing Android / JVM bindings
226
+
227
+ Publishing Android / JVM bindings happens automatically by a github workflow when a release tag is pushed.
228
+
229
+ If you would like to publish the bindings to a local maven cache, run:
230
+ ```ignore
231
+ cd crypto-ffi/bindings/android
121
232
  ./gradlew :jvm:publishToMavenLocal
122
233
  ./gradlew :android:publishToMavenLocal
123
234
  ```
124
235
 
125
- ### JS / WASM
236
+ ### Publishing JS / WASM bindings
237
+
238
+ Publishing JS / WASM bindings happens automatically by a github workflow when a release tag is pushed.
126
239
 
127
- Given that you are logged in NPM and can publish to `@wireapp/core-crypto`, you can just `npm publish` to push a new version
240
+ If you would like to publish to `@wireapp/core-crypto` manually, log into NPM and
241
+ just run `npm publish`.
package/package.json CHANGED
@@ -1,20 +1,12 @@
1
1
  {
2
2
  "name": "@wireapp/core-crypto",
3
- "version": "1.0.0-rc.8",
3
+ "version": "1.0.0",
4
4
  "description": "CoreCrypto bindings for the Web",
5
5
  "type": "module",
6
6
  "module": "platforms/web/corecrypto.js",
7
7
  "types": "platforms/web/corecrypto.d.ts",
8
8
  "scripts": {
9
- "prepare": "npm run build",
10
- "build": "npm run clean && rollup -c crypto-ffi/bindings/js/rollup.config.js",
11
- "build:test": "npm run clean && rollup -c crypto-ffi/bindings/js/rollup.config.test.js",
12
- "clean": "rm -f ./platforms/web/*.{js,ts,wasm,html} && rm -rf ./platforms/web/assets",
13
- "package": "npm run build && npm pack",
14
- "test:raw": "jest -c crypto-ffi/bindings/js/jest.config.js --runInBand",
15
- "test": "npm run build:test && npm run test:raw",
16
- "test:cov": "npm run build:test && jest -c crypto-ffi/bindings/js/jest.config.js --coverage --runInBand",
17
- "test:http-server": "http-server platforms/web -g -p 3000"
9
+ "clean": "rm -f ./platforms/web/*.{js,ts,wasm,html} && rm -rf ./platforms/web/assets"
18
10
  },
19
11
  "publishConfig": {
20
12
  "access": "public"
@@ -29,7 +21,7 @@
29
21
  "mls",
30
22
  "proteus"
31
23
  ],
32
- "author": "Mathieu Amiot <amiot.mathieu@gmail.com>",
24
+ "author": "Wire CoreCrypto team <team.corecrypto@wire.com>",
33
25
  "license": "GPL-3.0",
34
26
  "homepage": "https://github.com/wireapp/core-crypto",
35
27
  "repository": {
@@ -40,26 +32,15 @@
40
32
  "url": "https://github.com/wireapp/core-crypto/issues"
41
33
  },
42
34
  "devDependencies": {
43
- "@rollup/plugin-html": "^1.0.2",
44
- "@types/jest": "^29.4.0",
45
- "@types/jest-dev-server": "^5.0.0",
46
- "@typescript-eslint/eslint-plugin": "^5.50.0",
47
- "@typescript-eslint/parser": "^5.50.0",
48
- "@wasm-tool/rollup-plugin-rust": "^2.3.3",
49
- "dts-bundle-generator": "^7.2.0",
50
- "eslint": "^8.33.0",
51
- "eslint-config-prettier": "^8.6.0",
52
- "eslint-plugin-prettier": "^4.2.1",
53
- "http-server": "^14.1.1",
54
- "jest": "^29.4.1",
55
- "jest-dev-server": "^6.2.0",
56
- "prettier": "^2.8.3",
57
- "puppeteer": "^19.6.2",
58
- "rollup": "^3.12.0",
59
- "rollup-jest": "^3.1.0",
60
- "rollup-plugin-ts": "^3.2.0",
61
- "ts-jest": "^29.0.5",
62
- "ts-loader": "^9.4.2",
63
- "typescript": "^4.9.5"
35
+ "@typescript-eslint/eslint-plugin": "^7.0.2",
36
+ "@typescript-eslint/parser": "^7.0.2",
37
+ "bun-plugin-dts": "^0.2.1",
38
+ "eslint": "^8.56.0",
39
+ "eslint-config-prettier": "^9.1.0",
40
+ "eslint-plugin-prettier": "^5.1.3",
41
+ "prettier": "^3.2.5",
42
+ "puppeteer": "^22.2.0",
43
+ "ts-loader": "^9.5.1",
44
+ "typescript": "^5.3.3"
64
45
  }
65
46
  }