Server constructor

Server({
  1. required String userId,
  2. required Uint8List salt,
  3. required Uint8List verifierKey,
  4. BigInt? generator,
  5. BigInt? safePrime,
  6. HashFunctionChoice? hashFunction,
  7. 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.');
  }
}