@wireapp/core-crypto 3.0.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md DELETED
@@ -1,321 +0,0 @@
1
- # Wire CoreCrypto
2
-
3
- [![Wire logo](https://github.com/wireapp/wire/blob/master/assets/header-small.png?raw=true)](https://wire.com/jobs/)
4
-
5
- This repository is part of the source code of Wire. You can find more information at [wire.com](https://wire.com) or by contacting opensource@wire.com.
6
-
7
- You can find the published source code at [github.com/wireapp/wire](https://github.com/wireapp/wire).
8
-
9
- For licensing information, see the attached LICENSE file and the list of third-party licenses at [wire.com/legal/licenses/](https://wire.com/legal/licenses/).
10
-
11
- No license is granted to the Wire trademark and its associated logos, all of which will continue to be owned exclusively by Wire Swiss GmbH. Any use of the Wire trademark and/or its associated logos is expressly prohibited without the express prior written consent of Wire Swiss GmbH.
12
-
13
- ## Parts
14
-
15
- * CoreCrypto: Abstracts MLS & Proteus in a unified API
16
- * CoreCryptoFFI: FFI bindings for iOS, Android and WASM
17
- * Keystore: Encrypted Keystore powered by SQLCipher on all platforms except WASM. WASM uses an IndexedDB-backed, encrypted store with AES256-GCM
18
- * MlsProvider: RustCrypto + Keystore MLS provider
19
-
20
- See [ARCHITECTURE.md](docs/ARCHITECTURE.md)
21
-
22
- ## Usage
23
-
24
- ### [API Docs](https://wireapp.github.io/core-crypto/core_crypto/)
25
-
26
- ## Building
27
-
28
- ### General Requirements
29
-
30
- - rust: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)
31
- - cargo-make: [https://sagiegurari.github.io/cargo-make/](https://sagiegurari.github.io/cargo-make/)
32
-
33
- If you're using macOS, you'll also need to install GNU sed:
34
- ```ignore
35
- brew install gnu-sed
36
- ```
37
- and add an alias to your shell configuration file: `alias sed=gsed` (e.g. to `~/.zshenv` if you're using zsh).
38
-
39
- ### Development Requirements
40
-
41
- #### Pre-commit
42
-
43
- - Install the [`pre-commit` framework](https://pre-commit.com/)
44
- - Run `pre-commit install` to initialize the pre-commit hooks
45
-
46
- ### Android
47
-
48
- Install Android SDK and Build-Tools for API level 30+
49
-
50
- > [!important]
51
- > If you are building on macOS you'll need to setup `$ANDROID_SDK_ROOT` path variable manually:
52
- > ```ignore
53
- > export ANDROID_SDK_ROOT=~/Android/Sdk
54
- > ```
55
-
56
- Install android rust targets:
57
- ```ignore
58
- rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
59
- ```
60
- Build:
61
- ```ignore
62
- cd crypto-ffi
63
- cargo make android
64
- cd bindings
65
- ./gradlew android:build
66
- ```
67
-
68
- ### iOS
69
-
70
- Install Xcode & its command-line tools: [https://developer.apple.com/xcode/](https://developer.apple.com/xcode/).
71
-
72
- Install iOS rust targets:
73
- ```ignore
74
- rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
75
- ```
76
-
77
- Build:
78
- ```ignore
79
- cd crypto-ffi
80
- cargo make ios
81
- # Additionally, if you want to export a .XCFramework:
82
- cargo make ios-create-xcframework
83
- ```
84
-
85
- ### MacOS
86
-
87
- Install macOS rust targets:
88
- ```ignore
89
- rustup target add x86_64-apple-darwin aarch64-apple-darwin
90
- ```
91
-
92
- ### Linux
93
-
94
- > [!note]
95
- > If cross-compiling from macOS, you'll need to install
96
- > [https://github.com/messense/homebrew-macos-cross-toolchains](https://github.com/messense/homebrew-macos-cross-toolchains).
97
-
98
- Install Linux targets:
99
- ```ignore
100
- rustup target add x86_64-unknown-linux-gnu
101
- ```
102
-
103
- ### WASM
104
-
105
- Make sure you have all prerequisites:
106
- * Install [wasm-pack](https://rustwasm.github.io/wasm-pack/)
107
- * Install the `wasm32-unknown-unknown` toolchain: `rustup target add wasm32-unknown-unknown`
108
- * Install node.js (recommended way is via [Volta](https://volta.sh/))
109
- * Install Bun (follow the instructions on [Bun's website](https://bun.sh/))
110
-
111
- Build:
112
- ```ignore
113
- cd crypto-ffi
114
- cargo make wasm
115
- ```
116
-
117
- ### Bindings
118
-
119
- Build bindings for Android, JVM, iOS and WASM
120
-
121
- ```ignore
122
- cd crypto-ffi
123
-
124
- # builds bindings and targets for the JVM (macOS / Linux)
125
- cargo make jvm
126
-
127
- # builds bindings and targets for Android
128
- cargo make android
129
-
130
- # builds iOS framework
131
- cargo make ios-create-xcframework
132
-
133
- # builds wasm binary & TS bindings
134
- cargo make wasm
135
- ```
136
-
137
- ## Testing
138
-
139
- ### General testing
140
-
141
- ```ignore
142
- # Install cargo-nextest if you haven't done so, it yields some substantial speedup
143
- cargo install cargo-nextest
144
- cargo nextest run
145
- ```
146
-
147
- ### Run core crypto internal tests on WASM target
148
-
149
- If you haven't already, install the target and wasm-pack:
150
-
151
- ```sh
152
- rustup target add wasm32-unknown-unknown
153
- cargo install wasm-pack
154
- ```
155
-
156
- If you want to test for chrome, [get chromedriver](https://getwebdriver.com/chromedriver) or the webdriver for the
157
- browser you want to test for, respectively.
158
-
159
- Then, to run tests for a crate in the workspace do
160
-
161
- ```ignore
162
- wasm-pack test --headless --chrome ./<crate-folder-to-test>
163
- ```
164
-
165
- #### Addendum: testing all ciphersuites
166
-
167
- > [!warning]
168
- > This takes quite a while.
169
-
170
- ```ignore
171
- cargo nextest run --features test-all-cipher
172
- ```
173
-
174
- ### Platform-specific tests for Kotlin/JVM
175
-
176
- Build the JVM target every timee the Rust code changes:
177
-
178
- ```sh
179
- # substitute with `jvm-darwin` on OSX
180
- core-crypto/crypto-ffi$ cargo make jvm-linux
181
- ```
182
-
183
- Then run the tests each time the wrapper or wrapper tests change
184
-
185
- ```sh
186
- core-crypto/crypto-ffi/bindings$ ./gradlew jvm:build -x lint -x lintRelease
187
- ```
188
-
189
- ### Platform-specific tests for Android
190
-
191
- Build the Android target every timee the Rust code changes:
192
-
193
- ```sh
194
- core-crypto/crypto-ffi$ cargo make android
195
- ```
196
-
197
- Then run the tests each time the wrapper or wrapper tests change
198
-
199
- ```sh
200
- core-crypto/crypto-ffi/bindings$ ./gradlew android:build -x lint -x lintRelease
201
- ```
202
-
203
- ### Swift/iOS
204
-
205
- *No E2E testing is available as of now on Swift.*
206
-
207
- ### Platform-spcecific tests for WASM/Web
208
-
209
- Install TS dependencies on first go, and each time they change:
210
-
211
- ```sh
212
- bun install
213
- ```
214
-
215
- Build the WASM target every timee the Rust code changes:
216
-
217
- ```sh
218
- core-crypto/crypto-ffi$ cargo make wasm
219
- ```
220
-
221
- Then run the tests each time the wrapper or wrapper tests change
222
-
223
- ```sh
224
- core-crypto/crypto-ffi$ bun run test
225
- ```
226
-
227
- Note that CI will fail if it doesn't like your formatting. This can typically be automtically adjusted with
228
-
229
- ```sh
230
- core-crypto/crypto-ffi$ bun eslinst bindings/js --max-warnings=0 --fix
231
- ```
232
-
233
- ## Benchmarks
234
- There are benches implemented in [`crypto/benches`](crypto/benches/) for several operations on mls groups with varying sizes or proteus.
235
- Parameters like minimum or maximum group sizes and step sizes are defined in [`crypto/benches/utils/mod.rs`](crypto/benches/utils/mod.rs).
236
-
237
- ### Executing Benches
238
- To execute the benches, e.g. for creating commits, run
239
- ```bash
240
- cargo bench --bench=commit -- --quick
241
- ```
242
- 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/).
243
- In case you're interested in higher accuracy, and willing to trade it for execution speed, omit the `--quick` flag.
244
- If you need reporting plots, remove the `.without_plots()` call in [`crypto/benches/utils/mod.rs`](crypto/benches/utils/mod.rs).
245
- The reports generated by criterion will be located in `target/criterion`.
246
-
247
- ## Git workflow
248
-
249
- * The `main` branch is used as the everyday development branch.
250
- * No merge commits. Always rebase on top of `main`.
251
- * Release branches are named `release/<series>`, e.g. `release/1.x`, `release/2.x`.
252
- * Release branches contain fixes relevant to their specific release series and are never merged to `main`.
253
- * Release branches always branch off their first major release tag. For example,
254
- the output of `git merge-base main release/2.x` must be a commit pointed to by tag `v2.0.0`.
255
- * Release branches are created lazily, that is, only when the first fix needs to be applied and released
256
- for a specific release series.
257
- * Use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) -- those are picked up by the changelog generator.
258
- * If there is a JIRA ticket related to the change, you should mention it in either the PR title or the commit(s),
259
- with the following format: `[TICKET_ID]`.
260
- * Sign your [commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)
261
- and [tags](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-tags).
262
- * Remove branches from the remote once you don't need them anymore.
263
-
264
-
265
- ## Publishing
266
-
267
- ### Versioning
268
-
269
- The versioning scheme used is [SemVer AKA Semantic Versioning](https://semver.org).
270
-
271
- ### Making a new release
272
-
273
- 1. Make a branch based on `main` to prepare for release (`git checkout -b prepare-release/X.Y.Z`)
274
- 1. Run `sh scripts/update-versions.sh X.Y.Z` to update the versions of
275
- - all workspace member crates
276
- - `package.json`
277
- - `crypto-ffi/bindings/gradle.properties`
278
- Make sure the result of the script run is correct.
279
- 1. Generate the relevant changelog section:
280
- ```bash
281
- git cliff --bump --unreleased
282
- ```
283
- and add it to the top of `CHANGELOG.md`.
284
- Make sure the version number generated by `git cliff` matches the release version.
285
- 1. If there are any release highlights, add them as the first subsection below release title:
286
- ```markdown
287
- ## v1.0.2 - 2024-08-16
288
-
289
- ### Highlights
290
-
291
- - foo
292
- - bar
293
- - baz
294
- ```
295
- 1. Make sure the changes look reasonable and complete; you can use the previous release as a reference
296
- 1. Push your `prepare-release/X.Y.Z` branch and create a PR for it
297
- 1. Get it reviewed, then merge it into `main` and remove the `prepare-release/X.Y.Z` branch from the remote
298
- 1. Now, pull your local `main`: `git checkout main && git pull`
299
- 1. Create the release tag: `git tag -s vX.Y.Z`
300
- 1. Push the new tag: `git push origin tag vX.Y.Z`
301
- 1. Create a new release on github, copying the relevant section from `CHANGELOG.md`
302
- 1. Voilà!
303
-
304
-
305
- ### Publishing Android / JVM bindings
306
-
307
- Publishing Android / JVM bindings happens automatically by a github workflow when a release tag is pushed.
308
-
309
- If you would like to publish the bindings to a local maven cache, run:
310
- ```ignore
311
- cd crypto-ffi/bindings/android
312
- ./gradlew :jvm:publishToMavenLocal
313
- ./gradlew :android:publishToMavenLocal
314
- ```
315
-
316
- ### Publishing JS / WASM bindings
317
-
318
- Publishing JS / WASM bindings happens automatically by a github workflow when a release tag is pushed.
319
-
320
- If you would like to publish to `@wireapp/core-crypto` manually, log into NPM and
321
- just run `bun publish`.
File without changes