Ejemplo n.º 1
0
 public void regenerateKeys() {
   axolotlStore.regenerate();
   sessions.clear();
   fetchStatusMap.clear();
   publishBundlesIfNeeded();
   publishOwnDeviceIdIfNeeded();
 }
Ejemplo n.º 2
0
 public void registerDevices(final Jid jid, @NonNull final Set<Integer> deviceIds) {
   if (jid.toBareJid().equals(account.getJid().toBareJid())) {
     if (deviceIds.contains(getOwnDeviceId())) {
       deviceIds.remove(getOwnDeviceId());
     }
     for (Integer deviceId : deviceIds) {
       AxolotlAddress ownDeviceAddress = new AxolotlAddress(jid.toBareJid().toString(), deviceId);
       if (sessions.get(ownDeviceAddress) == null) {
         buildSessionFromPEP(ownDeviceAddress);
       }
     }
   }
   Set<Integer> expiredDevices =
       new HashSet<>(axolotlStore.getSubDeviceSessions(jid.toBareJid().toString()));
   expiredDevices.removeAll(deviceIds);
   setTrustOnSessions(
       jid,
       expiredDevices,
       XmppAxolotlSession.Trust.TRUSTED,
       XmppAxolotlSession.Trust.INACTIVE_TRUSTED);
   setTrustOnSessions(
       jid,
       expiredDevices,
       XmppAxolotlSession.Trust.UNDECIDED,
       XmppAxolotlSession.Trust.INACTIVE_UNDECIDED);
   setTrustOnSessions(
       jid,
       expiredDevices,
       XmppAxolotlSession.Trust.UNTRUSTED,
       XmppAxolotlSession.Trust.INACTIVE_UNTRUSTED);
   Set<Integer> newDevices = new HashSet<>(deviceIds);
   setTrustOnSessions(
       jid,
       newDevices,
       XmppAxolotlSession.Trust.INACTIVE_TRUSTED,
       XmppAxolotlSession.Trust.TRUSTED);
   setTrustOnSessions(
       jid,
       newDevices,
       XmppAxolotlSession.Trust.INACTIVE_UNDECIDED,
       XmppAxolotlSession.Trust.UNDECIDED);
   setTrustOnSessions(
       jid,
       newDevices,
       XmppAxolotlSession.Trust.INACTIVE_UNTRUSTED,
       XmppAxolotlSession.Trust.UNTRUSTED);
   this.deviceIds.put(jid, deviceIds);
   mXmppConnectionService.keyStatusUpdated();
   publishOwnDeviceIdIfNeeded();
 }