use of org.jivesoftware.smackx.omemo.internal.CachedDeviceList in project Zom-Android by zom.
the class IOCipherOmemoStore method loadCachedDeviceList.
@Override
public CachedDeviceList loadCachedDeviceList(OmemoManager omemoManager, BareJid contact) {
CachedDeviceList cachedDeviceList = new CachedDeviceList();
if (contact == null) {
return null;
}
// active
File activeDevicesPath = hierarchy.getContactsActiveDevicesPath(omemoManager, contact);
try {
cachedDeviceList.getActiveDevices().addAll(readIntegers(activeDevicesPath));
} catch (IOException e) {
// Don't worry...
}
// inactive
File inactiveDevicesPath = hierarchy.getContactsInactiveDevicesPath(omemoManager, contact);
try {
cachedDeviceList.getInactiveDevices().addAll(readIntegers(inactiveDevicesPath));
} catch (IOException e) {
// It's ok :)
}
return cachedDeviceList;
}
use of org.jivesoftware.smackx.omemo.internal.CachedDeviceList in project Zom-Android by zom.
the class Omemo method getFingerprints.
public ArrayList<String> getFingerprints(BareJid jid, boolean autoload) throws CorruptedOmemoKeyException, SmackException, XMPPException.XMPPErrorException, InterruptedException {
try {
mOmemoManager.buildSessionsWith(jid);
} catch (CannotEstablishOmemoSessionException e) {
debug(TAG, "couldn't establish omemo session: " + e);
}
CachedDeviceList list = mOmemoStore.loadCachedDeviceList(mOmemoManager, jid);
if (list == null) {
list = new CachedDeviceList();
}
ArrayList<String> fps = new ArrayList<>();
for (int id : list.getActiveDevices()) {
OmemoDevice d = new OmemoDevice(jid, id);
IdentityKey idk = (IdentityKey) mOmemoStore.loadOmemoIdentityKey(mOmemoManager, d);
if (idk == null) {
System.out.println("No identityKey for " + d);
} else {
fps.add(mOmemoStore.keyUtil().getFingerprint(idk).toString());
}
}
return fps;
}
Aggregations