Server constructor
Server({
- required String userId,
- required Uint8List salt,
- required Uint8List verifierKey,
- BigInt? generator,
- BigInt? safePrime,
- HashFunctionChoice? hashFunction,
- HashFunction? customHashFunction,
Creates a Server instance for SRP authentication.
Implementation
Server({
required final String userId,
required final Uint8List salt,
required final Uint8List verifierKey,
final BigInt? generator,
final BigInt? safePrime,
final HashFunctionChoice? hashFunction,
final HashFunction? customHashFunction,
}): _userIdBytes = userId.utf8Bytes,
_salt = Uint8List.fromList(salt),
_verifierKey = verifierKey.toBigInt(),
generator = generator ?? defaultGenerator,
_safePrimeBytes = safePrime?.toByteList() ?? defaultSafePrime.toByteList(),
safePrime = safePrime ?? defaultSafePrime {
_resolveHashFunction(hashFunction, customHashFunction);
if (safePrime == null) {
_log.warning('Using default safe prime. For production use, generate a custom safe prime using scripts/generate_safe_primes to reduce risk of pre-computed attacks.');
}
}