示例#1
0
        private async Task handleMismatchedDevices(PushServiceSocket socket, SignalServiceAddress recipient,
                                                   MismatchedDevices mismatchedDevices)
        {
            try
            {
                foreach (uint extraDeviceId in mismatchedDevices.getExtraDevices())
                {
                    store.DeleteSession(new SignalProtocolAddress(recipient.getNumber(), extraDeviceId));
                }

                foreach (uint missingDeviceId in mismatchedDevices.getMissingDevices())
                {
                    PreKeyBundle preKey = await socket.getPreKey(recipient, missingDeviceId);

                    try
                    {
                        SessionBuilder sessionBuilder = new SessionBuilder(store, new SignalProtocolAddress(recipient.getNumber(), missingDeviceId));
                        sessionBuilder.process(preKey);
                    }
                    catch (libsignal.exceptions.UntrustedIdentityException e)
                    {
                        throw new UntrustedIdentityException("Untrusted identity key!", recipient.getNumber(), preKey.getIdentityKey());
                    }
                }
            }
            catch (InvalidKeyException e)
            {
                throw new Exception(e.Message);
            }
        }
 public MismatchedDevicesException(MismatchedDevices mismatchedDevices)
 {
     this.mismatchedDevices = mismatchedDevices;
 }
 public MismatchedDevicesException(MismatchedDevices mismatchedDevices)
 {
     this.MismatchedDevices = mismatchedDevices;
 }
 public MismatchedDevicesException(MismatchedDevices mismatchedDevices) : base(409)
 {
     MismatchedDevices = mismatchedDevices;
 }