use of info.guardianproject.iocipher.File in project Zom-Android by zom.
the class IOCipherOmemoStore method isFreshInstallation.
@Override
public boolean isFreshInstallation(OmemoManager omemoManager) {
File userDirectory = hierarchy.getUserDeviceDirectory(omemoManager);
File[] files = userDirectory.listFiles();
return files == null || files.length == 0;
}
use of info.guardianproject.iocipher.File in project Zom-Android by zom.
the class IOCipherOmemoStore method purgeOwnDeviceKeys.
@Override
public void purgeOwnDeviceKeys(OmemoManager omemoManager) {
File deviceDirectory = hierarchy.getUserDeviceDirectory(omemoManager);
deleteDirectory(deviceDirectory);
}
use of info.guardianproject.iocipher.File in project Zom-Android by zom.
the class IOCipherOmemoStore method removeOmemoPreKey.
@Override
public void removeOmemoPreKey(OmemoManager omemoManager, int preKeyId) {
File preKeyPath = hierarchy.getPreKeyPath(omemoManager, preKeyId);
preKeyPath.delete();
}
use of info.guardianproject.iocipher.File in project Zom-Android by zom.
the class IOCipherOmemoStore method removeOmemoSignedPreKey.
@Override
public void removeOmemoSignedPreKey(OmemoManager omemoManager, int signedPreKeyId) {
File signedPreKeyPath = new File(hierarchy.getSignedPreKeysDirectory(omemoManager), Integer.toString(signedPreKeyId));
signedPreKeyPath.delete();
}
use of info.guardianproject.iocipher.File in project Zom-Android by zom.
the class IOCipherOmemoStore method loadAllRawSessionsOf.
@Override
public HashMap<Integer, T_Sess> loadAllRawSessionsOf(OmemoManager omemoManager, BareJid contact) {
File contactsDirectory = hierarchy.getContactsDir(omemoManager, contact);
HashMap<Integer, T_Sess> sessions = new HashMap<>();
String[] devices = contactsDirectory.list();
for (String deviceId : devices != null ? devices : new String[0]) {
int id;
try {
id = Integer.parseInt(deviceId);
} catch (NumberFormatException e) {
continue;
}
OmemoDevice device = new OmemoDevice(contact, id);
File session = hierarchy.getContactsSessionPath(omemoManager, device);
try {
byte[] bytes = readBytes(session);
if (bytes == null) {
continue;
}
T_Sess s = keyUtil().rawSessionFromBytes(bytes);
sessions.put(id, s);
} catch (IOException e) {
// Do nothing
}
}
return sessions;
}
Aggregations