Conversation
| val matchingKeys = keys.keyRings.asSequence().filter { | ||
| for (userId in it.publicKey.userIDs) { | ||
| try { | ||
| val parsed = BetterInternetAddress(userId) | ||
| if (parsed.emailAddress.toLowerCase(Locale.ROOT) == lowerCaseEmail) return@filter true | ||
| } catch (ex: Exception) { | ||
| // ignore | ||
| suspend fun lookupEmail(context: Context, email: String): Response<String> = | ||
| withContext(Dispatchers.IO) { | ||
| val pgpPublicKeyRingCollection = rawLookupEmail(context, email) | ||
| val lowerCaseEmail = email.toLowerCase(Locale.ROOT) | ||
| val firstMatchedKey = pgpPublicKeyRingCollection?.keyRings?.asSequence()?.filter { | ||
| for (userId in it.publicKey.userIDs) { | ||
| try { | ||
| val parsed = BetterInternetAddress(userId) | ||
| if (parsed.emailAddress.toLowerCase(Locale.ROOT) == lowerCaseEmail) return@filter true | ||
| } catch (ex: Exception) { | ||
| ex.printStackTrace() | ||
| } | ||
| } | ||
| } | ||
| false | ||
| }.toList() | ||
| return if (matchingKeys.isNotEmpty()) PGPPublicKeyRingCollection(matchingKeys) else null | ||
| } | ||
| false |
There was a problem hiding this comment.
Please still return an array from WkdClient, and then pick the key in PubLookup. To pick the key, instead of blindly the first one, let's use the first one that is .usableForEncryption, and add a comment in the code pointing to the issues to fix it.
That way, after we refactor code to allow for more than one pubkey, we can leave WkdClient class and tests untouched.
There was a problem hiding this comment.
.usableForEncryption - it seems that we don't have such code. How do we determine that?
There was a problem hiding this comment.
I see. Let's leave usableForEncryption for later. For now, have WkdClient return an array, and choose the first result that is not expired and not revoked. (with a comment linking to #480 )
There was a problem hiding this comment.
…o localhost:1212. | #1201
IvanPizhenko
left a comment
There was a problem hiding this comment.
Some questions here
|
@tomholub That's an important issue. I will merge it after your approve. |
|
"after your approval" or "after you approve" :-) I'll take a look |
tomholub
left a comment
There was a problem hiding this comment.
Suggestions below to make distinction between public key sources clearer.
FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/FlowcryptApiRepository.kt
Outdated
Show resolved
Hide resolved
FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/FlowcryptApiRepository.kt
Outdated
Show resolved
Hide resolved
FlowCrypt/src/main/java/com/flowcrypt/email/api/util/PubLookup.kt
Outdated
Show resolved
Hide resolved
This should maybe be called |
|
I have a general question. This How does the compose view fetch messages? Does it use the ContactsViewModel? |
|
Ok I see it now, it's the |
|
@tomholub I've added the requested changes. Please look at them. |

This PR added support of WKD in the app
close #1201
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):