-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from tekartik/dart3a
Dart3a
- Loading branch information
Showing
98 changed files
with
301 additions
and
4,321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
dart: [2.19.6, stable, beta, dev] | ||
dart: [3.0.5, stable, beta, dev] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export 'package:tekartik_app_crypto/src/encrypt.dart' | ||
show encrypt, decrypt, StringEncrypter; | ||
show encrypt, decrypt, StringEncrypter, defaultEncryptedFromRawPassword; | ||
|
||
export 'src/salsa20.dart' show salsa20EncrypterFromPassword; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export 'package:tekartik_app_crypto/src/encrypt_codec.dart' | ||
show defaultEncryptCodec, EncryptCodec, salsa20EncryptCodec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:tekartik_app_crypto/encrypt.dart'; | ||
|
||
class EncryptConverter with Converter<String, String> { | ||
final StringEncrypter encrypter; | ||
|
||
EncryptConverter({required this.encrypter}); | ||
@override | ||
String convert(String input) => encrypter.encrypt(input); | ||
} | ||
|
||
class DecryptConverter with Converter<String, String> { | ||
final StringEncrypter encrypter; | ||
|
||
DecryptConverter({required this.encrypter}); | ||
@override | ||
String convert(String input) => encrypter.decrypt(input); | ||
} | ||
|
||
/// Encrypt codec. | ||
class EncryptCodec with Codec<String, String> { | ||
final StringEncrypter encrypter; | ||
|
||
EncryptCodec({required this.encrypter}); | ||
|
||
@override | ||
Converter<String, String> get decoder => | ||
DecryptConverter(encrypter: encrypter); | ||
|
||
@override | ||
Converter<String, String> get encoder => | ||
EncryptConverter(encrypter: encrypter); | ||
} | ||
|
||
/// String password | ||
EncryptCodec defaultEncryptCodec({required String rawPassword}) => | ||
EncryptCodec(encrypter: defaultEncryptedFromRawPassword(rawPassword)); | ||
|
||
/// Any password can be used | ||
EncryptCodec salsa20EncryptCodec({required String password}) => | ||
EncryptCodec(encrypter: salsa20EncrypterFromPassword(password)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:tekartik_app_crypto/encrypt_codec.dart'; | ||
|
||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
test('test', () { | ||
var password = r'E4x*$TwbkJC-xK4KGC4zJF9j*Rh&WLgR'; | ||
var encryptCodec = defaultEncryptCodec(rawPassword: password); | ||
expect(encryptCodec.encode('test'), 'amGhyRRLUIoE59IiEys5Vw=='); | ||
expect(encryptCodec.decode('amGhyRRLUIoE59IiEys5Vw=='), 'test'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.