hello method

  1. @override
Future<void> hello(
  1. String? realm,
  2. Details details
)
override

This method is called by the session to modify the hello details for a given realm. This method generates the authExtra 'nonce' value and starts the timeout to cancel the challenge if it took exceptionally long to receive

Implementation

@override
Future<void> hello(String? realm, Details details) {
  var random = Random.secure();
  var nonceBytes = [for (int i = 0; i < 16; i++) random.nextInt(256)];
  if (details.authid != null) {
    details.authid = Saslprep.saslprep(details.authid!);
    _authid = details.authid;
  }
  details.authextra ??= <String, dynamic>{};
  details.authextra!['nonce'] = base64.encode(nonceBytes);
  details.authextra!['channel_binding'] = null;
  _helloNonce = details.authextra!['nonce'];
  Future.delayed(_challengeTimeout, () => _helloNonce = null);
  return Future.value();
}