-
Notifications
You must be signed in to change notification settings - Fork 9
feat: implement new credential management api [WPB-19572] [WPB-15973] #1522
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
Draft
coriolinus
wants to merge
16
commits into
main
Choose a base branch
from
prgn/feat/19573-credential-management-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,717
−1,200
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This passthrough implementation means that an `&MlsCryptoProvider` instance, ubiquitous in the `core-crypto` codebase as `backend`, can be used anywhere the `OpenMlsCrypto` trait is needed.
This type is a first-class credential type exposed to the world. It can be created independently of any client instance and the database; it lives in memory only. Strongly based on the old `CredentialBundle` type.
e241695
to
e0c43af
Compare
619e5a4
to
0aebd21
Compare
Note that this includes renaming a bunch of keystore entities from `MlsFoo` to `StoredFoo`, because 1. Those were not properly types owned by MLS 2. They were causing conflicts with actual types owned by MLS 3. The whole situation there was just confusing.
0aebd21
to
367b0c9
Compare
Previously `MlsCiphersuite` was defined in core-crypto, and `Ciphersuite` was defined in openmls, which was insane. This commit adjusts such that `Ciphersuite` is defined in core-crypto, and `MlsCiphersuite` is a module-level import alias for the definition in openmls.
367b0c9
to
2136b5e
Compare
b2a54e3
to
9d9929f
Compare
It's crazy how bad the naming scheme had been. Sometimes in the past we had `MlsFoo` meaning "the foo entity in the keystore"; in this case, we had `MlsCredentialType` meaning "the credential type entity defined in core-crypto." So we change it: places where we need to reference the Openmls credential type use it as `MlsCredentialType`. Places using our own credential type just call it `CredentialType`.
It provided us exactly one thing: it didn't handle the "unknown" case, because it incorrectly featured a bug which would trigger a runtime panic if one was ever encountered. That was obviously not ideal, so it seemed best to simplify the type system by dropping it entirely in favor of the upstream type.
The bit of our current implementation which handles finding credentials is split across two different functions in `Session`; it's hard to follow. But I am fairly confident that this replicates the current logic. The bit where keypairs get distributed across signing schemes and saved credentials seems very weird to me. I'd like to refactor that bit of the database at some point and make it make more sense.
851c3aa
to
65cbf8b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's new in this PR
Credential
type as a first-class struct.see here: if an identity uses signature schemes as the keys to an identity map, then it cannot have two identities with different ciphersuites which share the same signature scheme. And if that is impossible, then storing only the signature scheme is sufficient.Credential
hasciphersuite
not justsignature_scheme
swiftCredentialRef
type from which we can get a credential from the dbSession
methods:add_credential
<- check the client id matches, stores in keystoreremove_credential
<- must first check that the credential is not used in any conversation and remove both the credential and all key packages that were generated from itfind_credentials
<- optional filters: credential_type, ciphersuite, signature schemeget_credentials
<- all credentials without filteringadd_credential
swiftremove_credential
swiftfind_credentials
swiftget_credentials
swift