init method

Future<void> init()

Initialises the plugin.

Generates the Android Keystore key (or confirms it already exists) so that isWithinGracePeriod works correctly on the first call.

Call this once at app startup, before the first authenticate call.

Implementation

Future<void> init() async {
  // Always regenerate the key so that changes to gracePeriodSeconds take
  // effect immediately. The key is only used for grace period checking,
  // not for encrypting user data, so regenerating is safe.
  await _invokeMethod<bool>('generateKey', {
    'gracePeriodSeconds': options.gracePeriodSeconds,
    'keyName': options.keyName,
  });
}