File tree Expand file tree Collapse file tree 8 files changed +29
-15
lines changed
native_crypto_platform_interface/test/method_channel Expand file tree Collapse file tree 8 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,24 @@ scripts:
15
15
lint:all :
16
16
run : melos run analyze && melos run format
17
17
description : Run all static analysis checks.
18
+
19
+ test:all :
20
+ run : |
21
+ melos run test --no-select
22
+ description : |
23
+ Run all tests available.
24
+
25
+ test :
26
+ run : |
27
+ melos exec -c 6 --fail-fast -- \
28
+ "flutter test --no-pub --no-test-assets"
29
+ description : Run `flutter test` for a specific package.
30
+ select-package :
31
+ dir-exists :
32
+ - test
33
+ ignore :
34
+ - " *web*"
35
+ - " *example*"
18
36
19
37
analyze :
20
38
run : |
Original file line number Diff line number Diff line change @@ -91,8 +91,8 @@ class BenchmarkPage extends ConsumerWidget {
91
91
after = DateTime .now ();
92
92
benchmark =
93
93
after.millisecondsSinceEpoch - before.millisecondsSinceEpoch;
94
- benchmarkStatus
95
- . appendln ( '[Benchmark] ${size }MiB => Decryption took $benchmark ms' );
94
+ benchmarkStatus. appendln (
95
+ '[Benchmark] ${size }MiB => Decryption took $benchmark ms' );
96
96
csvLine.write (';$benchmark ' );
97
97
}
98
98
csv += csvLine.toString () + '\n ' ;
Original file line number Diff line number Diff line change 3
3
// -----
4
4
// File: cipher_page.dart
5
5
// Created Date: 28/12/2021 13:33:15
6
- // Last Modified: 26 /05/2022 21:07:54
6
+ // Last Modified: 27 /05/2022 16:42:10
7
7
// -----
8
8
// Copyright (c) 2021
9
9
@@ -60,8 +60,6 @@ class CipherPage extends ConsumerWidget {
60
60
cipherText = CipherTextWrapper .fromBytes (
61
61
_altered,
62
62
ivLength: AESMode .gcm.ivLength,
63
- messageLength:
64
- _altered.length - (AESMode .gcm.ivLength + AESMode .gcm.tagLength),
65
63
tagLength: AESMode .gcm.tagLength,
66
64
);
67
65
encryptionStatus.print ('String successfully encrypted:\n ' );
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class CipherText extends ByteArray {
52
52
CipherAlgorithm ? cipherAlgorithm,
53
53
}) {
54
54
messageLength ?? = bytes.length - ivLength - tagLength;
55
-
55
+
56
56
if (ivLength.isNegative ||
57
57
messageLength.isNegative ||
58
58
tagLength.isNegative) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import 'package:native_crypto/src/utils/cipher_algorithm.dart';
17
17
/// In cryptography, a [Cipher] is an algorithm for performing encryption
18
18
/// or decryption - a series of well-defined steps that can
19
19
/// be followed as a procedure.
20
- ///
20
+ ///
21
21
/// This interface is implemented by all the ciphers in NativeCrypto.
22
22
abstract class Cipher {
23
23
static const int _bytesCountPerChunkDefault = 33554432 ;
@@ -26,7 +26,7 @@ abstract class Cipher {
26
26
/// Returns the default number of bytes per chunk.
27
27
static int get defaultBytesCountPerChunk => _bytesCountPerChunkDefault;
28
28
29
- /// Returns the size of a chunk of data
29
+ /// Returns the size of a chunk of data
30
30
/// that can be processed by the [Cipher] .
31
31
static int get bytesCountPerChunk => Cipher ._bytesCountPerChunk;
32
32
@@ -35,11 +35,10 @@ abstract class Cipher {
35
35
static set bytesCountPerChunk (int bytesCount) {
36
36
_bytesCountPerChunk = bytesCount;
37
37
}
38
-
38
+
39
39
/// Returns the standard algorithm for this [Cipher] .
40
40
CipherAlgorithm get algorithm;
41
41
42
-
43
42
/// Encrypts the [data] .
44
43
///
45
44
/// Takes [Uint8List] data as parameter.
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ import 'package:native_crypto/src/keys/secret_key.dart';
11
11
import 'package:native_crypto/src/utils/kdf_algorithm.dart' ;
12
12
13
13
/// Represents a Key Derivation Function (KDF) in NativeCrypto.
14
- ///
15
- /// [KeyDerivation] function is a function that takes some
14
+ ///
15
+ /// [KeyDerivation] function is a function that takes some
16
16
/// parameters and returns a [SecretKey] .
17
17
abstract class KeyDerivation {
18
18
/// Returns the standard algorithm for this key derivation function
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ void main() {
157
157
expect (cipherText.cipherAlgorithm, CipherAlgorithm .aes);
158
158
});
159
159
});
160
-
160
+
161
161
group ('Lengths' , () {
162
162
test ('get.ivLength returns the expected value' , () {
163
163
final CipherText cipherText = CipherText .fromBytes (
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ void main() {
150
150
],
151
151
);
152
152
});
153
-
153
+
154
154
test ('decrypt' , () async {
155
155
await nativeCrypto.decrypt (
156
156
Uint8List (0 ),
@@ -171,6 +171,5 @@ void main() {
171
171
],
172
172
);
173
173
});
174
-
175
174
});
176
175
}
You can’t perform that action at this time.
0 commit comments