-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: implement Pairing API #3
base: kdf
Are you sure you want to change the base?
Conversation
Great PR! (I left few notes above) |
I guess, I don't have right in this repo to resolve my review notes. @borngraced would you plz resolve them (including those you did not accept) |
ps: CI fmt and clippy checks fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huge work! First review iteration from my side.
pairing_api/src/pairing.rs
Outdated
pub async fn activate(&self, topic: &str) -> Result<(), PairingClientError> { | ||
let expiry = self.expiry()?; | ||
|
||
let mut pairings = self.pairings.lock().await; | ||
if let Some(pairing) = pairings.get_mut(topic) { | ||
pairing.pairing.active = true; | ||
pairing.pairing.expiry = expiry + EXPIRY_30_DAYS; | ||
} | ||
|
||
Ok(()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use this method above instead of code duplication?
This PR implements the WalletConnect Pairing API, enabling secure communication between dApps and wallets. It manages pairing requests, responses, and lifecycle events (creating, deleting, extending, and pinging pairings).
Key features:
Test overview (
cargo run --example pairing
):The test demonstrates the full lifecycle of a WalletConnect pairing, from establishment to termination, using the pairing_api and relay_client crates.
https://specs.walletconnect.com/2.0/specs/clients/core/pairing/
https://specs.walletconnect.com/2.0/specs/clients/core/crypto/crypto-keys
https://specs.walletconnect.com/2.0/specs/clients/core/pairing/data-structures
https://specs.walletconnect.com/2.0/specs/clients/core/pairing/pairing-api