initializeSync method
void
initializeSync({})
Implementation
void initializeSync({
required bool isEncrypting,
required SecretKey secretKey,
required List<int> nonce,
List<int> aad = const [],
int keyStreamIndex = 0,
}) {
_isInitialized = false;
_isEncrypting = isEncrypting;
this.keyStreamIndex = keyStreamIndex;
final secretKeyData = secretKey as SecretKeyData;
final derivedSecretKey = deriveKeySync(
secretKey: secretKeyData,
nonce: nonce,
);
final derivedNonce = deriveNonce(
secretKey: secretKeyData,
nonce: nonce,
);
final macSink = cipher.macAlgorithm.toSync().newMacSinkSync(
secretKeyData: secretKeyData,
nonce: nonce,
aad: aad,
);
_macSink = macSink;
assert(!_isInitialized);
_isInitialized = true;
beforeData(
secretKey: derivedSecretKey,
nonce: derivedNonce,
aad: aad,
);
}