setupPending static method

Future<bool> setupPending({
  1. DVDatabaseAdapter? database,
})

Whether the first owner still has setting up to do: their own password, and a second factor on it.

Studio serves its setup screen and nothing else until this is false. An application left running on the password its console printed is one anybody who saw that console can open, and an owner who wandered off mid-setup is exactly that.

Implementation

static Future<bool> setupPending({DVDatabaseAdapter? database}) async {
  try {
    final DVRecordAdapter records = database == null
        ? const DVDatabase().records
        : DVRecordAdapter.over(database);
    await records.ensure(_shape);
    final List<Map<String, Object?>> rows = await records.find(table);
    for (final Map<String, Object?> row in rows) {
      if (row['changed_at'] == null || row['mfa_at'] == null) return true;
    }
    return false;
  } on Object {
    return false;
  }
}