diff --git a/.gitignore b/.gitignore index 4d29575..9d7ef65 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +.yalc diff --git a/package.json b/package.json index 39cfd99..fc08ba2 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@testing-library/user-event": "^13.5.0", "ethers": "^5.7.2", "js-base64": "^3.7.2", - "lit-js-sdk": "^1.1.234", + "lit-js-sdk": "file:.yalc/lit-js-sdk", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", diff --git a/src/App.js b/src/App.js index 687df35..332d963 100644 --- a/src/App.js +++ b/src/App.js @@ -3,6 +3,7 @@ import "./App.css"; import { GoogleLogin } from "@react-oauth/google"; import { ethers } from "ethers"; import { Base64 } from "js-base64"; +import LitJsSdk from "lit-js-sdk"; import PKPHelper from "./abis/PKPHelper.json"; import PKPNFT from "./abis/PKPNFT.json"; @@ -61,11 +62,27 @@ function App() { console.log("mintingReceipt: ", mintingReceipt); const tokenIdFromEvent = mintingReceipt.events[2].topics[3]; const ethAddress = await pkpContract.getEthAddress(tokenIdFromEvent); - console.log("minted PKP with eth address: ", ethAddress); setPkpEthAddress(ethAddress); + console.log("minted PKP with eth address: ", ethAddress); + const pkpPublicKey = await pkpContract.getPubkey(tokenIdFromEvent); + // get the user a session with it - const fakeSessionKey = "0x1234567890"; + const litNodeClient = new LitJsSdk.LitNodeClient(); + await litNodeClient.connect(); + + const fakeSessionKey = "lit:session:0x1234567890"; + const sessionSig = await litNodeClient.signSessionKey({ + sessionKey: fakeSessionKey, + authMethods: [ + { + authMethodType: 6, + accessToken: credentialResponse.credential, + }, + ], + pkpPublicKey, + }); + console.log("sessionSig: ", sessionSig); }; return (