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 (
diff --git a/yalc.lock b/yalc.lock new file mode 100644 index 0000000..5b48257 --- /dev/null +++ b/yalc.lock @@ -0,0 +1,10 @@ +{ + "version": "v1", + "packages": { + "lit-js-sdk": { + "signature": "24bc7659933f393b3330aee609498caf", + "file": true, + "replaced": "^1.1.234" + } + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index a4dfde5..5f06325 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6884,10 +6884,8 @@ lit-connect-modal@^0.1.10: dependencies: micromodal "^0.4.10" -lit-js-sdk@^1.1.234: - version "1.1.234" - resolved "https://registry.yarnpkg.com/lit-js-sdk/-/lit-js-sdk-1.1.234.tgz#1bdd9985b09078e816fe242930d98e618e8f76e5" - integrity sha512-jriua+Igavu5kbGYxMuUxmNrd4TfMXGNoG3hNoBA0+FyTYvYo9assYegWkP8w8vTW2FGC5qJDhNvFf0pOAfgWQ== +"lit-js-sdk@file:.yalc/lit-js-sdk": + version "1.2.25" dependencies: "@ethersproject/bytes" "^5.5.0" "@ethersproject/contracts" "^5.2.0"