ShenaniganDApp / shenanigan-monorepo

17 stars 4 forks source link

ThreeID Connect for React Native #400

Open youngkidwarrior opened 2 years ago

youngkidwarrior commented 2 years ago

User Story

As a ...

Existing or new user

I want ...

To link my Self.ID to Shenanigan's app

So that ...

I can save my user data on the ceramic network and link it with my Ethereum address

Comments and Outliers

3ID connect relies on an ethereum provider instance to be passed into its EthereumAuthProvider object.

import { EthereumAuthProvider, ThreeIdConnect } from '@3id/connect'

// ethProvider is an Ethereum provider and addresses an array of strings
const authProvider = new EthereumAuthProvider(ethProvider, addresses[0])

const threeIdConnect = new ThreeIdConnect()
await threeIdConnect.connect(authProvider)

WalletConnect doesn't provide an ethereum provider. So, our app only has access to an ethereum provider when using the ethers Burner wallet.

We will need to fork the ceramic blockchain-utils-linking repo and implement a compatible workflow for the walletconnect Client

3ID Connect Repo: https://github.com/ceramicstudio/3id-connect

Authenticate function for EthereumAuthProvider: https://github.com/ceramicnetwork/js-ceramic/blob/809cfc7a7da5780f8ba9eabe1fd447a33896d8cd/packages/blockchain-utils-linking/src/ethereum.ts#L152

WalletConnect Client API: https://docs.walletconnect.com/1.0/quick-start/dapps/client

We might be able to expand the authenticate function to function correctly with the WalletConnect 1.0 client

Acceptance Criteria

Scenario:

Given I am a new user:

When I open the app When I choose to connect a wallet (Burner or Existing) Then I should create an instance of an ethereum provider (burner) or WalletConnect Client (existing) And I should utilize the ThreeId instance to connect to the Self.ID system