pub(crate) async fn get_autocrypt_peerstate(
    context: &Context,
    from: &str,
    autocrypt_header: Option<&Aheader>,
    message_time: i64,
    allow_change: bool,
    allow_aeap: bool
) -> Result<Option<Peerstate>>
Expand description

Applies Autocrypt header to Autocrypt peer state and saves it into the database.

If we already know this fingerprint from another contact’s peerstate, return that peerstate in order to make AEAP work, but don’t save it into the db yet.

The param allow_change is used to prevent the autocrypt key from being changed if we suspect that the message may be forged and have a spoofed sender identity.

Returns updated peerstate.