mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-27 11:16:45 +00:00
change password generator
This commit is contained in:
parent
8ea1b28d73
commit
1202e4ad53
|
@ -7,7 +7,7 @@ import 'package:selfprivacy/logic/api_maps/api_map.dart';
|
||||||
import 'package:selfprivacy/logic/models/hetzner_server_info.dart';
|
import 'package:selfprivacy/logic/models/hetzner_server_info.dart';
|
||||||
import 'package:selfprivacy/logic/models/server_details.dart';
|
import 'package:selfprivacy/logic/models/server_details.dart';
|
||||||
import 'package:selfprivacy/logic/models/user.dart';
|
import 'package:selfprivacy/logic/models/user.dart';
|
||||||
import 'package:selfprivacy/utils/password_generator2.dart';
|
import 'package:selfprivacy/utils/password_generator.dart';
|
||||||
|
|
||||||
class HetznerApi extends ApiMap {
|
class HetznerApi extends ApiMap {
|
||||||
bool hasLoger;
|
bool hasLoger;
|
||||||
|
@ -73,30 +73,26 @@ class HetznerApi extends ApiMap {
|
||||||
required User rootUser,
|
required User rootUser,
|
||||||
required String domainName,
|
required String domainName,
|
||||||
}) async {
|
}) async {
|
||||||
var dbPassword = getRandomString(40);
|
|
||||||
|
|
||||||
const chars =
|
|
||||||
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
|
|
||||||
|
|
||||||
var dbStorageName = getRandomString(6, chars);
|
|
||||||
var client = await getClient();
|
var client = await getClient();
|
||||||
|
|
||||||
Response dbCreateResponse = await client.post(
|
Response dbCreateResponse = await client.post(
|
||||||
'/volumes',
|
'/volumes',
|
||||||
data: {
|
data: {
|
||||||
"size": 10,
|
"size": 10,
|
||||||
"name": dbStorageName,
|
"name": StringGenerators.dbStorageName(),
|
||||||
"labels": {"labelkey": "value"},
|
"labels": {"labelkey": "value"},
|
||||||
"location": "fsn1",
|
"location": "fsn1",
|
||||||
"automount": false,
|
"automount": false,
|
||||||
"format": "ext4"
|
"format": "ext4"
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var dbPassword = StringGenerators.dbPassword();
|
||||||
var dbId = dbCreateResponse.data['volume']['id'];
|
var dbId = dbCreateResponse.data['volume']['id'];
|
||||||
|
|
||||||
var data = jsonDecode(
|
var data = jsonDecode(
|
||||||
'''{"name":"$domainName","server_type":"cx11","start_after_create":false,"image":"ubuntu-20.04", "volumes":[$dbId], "networks":[], "user_data":"#cloud-config\\nruncmd:\\n- curl https://git.selfprivacy.org/ilchub/selfprivacy-nixos-infect/raw/branch/master/nixos-infect | PROVIDER=hetzner NIX_CHANNEL=nixos-21.05 DOMAIN=$domainName LUSER=${rootUser.login} PASSWORD=${rootUser.password} HASHED_PASSWORD=${rootUser.hashPassword.hash} SALT=${rootUser.hashPassword.salt} CF_TOKEN=$cloudFlareKey DB_PASSWORD=$dbPassword bash 2>&1 | tee /tmp/infect.log","labels":{},"automount":true, "location": "fsn1"}'''
|
'''{"name":"$domainName","server_type":"cx11","start_after_create":false,"image":"ubuntu-20.04", "volumes":[$dbId], "networks":[], "user_data":"#cloud-config\\nruncmd:\\n- curl https://git.selfprivacy.org/ilchub/selfprivacy-nixos-infect/raw/branch/master/nixos-infect | PROVIDER=hetzner NIX_CHANNEL=nixos-21.05 DOMAIN=$domainName LUSER=${rootUser.login} PASSWORD=${rootUser.password} HASHED_PASSWORD=${rootUser.hashPassword.hash} SALT=${rootUser.hashPassword.salt} CF_TOKEN=$cloudFlareKey DB_PASSWORD=$dbPassword bash 2>&1 | tee /tmp/infect.log","labels":{},"automount":true, "location": "fsn1"}''');
|
||||||
);
|
|
||||||
|
|
||||||
Response serverCreateResponse = await client.post(
|
Response serverCreateResponse = await client.post(
|
||||||
'/servers',
|
'/servers',
|
||||||
|
|
|
@ -4,8 +4,8 @@ import 'package:cubit_form/cubit_form.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/jobs/jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/models/jobs/job.dart';
|
import 'package:selfprivacy/logic/models/jobs/job.dart';
|
||||||
import 'package:selfprivacy/logic/models/user.dart';
|
import 'package:selfprivacy/logic/models/user.dart';
|
||||||
import 'package:selfprivacy/utils/password_generator.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:selfprivacy/utils/password_generator.dart';
|
||||||
|
|
||||||
class UserFormCubit extends FormCubit {
|
class UserFormCubit extends FormCubit {
|
||||||
UserFormCubit({
|
UserFormCubit({
|
||||||
|
@ -32,7 +32,7 @@ class UserFormCubit extends FormCubit {
|
||||||
);
|
);
|
||||||
|
|
||||||
password = FieldCubit(
|
password = FieldCubit(
|
||||||
initalValue: isEdit ? user!.password : genPass(),
|
initalValue: isEdit ? user!.password : StringGenerators.userPassword(),
|
||||||
validations: [
|
validations: [
|
||||||
RequiredStringValidation('validations.required'.tr()),
|
RequiredStringValidation('validations.required'.tr()),
|
||||||
ValidationModel<String>((s) => passwordRegExp.hasMatch(s),
|
ValidationModel<String>((s) => passwordRegExp.hasMatch(s),
|
||||||
|
@ -56,7 +56,7 @@ class UserFormCubit extends FormCubit {
|
||||||
late FieldCubit<String> password;
|
late FieldCubit<String> password;
|
||||||
|
|
||||||
void genNewPassword() {
|
void genNewPassword() {
|
||||||
password.externalSetValue(genPass());
|
password.externalSetValue(StringGenerators.userPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
final JobsCubit jobsCubit;
|
final JobsCubit jobsCubit;
|
||||||
|
|
|
@ -34,21 +34,3 @@ class UsersCubit extends Cubit<UsersState> {
|
||||||
emit(UsersState(users));
|
emit(UsersState(users));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// final initMockUsers = <User>[
|
|
||||||
// User(login: 'Heartbreaking.Goose', password: genPass()),
|
|
||||||
// User(login: 'Alma.lawson', password: genPass()),
|
|
||||||
// User(login: 'Bee.gees', password: genPass()),
|
|
||||||
// User(login: 'Bim.jennings', password: genPass()),
|
|
||||||
// User(login: 'Debra.holt', password: genPass()),
|
|
||||||
// User(login: 'Georgia.young', password: genPass()),
|
|
||||||
// User(login: 'Kenzi.lawson', password: genPass()),
|
|
||||||
// User(login: 'Le.jennings', password: genPass()),
|
|
||||||
// User(login: 'Kirill.Zh', password: genPass()),
|
|
||||||
// User(login: 'Tina.Bolton', password: genPass()),
|
|
||||||
// User(login: 'Rebekah.Lynn', password: genPass()),
|
|
||||||
// User(login: 'Aleena.Armstrong', password: genPass()),
|
|
||||||
// User(login: 'Rosemary.Williams', password: genPass()),
|
|
||||||
// User(login: 'Sullivan.Nixon', password: genPass()),
|
|
||||||
// User(login: 'Aleena.Armstrong', password: genPass()),
|
|
||||||
// ];
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/utils/password_generator2.dart';
|
import 'package:selfprivacy/utils/password_generator.dart';
|
||||||
|
|
||||||
import '../user.dart';
|
import '../user.dart';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class Job extends Equatable {
|
||||||
Job({
|
Job({
|
||||||
String? id,
|
String? id,
|
||||||
required this.title,
|
required this.title,
|
||||||
}) : id = id ?? getRandomString(5);
|
}) : id = id ?? StringGenerators.simpleId();
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final String id;
|
final String id;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:crypt/crypt.dart';
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:selfprivacy/utils/color_utils.dart';
|
import 'package:selfprivacy/utils/color_utils.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:selfprivacy/utils/password_generator.dart';
|
||||||
|
|
||||||
part 'user.g.dart';
|
part 'user.g.dart';
|
||||||
|
|
||||||
|
@ -25,7 +26,10 @@ class User extends Equatable {
|
||||||
|
|
||||||
Color get color => stringToColor(login);
|
Color get color => stringToColor(login);
|
||||||
|
|
||||||
Crypt get hashPassword => Crypt.sha512(password);
|
Crypt get hashPassword => Crypt.sha512(
|
||||||
|
password,
|
||||||
|
salt: StringGenerators.passwordSalt(),
|
||||||
|
);
|
||||||
|
|
||||||
String toString() {
|
String toString() {
|
||||||
return login;
|
return login;
|
||||||
|
|
|
@ -1,138 +1,99 @@
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
var generator = PasswordGenerator();
|
Random _rnd = Random();
|
||||||
|
|
||||||
String genPass() {
|
typedef StringGeneratorFunction = String Function();
|
||||||
generator.generate(8);
|
|
||||||
return generator.getGeneratedValue();
|
class StringGenerators {
|
||||||
}
|
static const letters = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
static const numbers = '1234567890';
|
||||||
///Generates a password.
|
static const symbols = '_';
|
||||||
///
|
|
||||||
///The password [_generatedValue] is of a specified length, including letters [_letterGen] of mixed cases,
|
static String getRandomString(
|
||||||
///numbers [_numGen], and symbols[_symGen] depending on user choice.
|
int length, {
|
||||||
class PasswordGenerator {
|
hasLowercaseLetters = false,
|
||||||
late bool _letterGen;
|
hasUppercaseLetters = false,
|
||||||
late bool _numGen;
|
hasNumbers = false,
|
||||||
late bool _symGen;
|
hasSymbols = false,
|
||||||
late String _generatedValue;
|
isStrict = false,
|
||||||
|
}) {
|
||||||
///Constructor.
|
var chars = '';
|
||||||
///
|
if (hasLowercaseLetters) chars += letters;
|
||||||
///[_letterGen] is true to make password generation possible from the opening of the application, and
|
if (hasUppercaseLetters) chars += letters.toUpperCase();
|
||||||
///[_generatedValue] is intialized to the value below so the text containing it can be first generated
|
if (hasNumbers) chars += numbers;
|
||||||
///upon users request
|
if (hasSymbols) chars += symbols;
|
||||||
PasswordGenerator() {
|
|
||||||
_letterGen = true;
|
assert(chars.isNotEmpty, 'chart empty');
|
||||||
_numGen = true;
|
|
||||||
_symGen = false;
|
if (!isStrict) {
|
||||||
_generatedValue = "Press Generate";
|
return genString(length, chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Call to generate a value, of [n] length
|
var res = '';
|
||||||
void generate(int n) {
|
var loose = length;
|
||||||
//Discards the old value
|
if (hasLowercaseLetters) {
|
||||||
_generatedValue = "";
|
loose -= 1;
|
||||||
|
res += genString(1, letters);
|
||||||
///Cannot generate a value without any character types selected
|
}
|
||||||
if (!_letterGen && !_numGen && !_symGen) {
|
if (hasUppercaseLetters) {
|
||||||
_generatedValue = "No character type selected";
|
loose -= 1;
|
||||||
return;
|
res += genString(1, letters.toUpperCase());
|
||||||
}
|
}
|
||||||
|
if (hasNumbers) {
|
||||||
///'Randomly' selectes caracter type to generate and append [toAppend] to [_generatedValue]
|
loose -= 1;
|
||||||
// ignore: unnecessary_statements
|
res += genString(1, numbers.toUpperCase());
|
||||||
for (n; n > 0; n--) {
|
}
|
||||||
String? toAppend;
|
if (hasSymbols) {
|
||||||
var random = new Random();
|
loose -= 1;
|
||||||
|
res += genString(1, symbols);
|
||||||
///loops until a valid character is generated, meaning the user has to check the character value
|
}
|
||||||
///to be generated. 'Randomly' picks a character type.
|
res += genString(loose, chars);
|
||||||
while (toAppend == null) {
|
|
||||||
int selector = random.nextInt(3);
|
var shuffledlist = res.split('')..shuffle();
|
||||||
|
return shuffledlist.join();
|
||||||
if (selector == 0) {
|
}
|
||||||
toAppend = _generateLetter();
|
|
||||||
} else if (selector == 1) {
|
static String genString(int length, String chars) {
|
||||||
toAppend = _generateNumber();
|
return String.fromCharCodes(
|
||||||
} else {
|
Iterable.generate(
|
||||||
toAppend = _generateSymbol();
|
length,
|
||||||
}
|
(_) => chars.codeUnitAt(
|
||||||
}
|
_rnd.nextInt(chars.length),
|
||||||
|
),
|
||||||
_generatedValue += toAppend;
|
),
|
||||||
toAppend = null;
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
static StringGeneratorFunction userPassword = () => getRandomString(
|
||||||
///Generates a letter when called.
|
8,
|
||||||
String _generateLetter() {
|
hasLowercaseLetters: true,
|
||||||
if (!_letterGen) return '';
|
hasUppercaseLetters: true,
|
||||||
|
hasNumbers: true,
|
||||||
///Finds the integer value for the range between a-z and A-Z, with [base] UTF-16 value for lowercase letters and
|
isStrict: true,
|
||||||
///[baseUpper] UTF-16 value for uppercase letters
|
);
|
||||||
int base = "a".codeUnitAt(0);
|
|
||||||
int baseUpper = "A".codeUnitAt(0);
|
static StringGeneratorFunction passwordSalt = () => getRandomString(
|
||||||
int maxRand = ("z".codeUnitAt(0) - base) + 1;
|
8,
|
||||||
Random random = new Random();
|
hasLowercaseLetters: true,
|
||||||
|
);
|
||||||
///Randomly selects between upper and lower case generation, randomly generates value from [maxRand], then adding base,
|
|
||||||
///which creates a UTF-16 encoded character to be converted into a string of one character between a-z/A-Z.
|
static StringGeneratorFunction simpleId = () => getRandomString(
|
||||||
///This string is then returned.
|
5,
|
||||||
if (random.nextInt(2) == 0) {
|
hasLowercaseLetters: true,
|
||||||
return String.fromCharCodes([random.nextInt(maxRand) + base]);
|
);
|
||||||
} else {
|
|
||||||
return String.fromCharCodes([random.nextInt(maxRand) + baseUpper]);
|
static StringGeneratorFunction dbPassword = () => getRandomString(
|
||||||
}
|
40,
|
||||||
}
|
hasLowercaseLetters: true,
|
||||||
|
hasUppercaseLetters: true,
|
||||||
///Generates a number when called
|
hasNumbers: true,
|
||||||
String? _generateNumber() {
|
hasSymbols: true,
|
||||||
if (!_numGen) return null;
|
);
|
||||||
|
|
||||||
///Finds the integer value for the range between 0-9
|
static StringGeneratorFunction dbStorageName = () => getRandomString(
|
||||||
int base = "0".codeUnitAt(0);
|
6,
|
||||||
int maxRand = ("9".codeUnitAt(0) - base) + 1;
|
hasLowercaseLetters: true,
|
||||||
Random random = new Random();
|
hasUppercaseLetters: true,
|
||||||
|
hasNumbers: true,
|
||||||
///Randomly generates value from [maxRand], then adding base, which creates a UTF-16 encoded character to be converted into a
|
);
|
||||||
///string of one character between 0-9. This string is then returned.
|
|
||||||
return String.fromCharCodes([random.nextInt(maxRand) + base]);
|
|
||||||
}
|
|
||||||
|
|
||||||
///Generates a symbol when called
|
|
||||||
String? _generateSymbol() {
|
|
||||||
if (!_symGen) return null;
|
|
||||||
|
|
||||||
///Finds the integer value for the range between symbols !-.
|
|
||||||
|
|
||||||
///(note) which includes symbols !"#$%&'()*+,=.
|
|
||||||
int base = "!".codeUnitAt(0);
|
|
||||||
int maxRand = (".".codeUnitAt(0) - base) + 1;
|
|
||||||
Random random = new Random();
|
|
||||||
|
|
||||||
///Randomly generates value from [maxRand], then adding base, which creates a UTF-16 encoded character to be
|
|
||||||
///converted into a string of one character between !-. . This string is then returned.
|
|
||||||
return String.fromCharCodes([random.nextInt(maxRand) + base]);
|
|
||||||
}
|
|
||||||
|
|
||||||
///Toggles letter generation
|
|
||||||
void checkLetterGen(bool value) {
|
|
||||||
_letterGen = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Toggles number generation
|
|
||||||
void checkNumGen(bool value) {
|
|
||||||
_numGen = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Toggles symbol generation
|
|
||||||
void checkSymGen(bool value) {
|
|
||||||
_symGen = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Returns the generated value to be used by generator app
|
|
||||||
String getGeneratedValue() {
|
|
||||||
return _generatedValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
const _chars =
|
|
||||||
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890_';
|
|
||||||
Random _rnd = Random();
|
|
||||||
|
|
||||||
String getRandomString(int length, [chars = _chars]) => String.fromCharCodes(
|
|
||||||
Iterable.generate(
|
|
||||||
length,
|
|
||||||
(_) => chars.codeUnitAt(
|
|
||||||
_rnd.nextInt(chars.length),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
90
pubspec.lock
90
pubspec.lock
|
@ -28,7 +28,7 @@ packages:
|
||||||
name: args
|
name: args
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.2.0"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -37,12 +37,12 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.1"
|
version: "2.6.1"
|
||||||
basic_utils:
|
basic_utils:
|
||||||
dependency: "direct dev"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: basic_utils
|
name: basic_utils
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.4.0"
|
||||||
bloc:
|
bloc:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -63,7 +63,7 @@ packages:
|
||||||
name: build
|
name: build
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.0.3"
|
||||||
build_config:
|
build_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -84,7 +84,7 @@ packages:
|
||||||
name: build_resolvers
|
name: build_resolvers
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.4"
|
||||||
build_runner:
|
build_runner:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
|
@ -112,7 +112,7 @@ packages:
|
||||||
name: built_value
|
name: built_value
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.1.0"
|
version: "8.1.2"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -140,7 +140,7 @@ packages:
|
||||||
name: cli_util
|
name: cli_util
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.0"
|
version: "0.3.3"
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -168,7 +168,7 @@ packages:
|
||||||
name: convert
|
name: convert
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
coverage:
|
coverage:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -196,7 +196,7 @@ packages:
|
||||||
name: cubit_form
|
name: cubit_form
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.16"
|
version: "1.0.18"
|
||||||
cupertino_icons:
|
cupertino_icons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -210,7 +210,7 @@ packages:
|
||||||
name: dart_style
|
name: dart_style
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.3"
|
||||||
dio:
|
dio:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -259,7 +259,7 @@ packages:
|
||||||
name: extended_masked_text
|
name: extended_masked_text
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.3.0"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -306,14 +306,14 @@ packages:
|
||||||
name: flutter_bloc
|
name: flutter_bloc
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.1"
|
version: "7.1.0"
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: flutter_launcher_icons
|
name: flutter_launcher_icons
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.0"
|
version: "0.9.1"
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -325,14 +325,14 @@ packages:
|
||||||
name: flutter_markdown
|
name: flutter_markdown
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.2"
|
version: "0.6.4"
|
||||||
flutter_secure_storage:
|
flutter_secure_storage:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_secure_storage
|
name: flutter_secure_storage
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.0"
|
version: "4.2.1"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -426,7 +426,7 @@ packages:
|
||||||
name: io
|
name: io
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.0.3"
|
||||||
ionicons:
|
ionicons:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -454,7 +454,7 @@ packages:
|
||||||
name: json_serializable
|
name: json_serializable
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.3"
|
version: "4.1.4"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -552,14 +552,14 @@ packages:
|
||||||
name: path_provider_linux
|
name: path_provider_linux
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.2"
|
||||||
path_provider_macos:
|
path_provider_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_macos
|
name: path_provider_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.2"
|
||||||
path_provider_platform_interface:
|
path_provider_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -573,7 +573,7 @@ packages:
|
||||||
name: path_provider_windows
|
name: path_provider_windows
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.3"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -601,14 +601,14 @@ packages:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
pointycastle:
|
pointycastle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pointycastle
|
name: pointycastle
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.3.0"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -629,7 +629,7 @@ packages:
|
||||||
name: process
|
name: process
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.1"
|
version: "4.2.3"
|
||||||
provider:
|
provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -706,14 +706,14 @@ packages:
|
||||||
name: shared_preferences_linux
|
name: shared_preferences_linux
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.2"
|
||||||
shared_preferences_macos:
|
shared_preferences_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_macos
|
name: shared_preferences_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.2"
|
||||||
shared_preferences_platform_interface:
|
shared_preferences_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -727,21 +727,21 @@ packages:
|
||||||
name: shared_preferences_web
|
name: shared_preferences_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
shared_preferences_windows:
|
shared_preferences_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_windows
|
name: shared_preferences_windows
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.2"
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf
|
name: shelf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.4"
|
version: "1.2.0"
|
||||||
shelf_packages_handler:
|
shelf_packages_handler:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -755,7 +755,7 @@ packages:
|
||||||
name: shelf_static
|
name: shelf_static
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.1.0"
|
||||||
shelf_web_socket:
|
shelf_web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -774,14 +774,14 @@ packages:
|
||||||
name: source_gen
|
name: source_gen
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.2"
|
version: "1.0.3"
|
||||||
source_helper:
|
source_helper:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_helper
|
name: source_helper
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.2.1"
|
||||||
source_map_stack_trace:
|
source_map_stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -886,42 +886,42 @@ packages:
|
||||||
name: url_launcher
|
name: url_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.6"
|
version: "6.0.9"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_linux
|
name: url_launcher_linux
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
url_launcher_macos:
|
url_launcher_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_macos
|
name: url_launcher_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
url_launcher_platform_interface:
|
url_launcher_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_platform_interface
|
name: url_launcher_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.3"
|
version: "2.0.4"
|
||||||
url_launcher_web:
|
url_launcher_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_web
|
name: url_launcher_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.0.2"
|
||||||
url_launcher_windows:
|
url_launcher_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_windows
|
name: url_launcher_windows
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.1"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -942,35 +942,35 @@ packages:
|
||||||
name: wakelock
|
name: wakelock
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.2"
|
version: "0.5.3+3"
|
||||||
wakelock_macos:
|
wakelock_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: wakelock_macos
|
name: wakelock_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.0+1"
|
version: "0.1.0+2"
|
||||||
wakelock_platform_interface:
|
wakelock_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: wakelock_platform_interface
|
name: wakelock_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.1+1"
|
version: "0.2.1+2"
|
||||||
wakelock_web:
|
wakelock_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: wakelock_web
|
name: wakelock_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.0+1"
|
version: "0.2.0+2"
|
||||||
wakelock_windows:
|
wakelock_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: wakelock_windows
|
name: wakelock_windows
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.0"
|
version: "0.1.0+1"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -998,7 +998,7 @@ packages:
|
||||||
name: win32
|
name: win32
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.5"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1021,5 +1021,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.0"
|
version: "3.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.13.0 <3.0.0"
|
dart: ">=2.13.4 <3.0.0"
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=2.2.3"
|
||||||
|
|
10
pubspec.yaml
10
pubspec.yaml
|
@ -4,8 +4,8 @@ publish_to: 'none'
|
||||||
version: 0.1.3+5
|
version: 0.1.3+5
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.13.4 <3.0.0'
|
||||||
flutter: ">=2.0.0"
|
flutter: ">=2.2.3"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
@ -16,9 +16,9 @@ dependencies:
|
||||||
dio: ^4.0.0-beta7
|
dio: ^4.0.0-beta7
|
||||||
easy_localization: ^3.0.0
|
easy_localization: ^3.0.0
|
||||||
either_option: ^2.0.1-dev.1
|
either_option: ^2.0.1-dev.1
|
||||||
equatable: ^2.0.0
|
equatable: ^2.0.3
|
||||||
fl_chart: ^0.35.0
|
fl_chart: ^0.35.0
|
||||||
flutter_bloc: ^7.0.0
|
flutter_bloc: ^7.1.0
|
||||||
flutter_markdown: ^0.6.0
|
flutter_markdown: ^0.6.0
|
||||||
flutter_secure_storage: ^4.1.0
|
flutter_secure_storage: ^4.1.0
|
||||||
get_it: ^6.0.0
|
get_it: ^6.0.0
|
||||||
|
@ -35,11 +35,11 @@ dependencies:
|
||||||
unicons: ^1.0.2
|
unicons: ^1.0.2
|
||||||
url_launcher: ^6.0.2
|
url_launcher: ^6.0.2
|
||||||
wakelock: ^0.5.0+2
|
wakelock: ^0.5.0+2
|
||||||
|
basic_utils: ^3.4.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
basic_utils: ^3.0.0-nullsafety.1
|
|
||||||
build_runner: ^1.11.5
|
build_runner: ^1.11.5
|
||||||
flutter_launcher_icons: ^0.9.0
|
flutter_launcher_icons: ^0.9.0
|
||||||
hive_generator: ^1.0.0
|
hive_generator: ^1.0.0
|
||||||
|
|
|
@ -1,30 +1,122 @@
|
||||||
// This is a basic Flutter widget test.
|
|
||||||
//
|
|
||||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
||||||
// utility that Flutter provides. For example, you can send tap and scroll
|
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import 'package:selfprivacy/main.dart';
|
import 'package:selfprivacy/utils/password_generator.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
group('StringGenerators', () {
|
||||||
// Build our app and trigger a frame.
|
group('Basic', () {
|
||||||
await tester.pumpWidget(MyApp());
|
test('assert chart empty', () {
|
||||||
|
expect(() {
|
||||||
|
StringGenerators.getRandomString(8);
|
||||||
|
}, throwsAssertionError);
|
||||||
|
});
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
test('only lowercase string', () {
|
||||||
expect(find.text('0'), findsOneWidget);
|
var length = 8;
|
||||||
expect(find.text('1'), findsNothing);
|
var generatedString =
|
||||||
|
StringGenerators.getRandomString(length, hasLowercaseLetters: true);
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
expect(generatedString, isNot(matches(regExpNewLines)));
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
expect(generatedString, isNot(matches(regExpWhiteSpaces)));
|
||||||
await tester.pump();
|
expect(generatedString, isNot(matches(regExpNumbers)));
|
||||||
|
expect(generatedString, isNot(matches(regExpUppercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpSymbols)));
|
||||||
|
expect(generatedString.length, equals(length));
|
||||||
|
expect(generatedString, matches(regExpLowercaseLetters));
|
||||||
|
});
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
test('only uppercase string', () {
|
||||||
expect(find.text('0'), findsNothing);
|
var length = 8;
|
||||||
expect(find.text('1'), findsOneWidget);
|
var generatedString = StringGenerators.getRandomString(length,
|
||||||
|
hasLowercaseLetters: false, hasUppercaseLetters: true);
|
||||||
|
|
||||||
|
expect(generatedString, isNot(matches(regExpNewLines)));
|
||||||
|
expect(generatedString, isNot(matches(regExpWhiteSpaces)));
|
||||||
|
expect(generatedString, isNot(matches(regExpNumbers)));
|
||||||
|
expect(generatedString, isNot(matches(regExpLowercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpSymbols)));
|
||||||
|
expect(generatedString.length, equals(length));
|
||||||
|
expect(generatedString, matches(regExpUppercaseLetters));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('only numbers string', () {
|
||||||
|
var length = 8;
|
||||||
|
var generatedString = StringGenerators.getRandomString(length,
|
||||||
|
hasLowercaseLetters: false,
|
||||||
|
hasUppercaseLetters: false,
|
||||||
|
hasNumbers: true);
|
||||||
|
|
||||||
|
expect(generatedString, isNot(matches(regExpNewLines)));
|
||||||
|
expect(generatedString, isNot(matches(regExpWhiteSpaces)));
|
||||||
|
expect(generatedString, isNot(matches(regExpUppercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpLowercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpSymbols)));
|
||||||
|
expect(generatedString.length, equals(length));
|
||||||
|
expect(generatedString, matches(regExpNumbers));
|
||||||
|
});
|
||||||
|
|
||||||
|
test('only symbols string', () {
|
||||||
|
var length = 8;
|
||||||
|
var generatedString = StringGenerators.getRandomString(
|
||||||
|
length,
|
||||||
|
hasLowercaseLetters: false,
|
||||||
|
hasUppercaseLetters: false,
|
||||||
|
hasNumbers: false,
|
||||||
|
hasSymbols: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(generatedString, isNot(matches(regExpNewLines)));
|
||||||
|
expect(generatedString, isNot(matches(regExpWhiteSpaces)));
|
||||||
|
expect(generatedString, isNot(matches(regExpUppercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpLowercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpNumbers)));
|
||||||
|
expect(generatedString.length, equals(length));
|
||||||
|
expect(generatedString, matches(regExpSymbols));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
group('Strict mode', () {
|
||||||
|
test('All', () {
|
||||||
|
var length = 5;
|
||||||
|
var generatedString = StringGenerators.getRandomString(length,
|
||||||
|
hasLowercaseLetters: true,
|
||||||
|
hasUppercaseLetters: true,
|
||||||
|
hasNumbers: true,
|
||||||
|
hasSymbols: true,
|
||||||
|
isStrict: true);
|
||||||
|
|
||||||
|
expect(generatedString, isNot(matches(regExpNewLines)));
|
||||||
|
expect(generatedString, isNot(matches(regExpWhiteSpaces)));
|
||||||
|
expect(generatedString, matches(regExpLowercaseLetters));
|
||||||
|
expect(generatedString, matches(regExpUppercaseLetters));
|
||||||
|
expect(generatedString, matches(regExpNumbers));
|
||||||
|
expect(generatedString, matches(regExpSymbols));
|
||||||
|
expect(generatedString.length, equals(length));
|
||||||
|
});
|
||||||
|
test('Lowercase letters and numbers', () {
|
||||||
|
var length = 3;
|
||||||
|
var generatedString = StringGenerators.getRandomString(length,
|
||||||
|
hasLowercaseLetters: true,
|
||||||
|
hasUppercaseLetters: false,
|
||||||
|
hasNumbers: true,
|
||||||
|
hasSymbols: false,
|
||||||
|
isStrict: true);
|
||||||
|
|
||||||
|
expect(generatedString, isNot(matches(regExpNewLines)));
|
||||||
|
expect(generatedString, isNot(matches(regExpWhiteSpaces)));
|
||||||
|
expect(generatedString, isNot(matches(regExpUppercaseLetters)));
|
||||||
|
expect(generatedString, isNot(matches(regExpSymbols)));
|
||||||
|
expect(generatedString, matches(regExpLowercaseLetters));
|
||||||
|
expect(generatedString, matches(regExpNumbers));
|
||||||
|
expect(generatedString.length, equals(length));
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var regExpNewLines = RegExp(r"[\n\r]+");
|
||||||
|
var regExpWhiteSpaces = RegExp(r"[\s]+");
|
||||||
|
var regExpUppercaseLetters = RegExp(r"[A-Z]");
|
||||||
|
var regExpLowercaseLetters = RegExp(r"[a-z]");
|
||||||
|
var regExpNumbers = RegExp(r"[0-9]");
|
||||||
|
var regExpSymbols = RegExp(r'(?:_|[^\w\s])+');
|
||||||
|
|
Loading…
Reference in a new issue