The current codebase matches web clients to native clients by email-address. web clients additionally keep track of which native clients they "trust", but connecting web client to native client and vice versa is based on email-address, alone.
The web client's email-address is taken from the outlook account. The native client's email-address(es) are taken from its list of available private keys.
This approach comes with some limitations:
- Several users might have access to (some) of the same e-mail-addresses and private keys.
- A user may want to use the plugin without having access to a relevant private key. E.g. for checking signatures. Or the UID(s) of their private key(s) may simply not match the UID of the outlook account, but messages are (also) encrypted to those keys.
The current code base makes an effort to enable the second case, at least for single machine installations: In case only a single native client is registered, the proxy server tries to fall back to that for establishing a mapping. (Although so far this has been very buggy). However, this does not address the first use case, above, and comes with its own set of complications. E.g. suppose (in a shared proxy setup), user A has left their browser tab opened over night. Next morning, user B starts their native client, and the two connect, despite mismatching email-addresses. (Related issue: https://dev.gnupg.org/T7726). Also it makes it difficult to correctly detect and display error conditions such as: "Connection is established, but you lack the private key for this account."
Suggested action plan:
- The native client already sets up a unique id. Let's just use that as the primary key for establishing the connection between web client and native client.
- On first start/configuration, the web client does not yet know what id to connect to. The proxy server will then provide it with a list of non-connected native client ids to select from. These will be simultaneously shown in the native client, and offered for selection in the UI, similar to bluetooth pairing.
- The native client id is stored in the browser's localStorage. On next startup, web client and native client will both register at the proxy server with that id. The proxy then uses that, instead of email in order to route messages back and forth.
Related side-issues:
- Only a single web-client (aka browser tab) can currently connect to a native client. That's also a limitation of the mapping implementation, but is not logically dependent on the nature of the mapping key.