Implementing an Universal Wallet — W3C compliant way

IFESA
2 min readApr 11, 2021

--

Last post was about my journey with XDV NFT, Key Exchange and delegating identity in EVM compatible blockchains just to be able to get a key pair (all you need to do to make key exchange / encryption works, that’s why most private L2 solutions are complex). Today after getting inspiring (yup, that happens with developers too, coder’s block) I manage to code the initial merge between XDV Wallet v2, which I just called Universal Wallet, and IUniversalWallet concrete implementation.

What exactly is an Universal Wallet

Without resorting to any Wikipedia or W3C description, for us in IFESA, it is a wallet that can sign documents (binary or text), blockchain transactions and verified credentials as per W3C VC specifications.

That kind of wallet must have a basic set of primitives or building blocks. The reason is that most of the npm packages and tooling out there have been focused more on blockchain transactions, and document signing, thanks to Filecoin, IPFS and Swarm, has been getting traction and new APIs, like Fairdrive, are popping up. Because you need the most basic, like accept a File blob, hash, sign and similar for verifying, if you were to use web3 or ethers.js, you’ll have to do a more complex implementation because these tools are blockchain oriented.

Can it be done? Well yes, you have eth personal sign. But guess what, it depends on each wallet implementation. Eg Metamask has a very well robust personal sign, but Binance Smart Chain wallet still struggling, and probably many others. Thus, to find a good, quality, open source project that tackles “universally” all these use case are hard to find and few.

XDV Universal Wallet in a nutshell

  1. Make a wrapper like UniversalWallet.ts inherit an W3C interface IUniversalWallet
  2. The inner wallet, Wallet.ts, is wrapped ini UniversalWallet and inputs/outputs are classes annotated with class-validator decorators
  3. Add unit tests, integration tests, sample code, update docs.xdv.digital, npm release, and get the wallet or get bored trying.
  4. Go for the win! Now you can use it in any use case and your partners only have to learn W3C Universal Wallet spec and no longer get locked by other non standardized players

— Rogelio

--

--

IFESA

Industrias de Firmas Electrónicas, S.A. (IFESA) es la primera empresa panameña dedicada a tecnologías basadas en algoritmos criptográficos, firmas electrónicas,