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
7 changes: 6 additions & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
compiler:
- vm
- dart2js
- dart2wasm
steps:
- uses: browser-actions/setup-chrome@v2
if: ${{ matrix.compiler != 'vm' }}
Expand All @@ -79,9 +80,13 @@ jobs:
run: dart test --platform vm
working-directory: ./${{ matrix.package }}
- name: "Test: JS build"
if: ${{ matrix.compiler == 'vm' }}
if: ${{ matrix.compiler == 'dart2js' }}
run: dart test --platform chrome --compiler dart2js
working-directory: ./${{ matrix.package }}
- name: "Test: WASM build"
if: ${{ matrix.compiler == 'dart2wasm' }}
run: dart test --platform chrome --compiler dart2wasm
working-directory: ./${{ matrix.package }}

#
# Dart packages: PANA score
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ Maintained by [terrier989](https://github.com/terrier989). Licensed under the [A
Please share feedback / issue reports in the
[issue tracker](https://github.com/dint-dev/cryptography/issues).

Pull requests are welcome.
Pull requests are welcome.

## Testing
3 changes: 3 additions & 0 deletions cryptography/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.8.0
* Adds WASM support. `BrowserCryptography` now uses 'dart:js_interop'.

## 2.7.0
* Adds a cross-platform of Argon2id, a highly recommended algorithm for password hashing.
* Introduces a dependency on "package:ffi" (a package by Google). A memory allocator in the package
Expand Down
39 changes: 27 additions & 12 deletions cryptography/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,27 @@
Popular cryptographic algorithms for [Dart](https://dart.dev) / [Flutter](https://flutter.dev)
developers.

Maintained by [gohilla.com](https://gohilla.com). Licensed under the [Apache License 2.0](LICENSE).

This package is designed to be:

* __Easy to use__. The API is easy to understand and encourages good defaults.
* __Multi-platform__. It's easy to customize implementation of X in platform Y.
* __Fast.__ We use platform APIs when available. For example, SHA-512 is over 100 times faster than
_package:crypto_ in browsers.
Maintained by [terrier989](https://github.com/terrier989).
Licensed under the [Apache License 2.0](LICENSE).

## Key features
* __Defaults to platform-provided implementations.__
* Android: [javax.crypto](https://developer.android.com/reference/javax/crypto/package-summary)
* iOS / Mac OS X: [Apple CryptoKit](https://developer.apple.com/documentation/cryptokit/)
* Web: [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
* __Works in all platforms.__
* We have written Dart implementations for the vast majority of algorithms. When a platform does
not provide a required algorithm, the package automatically falls back to pure Dart
implementation.
* In browsers, both Javascript and WASM compilers are supported. Dart implementations of 64-bit
algorithms like Blake2B have been written to work with Javascript's 53-bit integers.
* __Flexible.__
* You can override factory methods in [Cryptography](https://pub.dev/documentation/cryptography/latest/cryptography/Cryptography-class.html)
class if you want to use something else. Note that algorithms that you don't use do not affect
size of the executable because of tree pruning.
* You can override random number generator with a deterministic one for tests.
* __Fast.__
* For example, SHA-512 is over 100 times faster than _package:crypto_ in browsers.

Any feedback, issue reports, or pull requests are appreciated!

Expand All @@ -33,8 +46,10 @@ Android / iOS / Mac OS X operating system APIs whenever possible.
In _pubspec.yaml_:
```yaml
dependencies:
cryptography: ^2.7.0
cryptography_flutter: ^2.3.2 # Remove if you don't use Flutter
cryptography: ^2.8.0

# If you are writing a Flutter app/package, also add this:
cryptography_flutter: ^2.3.3
```

You are ready to go!
Expand Down Expand Up @@ -239,8 +254,8 @@ We wrote the following three implementations of `Cryptography`:
for list algorithms supported by it.
* [BrowserCryptography](https://pub.dev/documentation/cryptography/latest/cryptography/BrowserCryptography-class.html)
* Uses [Web Cryptography API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API)
(_crypto.subtle_) whenever possible. Methods return pure Dart implementations when Web
Cryptography API is not available.
whenever possible. Methods return pure Dart implementations when Web Cryptography API is not
available.
* See the [class documentation](https://pub.dev/documentation/cryptography/latest/cryptography/BrowserCryptography-class.html)
for list algorithms supported by it.
* [FlutterCryptography](https://pub.dev/documentation/cryptography_flutter/latest/cryptography_flutter/FlutterCryptography-class.html)
Expand Down
1 change: 1 addition & 0 deletions cryptography/dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ platforms:
- vm
- chrome
compilers:
- dart2wasm
- dart2js
2 changes: 1 addition & 1 deletion cryptography/lib/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
library;

export 'src/browser/browser_cryptography_when_not_browser.dart'
if (dart.library.html) 'src/browser/browser_cryptography.dart';
if (dart.library.js_interop) 'src/browser/browser_cryptography.dart';
2 changes: 1 addition & 1 deletion cryptography/lib/cryptography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ library;
import 'package:cryptography/cryptography.dart';

export 'src/browser/browser_cryptography_when_not_browser.dart'
if (dart.library.html) 'src/browser/browser_cryptography.dart';
if (dart.library.js_interop) 'src/browser/browser_cryptography.dart';
export 'src/cryptography/algorithms.dart';
export 'src/cryptography/cipher.dart';
export 'src/cryptography/cipher_state.dart';
Expand Down
Loading
Loading