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
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

199 changes: 179 additions & 20 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,190 @@
name: Dart CI

on: [push, pull_request]
env:
PANA_SCORE_THRESHOLD: 40

on:
push:
branches:
- master
pull_request:
schedule:
- cron: '0 0 1 * *' # Monthly run on the first day of the month at 00:00 UTC

jobs:
test:
runs-on: ${{ matrix.os }}

#
# Dart packages: format and analyze
#
dart_analyze:
name: "Analyze"
runs-on: ubuntu-slim
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]
package:
- cryptography
- jwk
sdk:
# The oldest supported Dart SDK at the moment.
# Feel free to bump it up whenever needed.
- 3.3.0

# We want to support the latest beta SDK as well.
- beta
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- name: Run tests (cryptography)
run: dart test --platform vm
working-directory: ./cryptography
- name: Run tests (cryptography_test)
run: dart test --platform vm
working-directory: ./cryptography_test
- name: Run tests (jwk)
run: dart test --platform vm
working-directory: ./jwk
- name: Analyze (cryptography)
run: dart analyze
working-directory: ./cryptography
- name: Analyze (jwk)
- uses: actions/checkout@v3
- name: Get dependencies
run: dart pub get
working-directory: ./${{ matrix.package }}
- name: Verify that code is formatted
continue-on-error: true
run: dart format --set-exit-if-changed .
working-directory: "./${{ matrix.package }}"
- name: Analyze
run: dart analyze
working-directory: ./jwk
working-directory: ./${{ matrix.package }}

#
# Dart packages: test
#
dart_test:
name: "Test"
needs: dart_analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- cryptography
- jwk
compiler:
- vm
- dart2js
steps:
- uses: browser-actions/setup-chrome@v2
if: ${{ matrix.compiler != 'vm' }}
- uses: dart-lang/setup-dart@v1
with:
sdk: beta
- uses: actions/checkout@v3
- name: Get dependencies
run: dart pub get
working-directory: ./${{ matrix.package }}
- name: "Test: VM build"
if: ${{ matrix.compiler == 'vm' }}
run: dart test --platform vm
working-directory: ./${{ matrix.package }}
- name: "Test: JS build"
if: ${{ matrix.compiler == 'vm' }}
run: dart test --platform chrome --compiler dart2js
working-directory: ./${{ matrix.package }}

#
# Dart packages: PANA score
#
dart_package_health:
name: "PANA"
needs: dart_analyze
runs-on: ubuntu-slim
strategy:
fail-fast: false
matrix:
package:
- cryptography
- jwk
steps:
- uses: dart-lang/setup-dart@v1
- uses: actions/checkout@v3
- name: Get dependencies
run: dart pub get
working-directory: ./${{ matrix.package }}
- name: Print outdated dependencies
continue-on-error: true
run: dart pub outdated
working-directory: ./${{ matrix.package }}
- name: Install package analyzer
run: dart pub global activate pana
- name: Run package analyzer
continue-on-error: true
run: dart pub global run pana --exit-code-threshold $PANA_SCORE_THRESHOLD .
working-directory: ./${{ matrix.package }}
#
# Flutter packages: format and analyze
#
flutter_analyze:
name: "Analyze"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- cryptography_flutter
- cryptography_flutter_integration_test
sdk:
# The oldest supported Dart SDK at the moment.
# Feel free to bump it up whenever needed.
- 3.35.0

# We want to support the latest beta SDK as well.
- beta
steps:
- name: Install Flutter
run: |
cd $HOME
git clone https://github.com/flutter/flutter.git --depth 1 -b ${{ matrix.sdk }} _flutter
echo "$HOME/_flutter/bin" >> $GITHUB_PATH
cd $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- name: Get dependencies
run: flutter pub get
working-directory: ./${{ matrix.package }}
- name: Verify that code is formatted
continue-on-error: true
run: dart format --set-exit-if-changed .
working-directory: ./${{ matrix.package }}
- name: Analyze
run: flutter analyze
working-directory: ./${{ matrix.package }}

#
# Unfortunately we don't have Flutter integration tests in Github Actions yet. :(
#

#
# Flutter packages: PANA score
#
flutter_package_health:
name: "PANA"
needs: flutter_analyze
strategy:
fail-fast: false
matrix:
package:
- cryptography_flutter
runs-on: ubuntu-latest
steps:
- name: Install Flutter
run: |
cd $HOME
git clone https://github.com/flutter/flutter.git --depth 1 -b beta _flutter
echo "$HOME/_flutter/bin" >> $GITHUB_PATH
cd $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- name: Get dependencies
run: flutter pub get
working-directory: ./${{ matrix.package }}
- name: Print outdated dependencies
continue-on-error: true
run: flutter pub outdated
working-directory: ./${{ matrix.package }}
- name: Install package analyzer
run: flutter pub global activate pana
working-directory: ./${{ matrix.package }}
- name: Run package analyzer
continue-on-error: true
run: flutter pub global run pana --exit-code-threshold $PANA_SCORE_THRESHOLD .
working-directory: ./${{ matrix.package }}
15 changes: 15 additions & 0 deletions .github/workflows/publish_cryptography.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish to pub.dev

on:
push:
tags:
- 'cryptography-v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@daef289245bc5d4ab7864e0788a58108a9be6c99
with:
environment: pub.dev
working-directory: ./cryptography
15 changes: 15 additions & 0 deletions .github/workflows/publish_cryptography_flutter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish to pub.dev

on:
push:
tags:
- 'cryptography_flutter-v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@daef289245bc5d4ab7864e0788a58108a9be6c99
with:
environment: pub.dev
working-directory: ./cryptography_flutter
15 changes: 15 additions & 0 deletions .github/workflows/publish_jwk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Publish to pub.dev

on:
push:
tags:
- 'jwk-v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish:
permissions:
id-token: write
uses: dart-lang/setup-dart/.github/workflows/publish.yml@daef289245bc5d4ab7864e0788a58108a9be6c99
with:
environment: pub.dev
working-directory: ./jwk
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Cryptographic packages for [Dart](https://dart.dev) / [Flutter](https://flutter.dev) developers.
Open-sourced under the [Apache License 2.0](LICENSE).

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

## Packages
* [cryptography](cryptography)
Expand Down
6 changes: 5 additions & 1 deletion cryptography/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
platforms: [ vm, chrome ]
platforms:
- vm
- chrome
compilers:
- dart2js
2 changes: 1 addition & 1 deletion cryptography/lib/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'This library will be removed in a future major version.'
' You can find `BrowserCryptography` class in "package:cryptography/cryptography.dart".',
)
library cryptography.browser;
library;

export 'src/browser/browser_cryptography_when_not_browser.dart'
if (dart.library.html) '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 @@ -24,7 +24,7 @@
///
/// ## Factory methods
/// [Cryptography] contains factory methods for cryptographic algorithms.
library cryptography;
library;

import 'package:cryptography/cryptography.dart';

Expand Down
2 changes: 1 addition & 1 deletion cryptography/lib/dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/// Cryptographic algorithms implemented in pure Dart.
///
/// See [DartCryptography].
library cryptography.dart;
library;

import 'package:cryptography/dart.dart';

Expand Down
2 changes: 1 addition & 1 deletion cryptography/lib/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

/// Various helpers for cryptography.
library cryptography.helpers;
library;

export 'src/helpers/constant_time_equality.dart';
export 'src/helpers/delegating_classes.dart';
Expand Down
2 changes: 1 addition & 1 deletion cryptography/lib/src/browser/_javascript_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

@JS()
library web_crypto_api;
library;

import 'dart:convert' show base64Url;
import 'dart:html' show CryptoKey;
Expand Down
4 changes: 2 additions & 2 deletions cryptography/lib/src/browser/aes_cbc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class BrowserAesCbc extends AesCbc {
const BrowserAesCbc({
required this.macAlgorithm,
this.secretKeyLength = 32,
Random? random,
super.random,
}) : _random = random,
super.constructor(random: random);
super.constructor();

@override
PaddingAlgorithm get paddingAlgorithm => PaddingAlgorithm.pkcs7;
Expand Down
4 changes: 2 additions & 2 deletions cryptography/lib/src/browser/aes_ctr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class BrowserAesCtr extends AesCtr {
required this.macAlgorithm,
this.secretKeyLength = 32,
this.counterBits = 64,
Random? random,
super.random,
}) : _random = random,
super.constructor(random: random);
super.constructor();

@override
Future<List<int>> decrypt(
Expand Down
4 changes: 2 additions & 2 deletions cryptography/lib/src/browser/aes_gcm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class BrowserAesGcm extends AesGcm implements StreamingCipher {
this.secretKeyLength = 32,
this.nonceLength = AesGcm.defaultNonceLength,
this.fallback,
Random? random,
super.random,
}) : _random = random,
super.constructor(random: random);
super.constructor();

@override
Future<List<int>> decrypt(
Expand Down
5 changes: 2 additions & 3 deletions cryptography/lib/src/browser/browser_cryptography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ class BrowserCryptography extends DartCryptography {

// Documented in browser_cryptography_when_not_browser.dart
BrowserCryptography({
Random? random,
}) : _random = random,
super(random: random);
super.random,
}) : _random = random;

@override
AesCbc aesCbc({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class BrowserCryptography extends DartCryptography {
///
/// If [random] is not given, algorithms will use some cryptographically
/// secure random number generator (CSRNG) such as [Random.secure].
BrowserCryptography({Random? random}) : super(random: random);
BrowserCryptography({super.random});

@override
BrowserCryptography withRandom(Random? random) {
Expand Down
6 changes: 3 additions & 3 deletions cryptography/lib/src/browser/rsa_pss.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class _BrowserRsaPublicKey extends RsaPublicKey {
required this.jsCryptoKey,
required this.webCryptoAlgorithm,
required this.webCryptoHash,
required List<int> n,
required List<int> e,
}) : super(n: n, e: e);
required super.n,
required super.e,
});
}
Loading
Loading