Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Latest commit

 

History

History
94 lines (50 loc) · 7.07 KB

README.md

File metadata and controls

94 lines (50 loc) · 7.07 KB

💳 Wallet

Business Context

The cheqd webapp wallet offers an example implementation of how developers can leverage cheqd’s packages to create an identity application.

This was initially built for IIW 34 in April 2022. It has been since updated for IIW 35 in November 2022.

Features include:

  • Store and share digital identity credentials.
  • Share multiple digital identity credentials in one presentation
  • Access your CHEQ wallet account by connecting to the Keplr browser extension.
  • Send CHEQ tokens
  • Delegate, undelegate and redelegate to validators

Our starting principle for this wallet example implementation was to build a non-custodial wallet, which works in a browser. This is because a lot of identity wallets are "custodial" (on browser, mobile, desktop), i.e., they rely on having a 3rd party hold / operate actual credential interactions.

Quite often, this is due to technical requirements on software libraries that can only work on specific OSes. For example, many Aries frameworks rely on software libraries that are specifically compiled for iOS/Android/Linux/Windows/Mac.

Under the hood, we're doing something very similar to how password managers such as LastPass or 1Password work: only an encrypted copy of credentials is backed up. When you connect via Keplr, the backup is downloaded and decrypted only within your browser.

So what does this show? It shows a non-custodial wallet that can be recovered. Only the end-user, and whom they share it with, can see the contents. Obviously, this is only an example! An app developer could do a custodial wallet instead. Or, instead of using a Cosmos/Keplr wallet to authenticate an account, an app developer could use any other mechanism, such as username/password, SSO/OAuth etc.

To implement the credential issuance, we built this on top of Veramo’s SDK, since we found it was highly modular.

Architecture

Veramo reference app architecture

Figure: Architecture of demo wallet (editable Draw.io source file)

Developer Guide

If you’re exploring implementing a similar approach, here’s what you should bear in mind, broken down by each key repo / NPM package involved.

cheqd wallet

🛠️ Github repository: cheqd/wallet

cheqd Wallet allows users to perform standard DeFi activities on Cosmos such as staking/delegating, voting on governance Proposals, and sending tokens. Crucially, the cheqd Wallet goes one step further than this, offering the ability to store and share Verifiable Credentials.

Wallet frontend

🛠️ Github repository: cheqd/wallet-frontend-elements

The NPM package provides reusable frontend elements to be used in cheqd Wallet. This repository was a forked version of the Cosmos based Lum network wallet (lum-network/wallet).

Credential storage

🛠️ Github repository: cheqd/secret-box-service

The purpose of this NPM package is to store credentials from the wallet.cheqd.io web app. As such the wallet frontendneeds to be paired with the secret box service. This works by only storing an encrypted copy of the credentials which is decrypted within the browser based on the user (holder) entering a passphrase.

Credential issuance and verification backend

🛠️ Github repository: cheqd/credential-service

The purpose of this service is to issue and verify credentials. This service by itself does not take care of storing the credentials. This service is also dependent on auth0-service. Previously credential service used a Cloudflare container however it’s now running in its own node container.

User authentication with social media connection

🛠️ Github repository: chqed/auth0-service

The purpose of this NPM package is to provide an OAuth connection via the Auth0 service for credentials in wallet.cheqd.io web app.

This enables builders to offer users authentication with a Social Media account, e.g. Twitter and Discord, used in our demo.

cheqd TypeScript SDK

🛠️ Github repository: cheqd/sdk

The purpose of this NPM package is to provide a mechanism of integrating cheqd functionality in an application without using a 3rd-party SDK like Veramo SDK for cheqd.

This package includes:

If you are using Veramo SDK for cheqd, this SDK package is automatically installed and consumed by the did-provider-cheqd Veramo plugin.

cheqd x Veramo plug-in

🛠️ Github repository: cheqd/did-provider-cheqd

The purpose of this NPM package is to enable developers to interact with the cheqd ledger using Veramo SDK, a modular and pluggable client app SDK for decentralised identity and SSI applications.

This package includes Veramo SDK Agent methods for use with the Veramo CLI NPM package. It can also be consumed as an NPM package outside Veramo CLI for building your own applications with NPM.

The package's core functionality is borrowed from Veramo Core NPM package. and extends this to include cheqd ledger functionality, such as creating and managing DIDs.

did-provider-cheqd is the first Veramo SDK plug-in that utilises the DID Manager Update method to offer a full-body DIDDoc update for a DID on cheqd ledger, rather than individual field update transactions used more commonly in other DID methods such as did:ethr.

New DID creation can also be done by passing a full-body DIDoc payload in JSON, rather than having to assemble the document field-by-field.