Skip to content
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

Update mls-validator-service registration flow #1737

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 63 additions & 2 deletions bindings_ffi/src/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3290,7 +3290,7 @@ mod tests {
};

let cred = pk_client
.authenticate(origin, request, DefaultClientData)
.authenticate(origin.clone(), request, DefaultClientData)
.await
.unwrap();
let resp = cred.response;
Expand Down Expand Up @@ -3326,7 +3326,68 @@ mod tests {

// TODO: I'll uncomment this as soon as PR 1733 goes live.
// Tested locally with this uncommented and it works.
// alex.apply_signature_request(sig_request).await.unwrap();
alex.apply_signature_request(sig_request).await.unwrap();

let nonce = 0;
let db_path = tmp_path();
let db_enc_key = static_enc_key().to_vec();
let ident = FfiIdentifier {
identifier: hex::encode(public_key.clone()),
identifier_kind: FfiIdentifierKind::Passkey,
};
let inbox_id = ident.inbox_id(nonce).unwrap();
let client = create_client(
connect_to_backend(xmtp_api_grpc::LOCALHOST_ADDRESS.to_string(), false)
.await
.unwrap(),
Some(db_path),
Some(db_enc_key),
&inbox_id,
ident,
nonce,
None,
None,
)
.await
.unwrap();

let sig_request = client.signature_request().unwrap().clone();
let challenge = sig_request.signature_text().await.unwrap();
let challenge_bytes = challenge.as_bytes().to_vec();

let request = CredentialRequestOptions {
public_key: PublicKeyCredentialRequestOptions {
challenge: Bytes::from(challenge_bytes),
timeout: None,
rp_id: Some(String::from(origin.domain().unwrap())),
allow_credentials: None,
user_verification: UserVerificationRequirement::default(),
hints: None,
attestation: AttestationConveyancePreference::None,
attestation_formats: None,
extensions: None,
},
};

let cred = pk_client
.authenticate(origin, request, DefaultClientData)
.await
.unwrap();
let resp = cred.response;

let signature = resp.signature.to_vec();
sig_request
.add_passkey_signature(FfiPasskeySignature {
authenticator_data: resp.authenticator_data.to_vec(),
signature: signature.clone(),
client_data_json: resp.client_data_json.to_vec(),
public_key: public_key.clone(),
})
.await
// should be good
.unwrap();

client.register_identity(sig_request).await.unwrap();
}

#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
Expand Down
2 changes: 1 addition & 1 deletion xmtp_id/src/associations/association_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl IdentityAction for CreateInbox {
}

allowed_signature_for_kind(
&MemberKind::Ethereum,
&self.account_identifier.kind(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix

&self.initial_identifier_signature.kind,
)?;

Expand Down
Loading