SecureONPassword constructor
Creates a new SecureONPassword instance with the given password
. The SecureON password
is validated on construction and will throw an exception on an invalid password.
It is recommended to utilize the static function validate to first validate the format of the SecureON password.
Implementation
factory SecureONPassword(
String password, {
String delimiter = ':',
}) {
final validation = SecureONPassword.validate(
password,
delimiter: delimiter,
);
if (!validation.state) {
throw validation.error!;
}
List<String> split = password.split(delimiter);
List<int> bytes = split.map((octet) => hex.decode(octet)[0]).toList();
return SecureONPassword._internal(
password: password,
delimiter: delimiter,
bytes: bytes,
);
}