Go to file
Howard 81a70959af
Fix session sigs (#7)
* Decouple Google OAuth sign in with Mint PKP step

* Use new signSessionKey SDK method

* Handle authentication separately from storing conditions

* Use auth-helpers package to generate session sigs correctly

* Use react-app-rewired to use config override for fixing webpack bundle

create-react-app default webpack config does not match against .cjs files, so we need to override the default config to bundle .cjs files from auth-helpers using CJS to import the .cjs file
from recap-ts.

* Implement encrypt / decrypt using session sigs

* Use latest js-sdk, use npm instead of yarn

yarn still installs tslib at 1.14.1, which breaks, whereas npm installs at 2.5.0
2023-05-17 17:14:36 -07:00
public Implement WebAuthn auth for minting PKP and storing encryption condition (#2) 2023-02-23 14:37:39 -08:00
src Fix session sigs (#7) 2023-05-17 17:14:36 -07:00
tools minting and getting eth address works 2022-11-08 15:48:04 -08:00
.gitignore Update env name 2022-12-10 10:01:14 -08:00
.prettierrc Implement WebAuthn auth for minting PKP and storing encryption condition (#2) 2023-02-23 14:37:39 -08:00
config-overrides.js Fix session sigs (#7) 2023-05-17 17:14:36 -07:00
package-lock.json Fix session sigs (#7) 2023-05-17 17:14:36 -07:00
package.json Fix session sigs (#7) 2023-05-17 17:14:36 -07:00
README.md newline 2023-04-16 02:05:46 +09:00
tsconfig.json Transform more files to TS, replace lit-js-sdk with js-sdk (#4) 2023-02-23 16:39:50 -08:00

Lit Protocol Oauth -> Wallet example

This project lets you start using Ethereum with just a Google Account. It's a simple example of how to use the Lit Protocol Oauth service to authenticate users and then use their Ethereum address.

This project specifically:

  1. Uses Google Oauth to auth the user
  2. Mints a PKP token for the user, with their Google account as a valid auth method
  3. Uses the PKP token to get an Ethereum address for the user
  4. Generates a local session key for the user and stores it in LocalStorage
  5. Uses the Lit Protocol's PKP Session Signing service to sign that session key with their PKP
  6. Uses the local session key to sign a request to encrypt and decrypt a string that only the user can decrypt.

How to run

First, run yarn install. Then run yarn start to run this project. You'll need a Metamask wallet set to the Chronicle network with some Lit Test tokens in it. You can learn more about Chronicle here: https://developer.litprotocol.com/intro/rollup

Sign in with Google and wait until it says "PKP Minted". Then, click the "Encrypt then Decrypt with Lit" button. If you see the word "Success!" at the top, then it worked! Open the dev console to see how it works.

You also need to set 2 env vars:

export REACT_APP_RELAY_API_URL="https://relay-server-staging.herokuapp.com"

export REACT_APP_RPC_URL="https://chain-rpc.litprotcol.com/http"