pull master + conflicts

client_api
remrem 2 years ago
commit c3495b2f8c

@ -1,6 +1,6 @@
kind: pipeline
type: docker
name: default
name: Passworld
trigger:
event:
@ -12,20 +12,16 @@ steps:
- name: build-apk
image: cirrusci/flutter:stable
commands:
- echo "hahahah"
- flutter build apk
- curl -F "file=@./build/app/outputs/flutter-apk/app-release.apk" https://api.anonfiles.com/upload -o link.txt
- cat link.txt
- echo "$(cat link.txt)"
- name: code-analysis
image: cirrusci/flutter:stable
#hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-sonar
environment:
SONAR_TOKEN:
from_secret: sonar_token
commands:
#- apk add zip unzip openjdk11 tree
- export SONAR_SCANNER_VERSION=4.7.0.2747
- mkdir .sonar
- cd .sonar
@ -37,21 +33,3 @@ steps:
- export SONAR_SCANNER_OPTS="-server"
- ./.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner -D sonar.projectKey=Passworld -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.login=$${SONAR_TOKEN}
depends_on: [ build-apk ]
# database container deployment
- name: database_users
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: mariadb:10
CONTAINERNAME: mysql
COMMAND: create
# OVERWRITE: false
PRIVATE: false
CODEFIRST_CLIENTDRONE_ENV_MARIADB_ROOT_PASSWORD:
from_secret: db_root_password
CODEFIRST_CLIENTDRONE_ENV_MARIADB_DATABASE:
from_secret: db_database
CODEFIRST_CLIENTDRONE_ENV_MARIADB_USER:
from_secret: db_user
CODEFIRST_CLIENTDRONE_ENV_MARIADB_PASSWORD:
from_secret: db_password

1
.gitignore vendored

@ -3,6 +3,7 @@
*.lock
*.log
*.pyc
*.sqlite
*.swp
*.sqlite
.DS_Store

@ -17,4 +17,3 @@ For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
i

@ -47,7 +47,7 @@ android {
applicationId "com.example.test"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 18
minSdkVersion 21
compileSdkVersion 33
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()

@ -6,55 +6,56 @@ import 'package:test/Classes/account.dart';
import 'package:test/Classes/api_client.dart';
import 'storage.dart';
import 'config.dart';
import 'package:path/path.dart' as p; // used in line 31
String account = "file.txt";
class Authentification {
static Future<bool> authentification(String login, String mdp) async {
var list = await allUser();
var cp = Config();
await cp.setAppDirPath();
var list = await allUser(cp.appDirPath.path);
var it = list.iterator;
while (it.moveNext()) {
if (it.current.id == login) {
// vas chercher key + iv avec Storage.getKey(String id) / Storage.getIV(String id)
var iv = Storage.getIV(it.current.id);
var iv = await Storage.getIV(it.current.id);
var encrypter = Encrypter(AES(await Storage.getKey(it.current.id)));
var sel = encrypter.decrypt(it.current.salt, iv: await iv);
var tmp = BCrypt.hashpw(mdp, sel);
return tmp == encrypter.decrypt(it.current.hash, iv: await iv);
var hash = encrypter.decrypt(it.current.hash, iv: iv);
return BCrypt.checkpw(mdp, hash);
}
}
return false;
}
// Charge les comptes déjà existant pour notre appli depuis un fichier texte (à upgrade)
static Future<List<Account>> allUser() async {
var cf = Config();
cf.setAppDirPath();
var file =
File("${Platform.environment['HOME'].toString()}/.passworld/file.txt");
static Future<List<Account>> allUser(String path) async {
var file = File(p.join(path, account));
List<Account> lst = List.empty(growable: true);
List<String> stream = file.readAsLinesSync();
stream.forEach((element) {
for (var element in stream) {
var arr = element.split(' ');
var salt = Encrypted.fromBase64(arr[1]);
var hash = Encrypted.fromBase64(arr[2]);
lst.add(Account.old(arr[0], salt, hash));
});
}
return lst;
}
static Future<bool> register(String login, String mdp) async {
var listCpt = await allUser();
var cp = Config();
await cp.setAppDirPath();
var listCpt = await allUser(cp.appDirPath.path);
for (var i in listCpt) {
if (i.id == login) return false;
}
listCpt.add(Account(login, mdp));
ecriture(listCpt,
"${Platform.environment['HOME'].toString()}/.passworld/file.txt");
ecriture(listCpt, p.join(cp.appDirPath.path, account));
return true;
}
// Ecrit dans un fichier
static void ecriture(List<Account> list, String fichier) async {
File(fichier).writeAsStringSync("", mode: FileMode.write);
for (var i in list) {
File(fichier).writeAsStringSync(
"${i.id} ${i.salt.base64} ${i.hash.base64}\n",

@ -1,30 +1,51 @@
import 'dart:io' show Platform;
import 'dart:io' as io;
import 'dart:async';
import 'package:path_provider/path_provider.dart';
import 'package:flutter/foundation.dart';
import 'package:path/path.dart' as p;
class Config extends ChangeNotifier {
String appDirPath = "";
late io.Directory appDirPath;
late List<int> charac;
Config();
Config() {
appDirPath = io.Directory("");
charac = [];
}
void setAppDirPath() async {
Future<void> setAppDirPath() async {
if (Platform.isLinux) {
appDirPath = "${Platform.environment['HOME'].toString()}/.passworld/";
setDirectory();
appDirPath = io.Directory(
"${Platform.environment['HOME'].toString()}/.passworld/");
await setDirectory();
} else {
// appDirPath = io.Directory("/data/user/0");
appDirPath = await getApplicationDocumentsDirectory();
await setDirectory();
}
}
Future<void> setDirectory() async {
if (!io.Directory(appDirPath.path).existsSync()) {
io.Directory(appDirPath.path).createSync();
}
if (!io.File(p.join(appDirPath.path, "file.txt")).existsSync()) {
print("LE FICHIER NEXISTE PAS ");
io.File("${appDirPath.path}/file.txt").create();
} else {
var dir = await getApplicationDocumentsDirectory();
appDirPath = dir.path;
print("LE FICHIER EXISTE");
}
}
void setDirectory() {
if (!io.Directory(appDirPath).existsSync()) {
io.Directory(appDirPath).createSync();
void addCharacter(int i) {
if (charac.contains(i)) {
charac.remove(i);
} else {
charac.add(i);
}
if(!io.File("${appDirPath}file.txt").existsSync()) {
io.File("${appDirPath}file.txt").createSync();
}
void clearCharacter() {
charac.clear();
}
}

@ -0,0 +1,46 @@
/*import 'dart:io';
import 'package:aes_crypt/aes_crypt.dart';
import 'package:flutter/widgets.dart';
import 'package:test/Classes/Exception/storageException.dart';
import 'dart:typed_data';
import 'storage.dart';
class EncryptFile implements Exception{
static void encrypt_file(String path,String id) async{
AesCrypt crypt = AesCrypt();
crypt.setOverwriteMode(AesCryptOwMode.warn);
crypt.setPassword('my cool password'); // à changer
String encFilepath;
try {
encFilepath = crypt.encryptTextToFileSync((await Storage.getKey("${id}Key")).base64+(await Storage.getIV("${id}IV")).base64, path);
} on AesCryptException catch (e) {
if (e.type == AesCryptExceptionType.destFileExists) {
throw AesCryptException("Fichier déjà existant !!", e.type);
}
else{
throw AesCryptArgumentError("Erreur lors du chiffrage du fichier.");
}
}
}
static String decrypt_file(String path) {
AesCrypt crypt = AesCrypt();
crypt.setOverwriteMode(AesCryptOwMode.warn);
crypt.setPassword('my cool password'); // voir pour mettre le mdp de l'utilisateur
String key;
try{
key = crypt.decryptTextFromFileSync(path);
if(key.isEmpty){
throw AesCryptArgumentError("Erreur lors du déchiffrage du fichier");
}
return key;
} on AesCryptException catch (e){
if (e.type == AesCryptExceptionType.destFileExists) {
throw AesCryptException("Erreur lors du déchiffrage du fichier", e.type);
}
else{
throw AesCryptArgumentError("Erreur lors du déchiffrage du fichier");
}
}
}
}*/

@ -3,6 +3,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:test/Classes/Exception/storageException.dart';
import 'storage_item.dart';
import 'secureStorage.dart';
import 'fileEncrypt.dart';
class Storage implements Exception {
static final SecureStorage storage = SecureStorage();
@ -32,7 +33,6 @@ class Storage implements Exception{
return cle;
}
static Future<encrypt.IV> getIV(String id) async {
const storer = FlutterSecureStorage();
bool testIV = await storer.containsKey(key: "${id}IV");
@ -49,12 +49,13 @@ class Storage implements Exception{
static Future<void> ajouterKeyIV(String id) async {
const storer = FlutterSecureStorage();
bool testKey = await storer.containsKey(key: "${id}IV");
bool testKey = await storer.containsKey(key: "${id}Key");
bool testIV = await storer.containsKey(key: "${id}IV");
if (testKey && testIV) {
throw StorageException("Clé et IV déjà existante");
}
storing(encrypt.Key.fromSecureRandom(32), encrypt.IV.fromSecureRandom(16), id);
storing(
encrypt.Key.fromSecureRandom(32), encrypt.IV.fromSecureRandom(16), id);
}
static Future<void> newMasterKey(String id) async {
@ -65,6 +66,19 @@ class Storage implements Exception{
throw StorageException("Clé et IV inexistante");
}
// vérifier que tout est bien déchiffré avant
storing(encrypt.Key.fromSecureRandom(32), encrypt.IV.fromSecureRandom(16), id);
storing(
encrypt.Key.fromSecureRandom(32), encrypt.IV.fromSecureRandom(16), id);
}
/*static Future<void> newMasterKeyFromFile(String path, String id) async {
const storer = FlutterSecureStorage();
String keyIv = EncryptFile.decrypt_file(path);
bool testKey = await storer.containsKey(key: "${id}Key");
bool testIV = await storer.containsKey(key: "${id}IV");
if (!testKey && !testIV) {
//mettre message d'erreur ici
}
storing(encrypt.Key.fromBase64(keyIv.substring(0, 43)),
encrypt.IV.fromBase64(keyIv.substring(44)), id);
}*/
}

@ -0,0 +1,22 @@
class Strength{
static checkStrength(String value)
{
RegExp numReg = RegExp(r".*[0-9].*");
RegExp letterReg = RegExp(r".*[A-Za-z].*");
var pwd = value.trim();
if (pwd.isEmpty) {
return 0;
} else if (pwd.length < 6) {
return (1 / 4);
} else if (pwd.length < 8) {
return (2 / 4);
} else {
if (!letterReg.hasMatch(pwd) || !numReg.hasMatch(pwd)) {
return (3 / 4);
} else {
return 1;
}
}
}
}

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test/ui/login_page.dart';
import 'package:path_provider/path_provider.dart';
import 'Classes/config.dart';
import 'Classes/account.dart';

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:pretty_qr_code/pretty_qr_code.dart';
import '../../Classes/storage.dart';
import 'package:screen_brightness_util/screen_brightness_util.dart';
showQrcode(BuildContext context, String id) async {
AlertDialog alert = AlertDialog(
backgroundColor: Colors.deepPurple[300],
content: PrettyQr(
image: const AssetImage('assets/bereal.png'), //mettre l'icone de l'app
typeNumber: 6,
size: 500,
data:
(await Storage.getKey(id)).base64 + (await Storage.getIV(id)).base64,
errorCorrectLevel: QrErrorCorrectLevel.M,
roundEdges: false,
),
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
);
}
Future<void> setBrightness(double brightness) async {
try {
await ScreenBrightnessUtil().setBrightness(brightness);
} catch (e) {
print(e);
throw 'Failed to set brightness';
}
}

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:ai_barcode_scanner/ai_barcode_scanner.dart';
import '../../Classes/storage.dart';
import 'package:encrypt/encrypt.dart' as encrypt;
class Scanner extends StatefulWidget {
const Scanner({Key? key}) : super(key: key);
@override
State<Scanner> createState() => _Scanner();
}
class _Scanner extends State<Scanner> {
String barcode = "";
@override
Widget build(BuildContext context) {
return AiBarcodeScanner(
// validateText: 'https://', // link to be validated
// validateType: ValidateType.startsWith,
onScan: (String value) {
debugPrint(value);
setState(() {
barcode = value;
Storage.storing(encrypt.Key.fromBase64(barcode.substring(0, 43)),
encrypt.IV.fromBase64(barcode.substring(44)), "id");
});
},
);
}
}
/// Add this to use the qrcode
///
/// if (Platform.isLinux || Platform.isWindows) {
/// showAlertDialog(context,
/// "Cette fonctionnalité n'est pas disponible sur votre appareil !!");
/// } else {
/// Navigator.push(
/// context,
/// MaterialPageRoute<dynamic>(
/// builder: (context) => const Scanner()
/// )
/// )
/// }

@ -178,7 +178,7 @@ class _HealthPageState extends State<AddPasswordPage> {
))),
),
InkWell(
onTap: () {
onTap: () async{
int id = context.read<Account>().vault.getMaxInt();
context.read<Account>().vault.addPassword(Password(
id,
@ -189,8 +189,8 @@ class _HealthPageState extends State<AddPasswordPage> {
mailCtrl.text,
notesCtrl.text));
var path = Config();
path.setAppDirPath();
context.read<Account>().saveFile(path.appDirPath);
await path.setAppDirPath();
context.read<Account>().saveFile(path.appDirPath.path);
Navigator.pop(context);
},
child: Container(

@ -1,4 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:test/Classes/config.dart';
import 'package:test/ui/widget/character_input.dart';
import 'package:test/ui/widget/page_title_widget.dart';
import '../Classes/generator.dart';
import 'PopUp/popupError.dart';
@ -11,22 +15,241 @@ class GeneratorPage extends StatefulWidget {
}
class _GeneratorPageState extends State<GeneratorPage> {
TextEditingController noneCarac = TextEditingController();
bool pressAttention = true;
bool obcure = true;
double length = 8;
String output = "";
String obcures = "*";
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
double w = size.width; //* MediaQuery.of(context).devicePixelRatio;
double h = size.height; // * MediaQuery.of(context).devicePixelRatio;
return Scaffold(
backgroundColor: Colors.white,
backgroundColor: const Color.fromARGB(255, 255, 255, 255),
body: SafeArea(
child: SingleChildScrollView(
child: Column(
children: [
//----------
// PAGE TITLE
//-----------
Container(
padding: EdgeInsets.all(w * 0.04),
child: Row(children: const [PageTitleW(title: "Generator")])),
SizedBox(
height: h * 0.05,
),
//-------------------
// OUTPUT
//-------------------
Container(
padding: EdgeInsets.all(w * 0.02),
child: Row(children: [
Expanded(
child: Container(
padding: const EdgeInsets.all(25),
child: const PageTitleW(title: 'Generator')),
padding: EdgeInsets.all(w * 0.02),
color: Colors.grey[300],
child: Row(children: [
Text(
obcure ? (obcures * (output.length)) : "$output",
style: TextStyle(
fontSize: w * 0.02,
fontWeight: FontWeight.bold,
),
);
/// A mettre quand on utilise le generator
// ignore: dead_code
),
const Spacer(),
InkWell(
onTap: (() {
setState(() {
obcure = !obcure;
});
}),
child: Icon(
const IconData(0xe51c,
fontFamily: 'MaterialIcons'),
size: w * 0.06,
))
]))),
SizedBox(
width: w * 0.01,
),
Container(
padding: EdgeInsets.all(h * 0.01),
color: Colors.deepPurple[300],
child: InkWell(
onTap: () async {
await Clipboard.setData(ClipboardData(text: output));
},
child: Icon(
Icons.copy,
size: w * 0.08,
),
),
)
])),
SizedBox(
height: h * 0.05,
),
//------------
// SLIDER BAR
//------------
Container(
padding: EdgeInsets.all(w * 0.02),
child: Column(
children: [
Container(
alignment: Alignment.centerLeft,
child: Text(
"Length",
style: TextStyle(
fontSize: w * 0.05, fontWeight: FontWeight.bold),
),
),
Row(
children: [
SliderTheme(
data: SliderTheme.of(context).copyWith(
trackHeight: w * 0.057,
thumbShape: RoundSliderThumbShape(
enabledThumbRadius: w * 0.03,
),
overlappingShapeStrokeColor: Colors.transparent),
child: Container(
width: w * 0.8,
child: Slider(
value: length,
onChanged: ((double newLength) {
setState(() {
length = newLength;
});
}),
min: 8,
max: 50,
activeColor: Colors.deepPurple[300],
thumbColor: Colors.deepPurple[300],
inactiveColor: Colors.grey[300],
),
)),
Container(
margin: EdgeInsets.all(w * 0.02),
child: Text(length.round().toString(),
style: TextStyle(fontSize: w * 0.08)))
],
)
],
)),
//-------------------
// CHARACTERS'TITLE
//-------------------
Container(
padding: EdgeInsets.all(w * 0.02),
child: Row(children: [
Text(
"Characters",
style: TextStyle(
fontSize: w * 0.05, fontWeight: FontWeight.bold),
),
])),
//---------------------
// CHARACTERS' BUTTONS
//----------------------
Container(
padding: EdgeInsets.all(w * 0.02),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [
CharactereInputWidget(character: "a-z", no: 0),
CharactereInputWidget(character: "A-Z", no: 1),
CharactereInputWidget(character: "0-9", no: 2),
CharactereInputWidget(character: "!@%", no: 3),
CharactereInputWidget(character: ",;`\"", no: 4),
]),
),
SizedBox(
height: h * 0.01,
),
//---------------
// INPUT TITLE
//---------------
Container(
padding: EdgeInsets.all(w * 0.02),
child: Row(children: [
Text(
"Do not include",
style: TextStyle(
fontSize: w * 0.05, fontWeight: FontWeight.bold),
),
])),
//-----------
// INPUT ZONE
//-----------
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Container(
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(w * 0.07)),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: w * 0.03, vertical: h * 0.01),
child: TextField(
style: TextStyle(fontSize: w * 0.04),
controller: noneCarac,
decoration: const InputDecoration(
border: InputBorder.none,
hintText: 'Type Charaters you don\'t want',
),
),
),
),
),
SizedBox(
height: h * 0.10,
),
//-----------
// BUTTON
//-----------
Center(
child: InkWell(
onTap: (() {
setState(() {
try {
Generator().generator(2,[1], "a");
output = Generator().generator(length.toInt(),
context.read<Config>().charac, noneCarac.text) ??
"";
} on UnsupportedError catch (e) {
showAlertDialog(context, e.message ?? "");
}
});
}),
child: Container(
decoration: BoxDecoration(
color: Colors.deepPurple[300],
borderRadius: BorderRadius.circular(w * 0.04)),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: w * 0.33, vertical: h * 0.01),
child: Text(
'Generate',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: w * 0.065),
),
),
),
),
),
SizedBox(
height: h * 0.02,
)
],
))),
);
}
}

@ -117,10 +117,11 @@ class _LoginPageState extends State<LoginPage> {
(emailController.text).trim(),
(passwordController.text).trim())) {
context.read<Account>().setId = emailController.text;
context.read<Config>().setAppDirPath();
await context.read<Config>().setAppDirPath();
print(context.read<Config>().appDirPath.path);
context
.read<Account>()
.fillVault(context.read<Config>().appDirPath);
.fillVault(context.read<Config>().appDirPath.path);
// context
// .read<Account>()

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:test/Classes/Exception/storageException.dart';
import 'package:test/Classes/authentification.dart';
import 'PopUp/popupError.dart';
import 'package:password_strength_checker/password_strength_checker.dart';
class RegisterPage extends StatefulWidget {
const RegisterPage({Key? key}) : super(key: key);
@ -26,6 +27,7 @@ class _RegisterPage extends State<RegisterPage> {
@override
Widget build(BuildContext context) {
final passNotifier = ValueNotifier<PasswordStrength?>(null);
return Scaffold(
backgroundColor: Colors.grey[300],
body: SafeArea(
@ -63,7 +65,9 @@ class _RegisterPage extends State<RegisterPage> {
//Password Input
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Container(
child: Column(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12)),
@ -72,6 +76,9 @@ class _RegisterPage extends State<RegisterPage> {
child: TextField(
obscureText: true,
controller: passwordController,
onChanged: ((value) {
passNotifier.value = PasswordStrength.calculate(text: passwordController.text);
}),
decoration: const InputDecoration(
border: InputBorder.none,
hintText: 'Password',
@ -79,9 +86,14 @@ class _RegisterPage extends State<RegisterPage> {
),
),
),
const SizedBox(height: 20),
PasswordStrengthChecker(
strength: passNotifier,
),
]
),
),
const SizedBox(height: 30),
// Sign In Button
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),

@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../Classes/config.dart';
// Widget for all inputs of addPasswordPage
class CharactereInputWidget extends StatefulWidget {
// Variables
final String character;
final int no;
const CharactereInputWidget(
{super.key, required this.character, required this.no});
@override
State<CharactereInputWidget> createState() => _CharactereInputWidgetState();
}
class _CharactereInputWidgetState extends State<CharactereInputWidget> {
bool pressAttention = true;
@override
Widget build(BuildContext context) {
// Media Query
var size = MediaQuery.of(context).size;
double w = size.width; //* MediaQuery.of(context).devicePixelRatio;
double h = size.height;
// Widget
return SizedBox(
height: h * 0.1,
width: w * 0.1,
child: ElevatedButton(
onPressed: () => {
setState(() {
pressAttention = !pressAttention;
context.read<Config>().addCharacter(widget.no);
})
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(
pressAttention ? Colors.white : Colors.deepPurple[300]),
),
child: Text(
widget.character,
style: TextStyle(
color: pressAttention ? Colors.black : Colors.white,
fontSize: w * 0.045,
fontWeight: FontWeight.bold),
)));
}
}

@ -50,13 +50,18 @@ dependencies:
path_provider: ^2.0.11
process_run: ^0.12.3+2
sqlite3_flutter_libs: ^0.5.11+1
password_strength_checker: ^1.2.0
aes_crypt: ^0.1.1
pretty_qr_code: ^2.0.2
screen_brightness_util_platform_interface: ^0.0.2
screen_brightness_util: ^0.0.3
ai_barcode_scanner: ^0.0.3
flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/ic_launcher.png"
dev_dependencies:
flutter_test:
sdk: flutter

@ -1,6 +1,7 @@
import 'package:test/Classes/Datas/i_data_strategy.dart';
import 'package:test/Classes/Datas/pass_file.dart';
import 'package:test/Classes/password.dart';
import 'package:test/Classes/vault.dart';
import 'dart:ui';
/*

@ -0,0 +1,34 @@
import 'package:bcrypt/bcrypt.dart';
import 'package:encrypt/encrypt.dart';
void display(bool res) {
print("Check password: $res");
return;
}
void trueFunc(password, hash) {
bool res = BCrypt.checkpw(password, hash);
display(res);
return;
}
void aurianFunc(String password, String salt, String hash) {
var newHash = BCrypt.hashpw(password, salt);
display(newHash == hash);
return;
}
void main() async {
var password = "coucou123";
var salt = BCrypt.gensalt();
var hash = BCrypt.hashpw(password, salt);
aurianFunc(password, salt, hash);
trueFunc(password, hash);
var iv = IV.fromSecureRandom(16);
var key = Key.fromSecureRandom(32);
var encrypter = Encrypter(AES(key));
print(encrypter.encrypt(hash, iv: iv).base64);
print(encrypter.encrypt(hash, iv: iv).base64);
}

@ -8,6 +8,7 @@
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <screen_brightness_util_windows/screen_brightness_util_windows_plugin_c_api.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
@ -15,6 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
ScreenBrightnessUtilWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenBrightnessUtilWindowsPluginCApi"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
}

@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
flutter_secure_storage_windows
screen_brightness_util_windows
sqlite3_flutter_libs
)

Loading…
Cancel
Save