store method

Future<void> store(
  1. String type,
  2. String secret, {
  3. bool add = false,
})

Implementation

Future<void> store(String type, String secret, {bool add = false}) async {
  final privateKey = this.privateKey;
  if (privateKey == null) {
    throw Exception('SSSS not unlocked');
  }
  await ssss.store(type, secret, keyId, privateKey, add: add);
  while (!ssss.client.accountData.containsKey(type) ||
      !(ssss.client.accountData[type]!.content
          .tryGetMap<String, Object?>('encrypted')!
          .containsKey(keyId)) ||
      await getStored(type) != secret) {
    Logs().d('Wait for secret of $type to match in accountdata');
    await ssss.client.oneShotSync();
  }
}