openSSSS method

Future<void> openSSSS({
  1. String? passphrase,
  2. String? recoveryKey,
  3. String? keyOrPassphrase,
  4. bool skip = false,
})

Implementation

Future<void> openSSSS(
    {String? passphrase,
    String? recoveryKey,
    String? keyOrPassphrase,
    bool skip = false}) async {
  Future<void> next() async {
    if (_nextAction == 'request') {
      await sendRequest();
    } else if (_nextAction == 'done') {
      // and now let's sign them all in the background
      unawaited(encryption.crossSigning.sign(_verifiedDevices));
      setState(KeyVerificationState.done);
    } else if (_nextAction == 'showQRSuccess') {
      setState(KeyVerificationState.showQRSuccess);
    }
  }

  if (skip) {
    await next();
    return;
  }
  final handle = encryption.ssss.open(EventTypes.CrossSigningUserSigning);
  await handle.unlock(
      passphrase: passphrase,
      recoveryKey: recoveryKey,
      keyOrPassphrase: keyOrPassphrase);
  await handle.maybeCacheAll();
  await next();
}