FlutterChacha20.poly1305Aead constructor

FlutterChacha20.poly1305Aead({
  1. Chacha20? fallback,
  2. CryptographyChannelPolicy? channelPolicy,
  3. Random? random,
})

Constructs Flutter-optimized Chacha20.poly1305Aead.

The channelPolicy can be used to choose which requests are sent to the plugin implementation (using a Flutter MethodChannel) and which ones are handled in the same isolate. The default FlutterCipher.defaultChannelPolicy forces small encrypt / decrypt calls to be handled in the same isolate.

When operating system APIs are not available fallback is used. The default fallback implementation is BackgroundChacha.

If you want deterministic key generation for testing, you can pass a Random instance that returns the same sequence of bytes every time.

Implementation

FlutterChacha20.poly1305Aead({
  Chacha20? fallback,
  CryptographyChannelPolicy? channelPolicy,
  Random? random,
})  : fallback = fallback ?? BackgroundChacha.poly1305Aead(),
      channelPolicy = channelPolicy ?? FlutterCipher.defaultChannelPolicy,
      super.constructor(random: random);