WalletConnect
Published in

WalletConnect

The WalletConnect Pairing API: A Modular Approach to Accelerate Web3 Protocol Development

A few weeks ago, we released the final versions of the WalletConnect Sign v2.0 API and the WalletConnect Auth API. Besides several technical improvements, we also implemented a much bigger change — a modular approach now made possible by the WalletConnect Pairing API.

The WalletConnect Pairing API is a lightweight API for establishing an encrypted, protocol-agnostic communications layer between peers. It exposes a common interface and allows for the sending and receiving of multi-protocol requests over a single pairing, allowing you to build custom protocols that consume our robust WalletConnect infrastructure and the lower-level peer-to-peer communications layer. This also significantly improves the end user experience, as you can receive requests from different protocols just by scanning one QR code.

To give you an example of leveraging it, let’s imagine that you want your dapp to issue verifiable credentials to wallets after they make a payment. This seems like a lot of work! You need a secure communications channel between the dapp and the wallet to be able to send credentials in a private manner, a mediator to relay the messages, and probably a lot more.

With the new WalletConnect Pairing API, which is a part of our Core Package, all you need to do is implement your own protocol engine and plug it into WalletConnect for an amazingly smooth user experience. The user will be able to scan the QR code, establish a WalletConnect Sign session for transactions, receive and sign the transaction request, and receive and accept a verifiable credential proposal — just by scanning a single QR code, through a single communications channel.

Let’s say we want to implement an `Issuer` client that will allow us to propose issuance and issue verifiable credentials. Your protocol engine will have to register its method next to the WalletConnect Sign and WalletConnect Auth engines.

But first, we need to define a name for our protocol RPC method. Let’s call it `issue_vc`.

Now, import WalletConnectPairing into your file and call:

pairingClient.register(method: yourProtocolMethod).sink { IssueCredetialParams in
// wallet received Verifiable Credential
// present it to the user so he can accept
}

By method registration at the Pairing client, your protocol engine will subscribe to all the matching requests the wallet receives so that you can handle it properly. Send a credential proposal to the wallet user; if the user accepts, the response then needs to be handled on the dapp side.

Import WalletConnectNetworking, instantiate networking client, and subscribe for responses:

networkingClient.responseSubscription(on: IssueCredetialParams())

And there you have it! The WalletConnect Pairing API’s modular approach establishes a reusable communications channel between peers, giving you the flexibility to build on top of it according to your needs. It streamlines the experience — for you, the developer, and also your users.

Want to learn more about the WalletConnect Pairing API?

To better understand how the WalletConnect Auth and WalletConnect Sign SDKs work, explore the open-source code. There are Swift, Kotlin, and JavaScript implementations, and it will give you a better understanding of how the engine should work and and how to use storage for protocol objects and cryptographic keys.

If you have any questions, please reach out to the team on Discord. Also, check out our documentation and protocol specs!

To keep up with our announcements, join our Discord and follow us on Twitter. If you are a wallet or an app that is interested in integrating WalletConnect, head over to our website and explore our documentation.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store