createSignature method
Synchronous compatibility helper. Argon2id13 deliberately throws on web.
Implementation
String createSignature(
String authId,
String helloNonce,
Extra extra,
HashMap<String, Object?> authExtra,
) {
_ensureUsable();
_validateChallenge(extra);
final fingerprint = _fingerprint(authId, extra);
if (_keyFingerprint != null && _keyFingerprint != fingerprint) {
if (_secret == null) {
throw StateError('Cached SCRAM key does not match this challenge');
}
_clearKeys();
}
if (_clientKey == null) {
final secret = _secret;
if (secret == null) throw StateError('SCRAM secret is unavailable');
final saltedPassword = deriveSaltedPassword(
secret: secret,
salt: extra.salt!,
kdf: extra.kdf!,
iterations: extra.iterations!,
memory: extra.memory,
stringEncoding: stringEncoding,
);
_installKeys(saltedPassword, fingerprint);
_clear(saltedPassword);
} else {
_keyFingerprint ??= fingerprint;
}
return _buildProofAndVerifier(authId, helloNonce, authExtra, extra);
}