Skip to content

Check and add missing tests for saving pub keys on the compose screen #1548

Closed

Description

@DenBond7

Need to add missing tests to cover the following:

You should fetch the recipient's public keys in compose regardless if we already have them in database. If a recipient was added, their public keys will be updated every time.

Fetch recipient pub keys from a server(attester/wkd)

Yes, using pubLookup to respect the settings

Parse the received result as a list of pub keys(zero or one for now as you said. What to do if there will be more than one? save all?)

While attester may only have zero or one, WKD may already have zero to many. Basically there is almost no place in the app left where we only deal with one pubkey, it's always potentially many. Almost always arrays.

Here: #1396 (comment)

The array you get from pubLookup gets saved into local storage one by one. It no longer matters whether it's zero, one or more than one: it's an array and it gets iterated over. For each key, see by fingerprint if we already have it for that recipient we were originally looking up.

If we already have that key for that recipient by fingerprint, we compare which one is newer (by date last modified / last signature) and if the remote key is newer than local key, we replace the key (for that recipient). If we didn't have that key for that recipient, then we save it.

We save keys regardless if they are usable, expired or revoked - save them all. Only don't save if they are completely unusuable eg cannot be parsed.

Save parsed pub keys in the local database where recipient == email

yes, the recipient we were trying to originally look up, is used for storing into database.

Originally posted by @tomholub in #1539 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions