diff --git a/package.json b/package.json index afff676..8d27d9b 100644 --- a/package.json +++ b/package.json @@ -5,21 +5,24 @@ "dependencies": { "@emotion/react": "^11.10.5", "@emotion/styled": "^11.10.5", + "@lit-protocol/access-control-conditions": "2.1.17", + "@lit-protocol/bls-sdk": "2.1.17", + "@lit-protocol/constants": "2.1.17", + "@lit-protocol/crypto": "2.1.17", + "@lit-protocol/lit-node-client": "2.1.17", "@mui/material": "^5.10.16", "@react-oauth/google": "^0.4.0", "@simplewebauthn/browser": "^6.2.2", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", - "@types/jest": "24.0.17", - "@types/node": "12.6.9", - "@types/react": "16.8.24", - "@types/react-dom": "16.8.5", - "@types/react-router-dom": "^4.3.4", + "@types/jest": "^29.4.0", + "@types/node": "^18.11.19", + "@types/react": "^18.0.27", + "@types/react-dom": "^18.0.10", "base64url": "^3.0.1", "ethers": "^5.7.2", "js-base64": "^3.7.2", - "lit-js-sdk": "^1.2.37", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", diff --git a/src/App.js b/src/App.tsx similarity index 70% rename from src/App.js rename to src/App.tsx index 4892ae3..6624da6 100644 --- a/src/App.js +++ b/src/App.tsx @@ -1,40 +1,53 @@ +import * as LitJsSdk_accessControlConditions from "@lit-protocol/access-control-conditions"; +import * as LitJsSdk_blsSdk from "@lit-protocol/bls-sdk"; +import { AccsDefaultParams } from "@lit-protocol/constants"; +import * as LitJsSdk from "@lit-protocol/lit-node-client"; +import { Button, ButtonGroup } from "@mui/material"; import { GoogleLogin } from "@react-oauth/google"; -import { ethers, utils } from "ethers"; -import LitJsSdk from "lit-js-sdk"; +import { + startAuthentication, + startRegistration, +} from "@simplewebauthn/browser"; +import base64url from "base64url"; +import { utils } from "ethers"; +import { hexlify } from "ethers/lib/utils"; import { useState } from "react"; import "./App.css"; -import { ButtonGroup, Button } from "@mui/material"; -import base64url from "base64url"; -import { - startRegistration, - startAuthentication, -} from "@simplewebauthn/browser"; -import { parseAuthenticatorData } from "./utils/parseAuthenticatorData"; import { decodeAttestationObject } from "./utils/decodeAttestationObject"; -import { hexlify } from "ethers/lib/utils"; +import { parseAuthenticatorData } from "./utils/parseAuthenticatorData"; -window.LitJsSdk = LitJsSdk; -window.ethers = ethers; +type CredentialResponse = any; + +declare global { + interface Window { + cbor: any; + } +} const RELAY_API_URL = process.env.REACT_APP_RELAY_API_URL || "http://localhost:3001"; function App() { - const [pkpEthAddress, setPkpEthAddress] = useState(null); - const [googleCredentialResponse, setGoogleCredentialResponse] = useState( - null - ); - const [pkpPublicKey, setPkpPublicKey] = useState(null); + const [pkpEthAddress, setPkpEthAddress] = useState(""); + const [ + googleCredentialResponse, + setGoogleCredentialResponse, + ] = useState(null); + const [pkpPublicKey, setPkpPublicKey] = useState(""); const [status, setStatus] = useState(""); const [selectedAuthMethod, setSelectedAuthMethod] = useState(6); const [ webAuthnCredentialPublicKey, setWebAuthnCredentialPublicKey, - ] = useState(); - const [webAuthnSignature, setWebAuthnSignature] = useState(); - const [webAuthnSignatureBase, setWebAuthnSignatureBase] = useState(); + ] = useState(""); + const [webAuthnSignature, setWebAuthnSignature] = useState(""); + const [webAuthnSignatureBase, setWebAuthnSignatureBase] = useState( + "" + ); - const handleLoggedInToGoogle = async credentialResponse => { + const handleLoggedInToGoogle = async ( + credentialResponse: CredentialResponse + ) => { setStatus("Logged in to Google"); console.log("Got response from google sign in: ", { credentialResponse, @@ -98,8 +111,11 @@ function App() {
PKP Eth Address: {pkpEthAddress}
)}

- Step 2: Use Lit Network to obtain a session sig and then - store an encryption condition. + + Step 2: Use Lit Network to obtain a session sig and + then store an encryption condition. + + (Session Sigs do not work currently.)

- Step 3: Use Lit Network to obtain a session sig and then - store an encryption condition. + + Step 3: Use Lit Network to obtain a session sig and + then store an encryption condition. + + (Session Sigs do not work currently.)