resetAtSignFromKeychain method
Function to delete all values related to the atsign passed from keychain
Implementation
Future<bool> resetAtSignFromKeychain(String atsign) async {
AtClientData? atClientData;
final useSharedStorage = await isUsingSharedStorage();
if (useSharedStorage == true) {
final atClientDataShared = await readAtClientData(useSharedStorage: true);
atClientDataShared?.keys
.removeWhere((element) => element.atSign == atsign);
atClientData = await readAtClientData(useSharedStorage: false);
atClientData?.keys.removeWhere((element) => element.atSign == atsign);
if (atClientData != null && atClientDataShared != null) {
await _saveAtClientData(data: atClientData, useSharedStorage: false);
await _saveAtClientData(
data: atClientDataShared, useSharedStorage: true);
return true;
} else {
return false;
}
} else {
atClientData = await readAtClientData(useSharedStorage: false);
atClientData?.keys.removeWhere((element) => element.atSign == atsign);
if (atClientData != null) {
await _saveAtClientData(data: atClientData, useSharedStorage: false);
return true;
} else {
return false;
}
}
}