-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more than one public key per recipient #1188
Comments
That's true for now
I think yes. For example, we can store a few pub keys as a single source in the database record. In that case, a user will have a list of pub keys(in most cases with a single pub key) instead of a single key.
It's possible. For now, we just create a data class that contains only recipient emails. But we also can store for example Anyway, it's possible. |
This would be automatic - we'd have rules about how to choose the right one. No user interaction.
Would this end up being three db rows with three public keys, or one row with several public keys in it? |
only one row as before. Just |
Would it alternatively be possible to do a migration and be able to store more than one row per recipient, with one key per row? It's more work but it would be the most flexible. |
yes, we can do that. I don't see any problems with that. |
why not store additional keys in the additional table? one record per key, referencing recipient as foreign key? |
That's roughly what we do on browser extension - a list of recipients in one table with references to public keys, and a public key table next to it. |
@tomholub I'd like to clarify the relationships between Is there a situation when we can have a single pub key for two different email addresses? (a pub key that contains a few user ids). What we are going to support? I'm going to add the following @Entity(
tableName = "pub_keys",
indices = [
Index(
name = "email_fingerprint_in_pub_keys",
value = ["email", "fingerprint"],
unique = true
)
],
foreignKeys = [
ForeignKey(
entity = ContactEntity::class,
parentColumns = ["email"],
childColumns = ["email"],
onDelete = ForeignKey.CASCADE
)
]
)
class PubKeysEntity(
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = BaseColumns._ID) val id: Long? = null,
val email: String,
@ColumnInfo(name = "fingerprint") val fingerprint: String,
@ColumnInfo(name = "public_key") val publicKey: ByteArray
) |
|
On other platforms (browser and iOS) we have renamed
So instead of When ordering the public keys that come from the database, please use this logic: FlowCrypt/flowcrypt-ios#714 it will save us trouble later. After that, when deciding color of the recipient now that several keys are involved, use this logic (after sorting methodically, use the first key for the color) - FlowCrypt/flowcrypt-ios#712
To give you some examples: Tom may have a key for Tom + Human + Security So you can definitely have a situation where Tom has more than one key (expected) but also where one key is shared by Tom and Human or Tom and Mart (I think this answers your question). In this situation, it would be best to de-duplicate keys by their fingerprints. So that you don't have to store the shared key twice, and when you update it on one end, then it updates on both. I suppose that makes it many-to-many? |
Thank you for the clarification 👍
Some moments are worrying me. Let me explain.
|
It's ok to do it this way, if you prefer it. It's true it will probably make it simpler for you. But you can no longer de-duplicate by key fingerprint, and it cannot be a unique index. So your unique index will probably be recipient_id+fingerprint? |
Got it. I will use that logic
Correct |
Encryption and signing. NEW messages Imagine that I have the following records in the local database
I'm a
|
Also need to add an ability to see the public key details. Before we used to show the contact details that have only one key. But now we need to change that screen Before now |
yes - correct |
… keys per recipient (#1523) * Added PublicKeyEntity. Refactored code. WIP.| #1188 * Fixed using ContactsDao.getAllContactsWithPgpLD().| #1188 * Fixed using ContactsDao.getAllContactsWithPgp()/getAllContactsWithPgpWhichMatched().| #1188 * Renamed ContactEntity to RecipientEntity.| #1188 * Renamed ContactsDao to RecipientDao.| #1188 * Refactored code.| #1188 * Renamed ContactsViewModel to RecipientsViewModel.| #1188 * Fixed a few methods in RecipientDao. Refactored code.| #1188 * Fixed RecipientDao.getRecipientByEmail().| #1188 * Fixed some moments with adding/updating a recipient with a pub key.| #1188 * Made a workable version after switching to use 'recipients' and 'pub_keys' tables.| #1188 * Fixed tests. Refactored code.| #1188 * Modified code to use a new logic to save contacts on the compose screen.| #1539 * Modified code to use a new logic to apply colors to recipients(chips).| #1540 * Added changes to use all recipient's pub keys for ecnryption + use all sender's mathing pub keys.| #1541 * Fixed signing option.| #1541 * Import recipients manually. Refactored code. Added LookUpPubKeysDialogFragment and ImportRecipientsFromSourceFragment..| #1542 * Added a base realization of importing pub keys manually.| #1542 * Added ImportAllPubKeysFromSourceDialogFragment.| #1542 * Removed unused source.| #1542 * Improved some classes.| #1566 * Added RecipientDetailsFragment.| #1566 * Fixed opening PublicKeyDetailsFragment. Refactored code.| #1566 * Fixed exporting pub key.| #1566 * Fixed deleting pub key.| #1566 * Fixed editing pub key.| #1566 * Fixed database migration bug.| #1188 * Fixed nav_graph.xml for test.| #1188 * Temporary disabled some tests.| #1188 * Temporary disabled some tests(step 2).| #1188 * Fixed Junit tests.| #1188 * Fixed some UI tests.| #1188 * Fixed merge conflicts.| #1188 * Fixed some PR comments. Refactored code.| #1188 * Fixed some PR comments. Refactored code. Step 2.| #1188 * Restored some code.| #1188 * Renamed a file.| #1188 * Fixed importing/updating pub keys for PublicKeyMsgBlock.| #1188
(I'm filing a separate issue to discuss from #480 )
Right now, we import one public key per recipient email. So for [email protected] I can only have one public key. Would it be possible to allow more than one public key per each recipient email? Then we can import any keys, but have to change logic on how to choose the right key when we send out encrypted message, for example.
The text was updated successfully, but these errors were encountered: