MySQLPacketHandshakeResponse41.createWithSha256Password constructor
MySQLPacketHandshakeResponse41.createWithSha256Password({
- required String username,
- required String password,
- required MySQLPacketInitialHandshake initialHandshakePayload,
- required bool secure,
SHA256_PASSWORD
Implementation
factory MySQLPacketHandshakeResponse41.createWithSha256Password({
required String username,
required String password,
required MySQLPacketInitialHandshake initialHandshakePayload,
required bool secure,
}) {
final challenge = initialHandshakePayload.authPluginDataPart1 +
initialHandshakePayload.authPluginDataPart2!.sublist(0, 12);
assert(challenge.length == 20);
Uint8List authData;
if (secure) {
authData = Uint8List.fromList(utf8.encode('$password\u0000'));
} else {
authData = Uint8List(0);
}
return MySQLPacketHandshakeResponse41(
capabilityFlags: _supportedCapabitilies,
maxPacketSize: 50 * 1024 * 1024,
authPluginName: 'sha256_password',
characterSet: initialHandshakePayload.charset,
authResponse: authData,
username: username,
);
}