Skip to main content

decide_device_keys_upload

Function decide_device_keys_upload 

Source
pub fn decide_device_keys_upload(
    existing_keys_json: Option<&str>,
    new_keys_value: &Value,
) -> Result<DeviceKeysUploadAction, MatrixError>
Expand description

Decide what a device_keys upload does for an already-authenticated device bearer. Compares only the keys object (curve25519/ed25519 identity), not algorithms/signatures.

  • No row yet → DeviceKeysUploadAction::Insert.
  • Identical keys → DeviceKeysUploadAction::Noop (clients re-upload on restart).
  • Different keys → DeviceKeysUploadAction::Reset: the sealed store was lost and the same device bearer minted a new Olm identity. The bearer already authenticated this call, so we accept the new identity, invalidate old OTKs, and wake peers via device_lists.changed. A silent refuse used to black-hole mail: peers never re-queried keys and never received a Megolm re-share.