Skip to content

Jacob/feat/acquisition flow bindings#2074

Open
typfel wants to merge 6 commits intomainfrom
jacob/feat/acqusition-flow-bindings
Open

Jacob/feat/acquisition flow bindings#2074
typfel wants to merge 6 commits intomainfrom
jacob/feat/acqusition-flow-bindings

Conversation

@typfel
Copy link
Copy Markdown
Member

@typfel typfel commented Apr 24, 2026

What's new in this PR

Expose the acquisition flow in the bindings


PR Submission Checklist for internal contributors
  • The PR Title
    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@typfel typfel requested a review from a team April 24, 2026 11:07
P384,
/// ECDSA P-521 / ES512
P521,
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a mess right now -- not your PR, but the general situation with JwsAlgorithm and similar types.

The simple thing first: I would avoid saying "E2EI" or "end-to-end identity" in new API, that's a thing from the past and we would like to move away from that terminology. Instead, we should use credential-type names, e.g. "X509Credential" or similar, that make it much more explicit what the API is about.

That said, here I would perhaps just use "JwsAlgorithm", though even that is not ideal as the enum values are just curve names, not proper JWS algorithm names (I thought about using Curve but I don't think that is really sufficient in this context). It's really a mess and to resolve it properly we would need to rework the way we handle JwsAlgorithm, config and related types (for that we have a item already, I think created by Felix). 😞

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, renamed it to just JwsAlgorithm and removed any references to e2ei.

Comment thread crypto-ffi/src/e2ei/mod.rs Outdated
Comment thread crypto-ffi/src/e2ei/mod.rs Outdated
Comment thread crypto-ffi/src/e2ei/mod.rs Outdated
Comment thread crypto-ffi/src/e2ei/mod.rs Outdated
pub signing_key_pem: String,
/// PEM-encoded certificate chain, starting with the end-entity certificate.
pub certificate_chain_pem: Vec<String>,
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be exposing this. From the perspective of a CoreCrypto user, the acquisiton flow results in a valid credential, not the (signing key, certificate chain) pair. That is what is going under the hood, as an implementation detail, but the caller of our API should never see the signing key, only the (opaque) credential, that can then be added to the client, used in a conversation etc.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right of course! Wasn't thinking initially and just exposed everything as is, but why isn't the result type a credential in acquisition flow?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we can't do that right now without introducing a circular dependency because the credential type is currently defined in the crypto crate. Ideally, we would have the credential type in the e2e-identity crate (I'd like to rename that crate too, but that's not critical for CC10 as it is an impl detail), however moving it would probably not be a small change. In a way, the situation is similar to the one with the keystore trait definitions. Right now for crypto-ffi this should not be a problem because it depends on both e2e-identity and crypto crates.

Comment thread crypto-ffi/src/e2ei/mod.rs Outdated
/// Initial state of the E2EI X509 credential acquisition flow.
#[derive(uniffi::Object)]
pub struct X509CredentialAcquisition {
inner: Mutex<Option<wire_e2e_identity::X509CredentialAcquisition>>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is Option needed here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention was to remove the X509CredentialAcquisition once the flow completes so that you can't call finalize twice. But I guess the idea was to be able to resume from an intermediate state after deserializing the acquisition in the web case so this doesn't work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the option with an enum which would need to be extended when add support for serializing / deserializing.

Comment thread crypto-ffi/src/e2ei/mod.rs Outdated
#[uniffi::export]
impl X509CredentialAcquisitionDpopChallengeCompleted {
/// Complete the OIDC challenge and return the acquired signing key and certificate chain.
pub async fn complete_oidc_challenge(&self) -> CoreCryptoResult<X509CredentialAcquisitionResult> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, it is not intended that clients know about the underlying process details, such as which challenges we have and to call them. Please see the RFC CC2 and in particular how .finalize() is supposed to be used. The state we're in should be tracked internally.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned this up

@typfel typfel force-pushed the jacob/feat/acqusition-flow-bindings branch 5 times, most recently from b26da68 to cb299bb Compare April 28, 2026 07:25
@typfel typfel requested a review from istankovic April 28, 2026 09:00
Copy link
Copy Markdown
Contributor

@fewerner fewerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just merged the ts-browser util changes. You can now access window.helpers to get util from within the browser context.

Comment thread crypto-ffi/bindings/js/packages/browser/test/e2ei.test.ts Outdated
Comment thread crypto-ffi/bindings/js/packages/browser/test/e2ei.test.ts Outdated
@typfel typfel force-pushed the jacob/feat/acqusition-flow-bindings branch from c8be0a4 to 7d2fd34 Compare April 28, 2026 14:52
@typfel typfel requested a review from fewerner April 28, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants