retrieveKey static method

Future<List<int>?> retrieveKey()

Implementation

static Future<List<int>?> retrieveKey() async {
  if (DeviceHelper.isWeb) {
    final keyString = html.window.localStorage[sessionEncryptionKey];
    if (keyString != null) {
      return keyString.split(',').map((e) => int.parse(e)).toList();
    }
  } else {
    final box = await Hive.openBox('myBox');
    final keyString = box.get(sessionEncryptionKey);
    await box.close();

    if (keyString != null) {
      return keyString.split(',').map((e) => int.parse(e)).toList();
    }
  }
  return null;
}