better condition, docs

This commit is contained in:
Chris Cassano 2022-11-10 21:29:56 -08:00
parent f3bd10bdbf
commit 010b2fce10
2 changed files with 18 additions and 70 deletions

View File

@ -1,70 +1,18 @@
# Getting Started with Create React App # Lit Protocol Oauth -> Wallet example
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 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.
## Available Scripts This project specifically:
In the project directory, you can run: 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.
### `npm start` ## How to run
Runs the app in the development mode.\ First, run `yarn install`. Then run `yarn start` to run this project. You'll need a Metamask wallet set to the Mumbai network with some testnet MATIC in it.
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
The page will reload when you make changes.\ 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 may also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
### Analyzing the Bundle Size
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
### Making a Progressive Web App
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
### Advanced Configuration
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
### Deployment
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
### `npm run build` fails to minify
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

View File

@ -91,12 +91,12 @@ function App() {
conditionType: "evmBasic", conditionType: "evmBasic",
contractAddress: "", contractAddress: "",
standardContractType: "", standardContractType: "",
chain: "ethereum", chain: "mumbai",
method: "eth_getBalance", method: "",
parameters: [":userAddress", "latest"], parameters: [":userAddress"],
returnValueTest: { returnValueTest: {
comparator: ">=", comparator: "=",
value: "0", value: pkpEthAddress,
}, },
}, },
]; ];
@ -179,7 +179,7 @@ function App() {
<div style={{ height: 100 }} /> <div style={{ height: 100 }} />
<h3> <h3>
Step 1: log in with Google. You will mint a PKP and obtain a session Step 1: log in with Google. You will mint a PKP and obtain a session
sig. sig. Note: Your metamask must be switched to Mumbai.
</h3> </h3>
<GoogleLogin <GoogleLogin
onSuccess={handleLoggedInToGoogle} onSuccess={handleLoggedInToGoogle}