ported google PKP signup to sveltekit

This commit is contained in:
Samuel Andert 2023-07-21 11:20:11 +02:00
parent 8d9980c59e
commit f11a208f56
6 changed files with 660 additions and 3 deletions

View File

@ -37,7 +37,9 @@
},
"type": "module",
"dependencies": {
"@lit-protocol/auth-helpers": "^2.2.45",
"@lit-protocol/constants": "^2.2.41",
"@lit-protocol/lit-auth-client": "^2.2.45",
"@lit-protocol/lit-node-client": "^2.2.41",
"@lit-protocol/pkp-client": "^2.2.41",
"@lit-protocol/pkp-ethers": "^2.2.41",

View File

@ -1,9 +1,15 @@
lockfileVersion: '6.0'
dependencies:
'@lit-protocol/auth-helpers':
specifier: ^2.2.45
version: 2.2.45(ethers@5.7.2)
'@lit-protocol/constants':
specifier: ^2.2.41
version: 2.2.41
'@lit-protocol/lit-auth-client':
specifier: ^2.2.45
version: 2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0)
'@lit-protocol/lit-node-client':
specifier: ^2.2.41
version: 2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0)
@ -985,6 +991,23 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/access-control-conditions@2.2.45:
resolution: {integrity: sha512-PS9FWIlhWAA4u4TF0Zat/pblQazZ6A42ndk3r5FBHlcTSGy0PEMeh4309OKbkrJ9YZ5BTB9eTXcMmJJBO+nNGQ==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/constants': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/auth-browser@2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0):
resolution: {integrity: sha512-/0DiWiVx3et+wNs26f0C0Bxmxz2Xtu34QkwCjRB54P+cJR2BFXYBobJgPoe8rJBVTOsZl7lD+kDaeV4lAXbLcQ==}
dependencies:
@ -1020,6 +1043,41 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/auth-browser@2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0):
resolution: {integrity: sha512-ViEYj9SibdqMm/UP427k/JgW9bGSMEldrCOLP4YSpM24v8SutQgtBQ83rKyg5wG3glVUVzQrC1yr8uCdVBOGjw==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/constants': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/misc-browser': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
'@walletconnect/ethereum-provider': 2.7.0(@web3modal/standalone@2.2.1)
'@web3modal/standalone': 2.2.1(react@18.2.0)
ethers: 5.7.2
lit-connect-modal-to-be-deprecated: 0.0.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
tweetnacl: 1.0.3
tweetnacl-util: 0.13.5
util: 0.12.5
web-vitals: 3.4.0
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- '@react-native-async-storage/async-storage'
- bufferutil
- debug
- encoding
- lokijs
- react
- utf-8-validate
dev: false
/@lit-protocol/auth-helpers@2.2.41(ethers@5.7.2):
resolution: {integrity: sha512-DwEd9jAJRZ1hHF401NLd7HnLjCw2GDtXUNMZGBalzSvLHKrPUPaG64WzYDrPPSkasH7WpoGxiiuP0HRNvMv8/Q==}
dependencies:
@ -1030,6 +1088,16 @@ packages:
- ethers
dev: false
/@lit-protocol/auth-helpers@2.2.45(ethers@5.7.2):
resolution: {integrity: sha512-RZcH5FCk9T+Y3VX3CStS1eCEj9GoJCe02jrpR0mNpmQ7BOiVnEZEHyYZ2pdLcCutRiHI2v5YsKt2nVvrHVOdVw==}
dependencies:
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- ethers
dev: false
/@lit-protocol/bls-sdk@2.2.41:
resolution: {integrity: sha512-X3myX6RLZdKXU9uHEqYbQwlHY5bVD7pdKKBXm7ShglFAqURo2ovW80EX9ELqkaCivGNC9Vkpa8Ua/w0dJvJNxw==}
dependencies:
@ -1037,6 +1105,13 @@ packages:
tslib: 2.6.0
dev: false
/@lit-protocol/bls-sdk@2.2.45:
resolution: {integrity: sha512-JKJdXeiRTf1JDPVfJkO8d8uuKyQgbAjzt9szLvY8FLXHkEiYujxkCLqWPH+tQ81jlmVDDOehTlocG6+HQ18HNQ==}
dependencies:
pako: 2.1.0
tslib: 2.6.0
dev: false
/@lit-protocol/constants@2.2.41:
resolution: {integrity: sha512-4roOsxZ6ocJiEbKTZPSpEi7RJW0JbnfmY96bA39jMdKVnxNUOqOrXgXMIPK2zlW6ba2MOkFIwHStcKwCv8om0g==}
dependencies:
@ -1051,6 +1126,20 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/constants@2.2.45:
resolution: {integrity: sha512-y0zgt6XzLUgckbJ7vbNG1bv7qFhzKqOFODbs/RLrlesY6YEWD0xxJoCUwdxS622E/nm21gKQ2wjiPgA+gYK1Mg==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/types': 2.2.45
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/core@2.2.41:
resolution: {integrity: sha512-SbxLheLftKJRCngNjy3dqfoVtoZxXrR+xDSJcFlNJq9ssgZVjKdrTf9LPvN8NizcwQ6cxP6rwR+AMAiilxtrLg==}
dependencies:
@ -1073,6 +1162,28 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/core@2.2.45:
resolution: {integrity: sha512-+zU9NdkSV2h3NYvHTIBmBkE/9KEpndT7MBxFMcBGFL60kexr9u6GVer6Dy8QBIj6VXZN+0chLRzCSBjwl2K7Aw==}
dependencies:
'@lit-protocol/access-control-conditions': 2.2.45
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.45
'@lit-protocol/constants': 2.2.45
'@lit-protocol/crypto': 2.2.45
'@lit-protocol/ecdsa-sdk': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/nacl': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/crypto@2.2.41:
resolution: {integrity: sha512-4JQ2TSwZ1r0DPu7lLZ9pajmd9DehsRAl8UIBTre7PWeWURBtY698V8ZXagpRRnsC4tlMNbAQu13sNevDBfpknA==}
dependencies:
@ -1093,12 +1204,38 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/crypto@2.2.45:
resolution: {integrity: sha512-S7XWXNsZPhhCNP6vWg8lZPMW6u4Vnou8/1fLYKktq60O52lZjmmi1mqCrBAF8M/wy0eVLvaQ7JuRAOz/KvGMEw==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.45
'@lit-protocol/constants': 2.2.45
'@lit-protocol/ecdsa-sdk': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/nacl': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/ecdsa-sdk@2.2.41:
resolution: {integrity: sha512-0uqdsSCGZlRqcVS5qyl/aby1WeBzTgoaqCJ0Dopb3I4DsEkkGGaMBFlazdnu94yowZDcgoPeQznu/oPXauVFbw==}
dependencies:
tslib: 2.6.0
dev: false
/@lit-protocol/ecdsa-sdk@2.2.45:
resolution: {integrity: sha512-0LXN3SJeslHDvyrLKnYUqV1nIz3g6eZrItJjy4YE1jIYMxoYYXQDQrWjio+DR6fn1/z9gbNfFKxdfHcE70PbYA==}
dependencies:
tslib: 2.6.0
dev: false
/@lit-protocol/encryption@2.2.41(node-fetch@2.6.12):
resolution: {integrity: sha512-ZL/uNKJ57c4H/HrZapq7jsBU57WVp7BemAWpM1vpAWmb9plL07jQIMkPQYLeOUEbIDTwLUfvkZkELtSBGHuLWQ==}
dependencies:
@ -1125,6 +1262,88 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/encryption@2.2.45(node-fetch@2.6.12):
resolution: {integrity: sha512-Zvpgr+7xwmr+0I+/YyBK9pCypDR2oMYF6LIwMR0TQJ2JQVTb5MevXRjtvMo9InJHxArtQaeUqSlqY9Nf7uB+zA==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.45
'@lit-protocol/constants': 2.2.45
'@lit-protocol/crypto': 2.2.45
'@lit-protocol/ecdsa-sdk': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/nacl': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
jszip: 3.10.1
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- encoding
- node-fetch
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/lit-auth-client@2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0):
resolution: {integrity: sha512-WX2L2i1Tv6t4ZvHobhZW4QuoaZ6ql09rIYVOqSPEcE1NW9m0r1L5voIsIGL8nseJJYY8kv05vNrHr3kDyuKcHQ==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@lit-protocol/access-control-conditions': 2.2.45
'@lit-protocol/auth-browser': 2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0)
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.45
'@lit-protocol/constants': 2.2.45
'@lit-protocol/core': 2.2.45
'@lit-protocol/crypto': 2.2.45
'@lit-protocol/ecdsa-sdk': 2.2.45
'@lit-protocol/encryption': 2.2.45(node-fetch@2.6.12)
'@lit-protocol/lit-node-client': 2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0)
'@lit-protocol/lit-node-client-nodejs': 2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
'@lit-protocol/lit-third-party-libs': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/misc-browser': 2.2.45
'@lit-protocol/nacl': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
'@simplewebauthn/browser': 7.2.0
'@simplewebauthn/typescript-types': 7.0.0
'@walletconnect/ethereum-provider': 2.7.0(@web3modal/standalone@2.4.3)
'@web3modal/standalone': 2.4.3(react@18.2.0)
base64url: 3.0.1
blockstore-core: 3.0.0
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
ipfs-unixfs-importer: 12.0.1
jszip: 3.10.1
lit-connect-modal-to-be-deprecated: 0.0.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
nanoid: 3.3.4
node-fetch: 2.6.12
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- '@react-native-async-storage/async-storage'
- bufferutil
- debug
- encoding
- lokijs
- react
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/lit-node-client-nodejs@2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0):
resolution: {integrity: sha512-teH2Q07qYuKerMInFLtkfOlIzy9roptBHElJPmVI8XFe1kFxkgIEO4X+sgZBKIfOYDVdM9f5UAFJSGBAN0gj2A==}
dependencies:
@ -1166,6 +1385,47 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/lit-node-client-nodejs@2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0):
resolution: {integrity: sha512-i8ISh6RK3Gs1jOL36GQBo3MUdeBCxOlykqH1wXlRg/rmlCAnIf0RGW6oNTct5MIEp+t/69DJvQXTQFx/eIBqUA==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@lit-protocol/access-control-conditions': 2.2.45
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.45
'@lit-protocol/constants': 2.2.45
'@lit-protocol/core': 2.2.45
'@lit-protocol/crypto': 2.2.45
'@lit-protocol/ecdsa-sdk': 2.2.45
'@lit-protocol/encryption': 2.2.45(node-fetch@2.6.12)
'@lit-protocol/lit-third-party-libs': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/misc-browser': 2.2.45
'@lit-protocol/nacl': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
blockstore-core: 3.0.0
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
ipfs-unixfs-importer: 12.0.1
jszip: 3.10.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
node-fetch: 2.6.12
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- bufferutil
- debug
- encoding
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/lit-node-client@2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0):
resolution: {integrity: sha512-Fyw3s3tpaqreep2M8X5CUuIac2WNbdZOxm8EdWvqLgt5OiODsJBPBfFAfW8l4kzmpGDHHxq5n99gVhtpDpDWiA==}
dependencies:
@ -1217,6 +1477,57 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/lit-node-client@2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0):
resolution: {integrity: sha512-gj/Oz1yyqYZcFqRN+HbAWYt7/Q1Hcvle1bKIhwy83pCCfirZB1MQQc559CFKIF0KeCi3pTF+e6j64EZWspf/eg==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@lit-protocol/access-control-conditions': 2.2.45
'@lit-protocol/auth-browser': 2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0)
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.45
'@lit-protocol/constants': 2.2.45
'@lit-protocol/core': 2.2.45
'@lit-protocol/crypto': 2.2.45
'@lit-protocol/ecdsa-sdk': 2.2.45
'@lit-protocol/encryption': 2.2.45(node-fetch@2.6.12)
'@lit-protocol/lit-node-client-nodejs': 2.2.45(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
'@lit-protocol/lit-third-party-libs': 2.2.45
'@lit-protocol/misc': 2.2.45
'@lit-protocol/misc-browser': 2.2.45
'@lit-protocol/nacl': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
'@walletconnect/ethereum-provider': 2.7.0(@web3modal/standalone@2.4.3)
'@web3modal/standalone': 2.4.3(react@18.2.0)
blockstore-core: 3.0.0
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
ipfs-unixfs-importer: 12.0.1
jszip: 3.10.1
lit-connect-modal-to-be-deprecated: 0.0.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
node-fetch: 2.6.12
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- '@react-native-async-storage/async-storage'
- bufferutil
- debug
- encoding
- lokijs
- react
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/lit-third-party-libs@2.2.41:
resolution: {integrity: sha512-OijwozVCxDtpAQF/5eZTKT2GPYWAja4BH96rOSiXv1cSm4PCo9Sspo5jcTA8BHBsIS3HiUbC7KmIrz6pLdaGAw==}
dependencies:
@ -1233,6 +1544,22 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/lit-third-party-libs@2.2.45:
resolution: {integrity: sha512-OaEY6p6pOOsghTxhhEkTGQiyYWt+GZzDX6PF7Vw2eqRWVAAaLJuABVrSWXs6ZAhe7Q7I96S411An+vvjaGYmdg==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
blockstore-core: 3.0.0
ipfs-unixfs-importer: 12.0.1
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- debug
- encoding
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/misc-browser@2.2.41:
resolution: {integrity: sha512-0KrhKRwsR8Neq2rAGrArTlGE325iWd9JqiL7aWm2wVEdATrAFK7rSbNKm/Nw90SWMxVEju+sl+zcQ3WbeY7PlQ==}
dependencies:
@ -1249,6 +1576,22 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/misc-browser@2.2.45:
resolution: {integrity: sha512-M4ZEIGBTy9N9iev0VLRap0qYQBWJ1IjJz9wtKcuhpQiCbS7wKk5yNxdxG3T6UGYo0cqORPrwwupu23O6zGNbuw==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/constants': 2.2.45
'@lit-protocol/types': 2.2.45
'@lit-protocol/uint8arrays': 2.2.45
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/misc@2.2.41:
resolution: {integrity: sha512-iOQkRBkgV7IofKuNtzjoStLZtUuljffcboD5LDZ5rp0a4aHwNggnQxabVqEZwR76hqPsPXA4HEwPS6cIzIiWDg==}
dependencies:
@ -1264,12 +1607,33 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/misc@2.2.45:
resolution: {integrity: sha512-OlSlPCKkxRwqwWXv3HwwRwD9xZjJeZRffT2Jp0ZY2HOO5pPmf/60Z/Bv1xfq45Cm3Nu/t0S0hn/7meGpDXt3Ag==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
'@lit-protocol/constants': 2.2.45
'@lit-protocol/types': 2.2.45
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/nacl@2.2.41:
resolution: {integrity: sha512-5tHj07iz6z6jV2wX4aXNbDps9EO0OuNJXiQXeoP+zyNbuylRi8COkD1JvZ/8BT7224D0M7Jg+pululZKie8g4g==}
dependencies:
tslib: 2.6.0
dev: false
/@lit-protocol/nacl@2.2.45:
resolution: {integrity: sha512-K84Q60jboNhvih+AIa1ju2SjjpzKx6uvyRPVirjPaMhedJx7RuQ/B6N312CgIkEbun1955AqI7V0E7+xMbZPxQ==}
dependencies:
tslib: 2.6.0
dev: false
/@lit-protocol/pkp-base@2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0):
resolution: {integrity: sha512-upHarDoR446fxkk+jFA7MLCx/O6pcN3t565+WFoXH/RbtwLLRx3SrMIkPn3xVy3JC1DdIoTuVycjxs7tE3wcuQ==}
dependencies:
@ -1569,12 +1933,31 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/types@2.2.45:
resolution: {integrity: sha512-cPJOMN1zPvTvFTQuCLAFcArzOJnM+RQSoAaDS7vxnJ68ZUfI29CO/qfrEHwPhkF5NoKfYzOJgz5zU9zTAmHvXQ==}
dependencies:
'@lit-protocol/auth-helpers': 2.2.45(ethers@5.7.2)
ethers: 5.7.2
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@lit-protocol/uint8arrays@2.2.41:
resolution: {integrity: sha512-RJA0xXh9ASgMAnduHpt7XtYet8N/ki/V5+kQNM6JJMGN9+GIdIKpiCKLP8PWgeR3Z8ZEkloq801B9nA61p+ecg==}
dependencies:
tslib: 2.6.0
dev: false
/@lit-protocol/uint8arrays@2.2.45:
resolution: {integrity: sha512-Yb2RadDPcBQMpGHAHMEiU1WSNPVuTQEuF+8jH6rAtbZs45qrcfGYyJAa5O2TVCr5TZIRgiygcJZUB8u+iYjR/w==}
dependencies:
tslib: 2.6.0
dev: false
/@lit/reactive-element@1.6.2:
resolution: {integrity: sha512-rDfl+QnCYjuIGf5xI2sVJWdYIi56CTCwWa+nidKYX6oIuBYwUbT/vX4qbUDlHiZKJ/3FRNQ/tWJui44p6/stSA==}
dependencies:
@ -1873,6 +2256,16 @@ packages:
'@scure/base': 1.1.1
dev: false
/@simplewebauthn/browser@7.2.0:
resolution: {integrity: sha512-HHIvRPpqKy0UV/BsGAmx4rQRZuZTUFYLLH65FwpSOslqHruiHx3Ql/bq7A75bjWuJ296a+4BIAq3+SPaII01TQ==}
dependencies:
'@simplewebauthn/typescript-types': 7.0.0
dev: false
/@simplewebauthn/typescript-types@7.0.0:
resolution: {integrity: sha512-bV+xACCFTsrLR/23ozHO06ZllHZaxC8LlI5YCo79GvU2BrN+rePDU2yXwZIYndNWcMQwRdndRdAhpafOh9AC/g==}
dev: false
/@sinclair/typebox@0.27.8:
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
dev: true
@ -3354,6 +3747,11 @@ packages:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
dev: false
/base64url@3.0.1:
resolution: {integrity: sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==}
engines: {node: '>=6.0.0'}
dev: false
/bech32@1.1.4:
resolution: {integrity: sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==}
dev: false
@ -5324,6 +5722,12 @@ packages:
thenify-all: 1.6.0
dev: true
/nanoid@3.3.4:
resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
dev: false
/nanoid@3.3.6:
resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}

View File

@ -8,7 +8,12 @@
</head>
<script>
// Fix `global is not defined` error
global = window
global = window;
window.process = {
env: {
NODE_ENV: 'development'
}
}
</script>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>

239
src/lib/GoogleAuth.svelte Normal file
View File

@ -0,0 +1,239 @@
<script lang="ts">
import { onMount, tick } from 'svelte';
import {
LitAuthClient,
BaseProvider,
GoogleProvider,
isSignInRedirect,
getProviderFromUrl
} from '@lit-protocol/lit-auth-client';
import { LitNodeClient } from '@lit-protocol/lit-node-client';
import { IRelayPKP, AuthMethod, SessionSigs } from '@lit-protocol/types';
import { ProviderType } from '@lit-protocol/constants';
import { LitAccessControlConditionResource, LitAbility } from '@lit-protocol/auth-helpers';
const redirectUri = 'http://localhost:5173/';
let view = 'sign_in';
let error;
let litAuthClient;
let litNodeClient;
let currentProviderType;
let authMethod;
let pkps = [];
let currentPKP;
let sessionSigs;
let isLoading = false;
async function authWithGoogle() {
isLoading = true;
error = null;
try {
console.log('Starting authentication with Google...');
const provider = litAuthClient.initProvider<GoogleProvider>(ProviderType.Google);
await provider.signIn();
console.log('Handling Google authentication...');
await handleRedirect(ProviderType.Google);
} catch (err) {
console.error(err);
error = err;
view = 'ERROR';
} finally {
isLoading = false;
}
}
async function handleRedirect(providerName: string) {
isLoading = true;
try {
console.log('Handling redirect...');
let provider: BaseProvider | undefined;
if (providerName === ProviderType.Google) {
provider = litAuthClient.getProvider(ProviderType.Google);
}
if (!provider) {
throw new Error('Invalid provider.');
}
currentProviderType = providerName as ProviderType;
// Get auth method object that has the OAuth token from redirect callback
authMethod = await provider.authenticate();
await tick(); // Allow Svelte to update the view
// Fetch PKPs associated with social account
view = 'fetching';
const fetchedPkps: IRelayPKP[] = await provider.fetchPKPsThroughRelayer(authMethod);
await tick(); // Allow Svelte to update the view
if (fetchedPkps.length > 0) {
pkps = fetchedPkps;
view = 'fetched';
} else {
view = 'NO_PKPS';
}
} catch (err) {
console.error(err);
error = err;
view = 'ERROR';
} finally {
isLoading = false;
}
console.log(`Handling redirect for ${providerName}`);
console.log(`Fetched PKPs: ${pkps.length}`);
}
async function mint() {
isLoading = true;
error = null;
try {
console.log('Minting started...');
view = 'MINTING';
const provider = litAuthClient.getProvider(currentProviderType);
const txHash: string = await provider.mintPKPThroughRelayer(authMethod);
const response = await provider.relay.pollRequestUntilTerminalState(txHash);
if (response.status !== 'Succeeded') {
throw new Error('Minting failed');
}
const newPKP: IRelayPKP = {
tokenId: response.pkpTokenId,
publicKey: response.pkpPublicKey,
ethAddress: response.pkpEthAddress
};
pkps = [...pkps, newPKP];
await createSession(newPKP); // Moved the call to createSession() here
view = 'MINTED'; // Update the view after the session is created
} catch (err) {
console.error(err);
error = err;
view = 'ERROR';
} finally {
isLoading = false;
}
console.log('Minted a new PKP.');
}
async function createSession(pkp: IRelayPKP) {
isLoading = true;
error = null;
try {
console.log('Creating session...');
view = 'CREATING_SESSION';
const litResource = new LitAccessControlConditionResource('*');
const provider = litAuthClient.getProvider(currentProviderType);
sessionSigs = await provider.getSessionSigs({
pkpPublicKey: pkp.publicKey,
authMethod,
sessionSigsParams: {
chain: 'ethereum',
resourceAbilityRequests: [
{
resource: litResource,
ability: LitAbility.PKPSigning
}
]
}
});
currentPKP = pkp;
view = 'SESSION_CREATED';
} catch (err) {
console.error(err);
error = err;
view = 'ERROR';
} finally {
isLoading = false;
}
console.log('Session created.');
view = 'SESSION_CREATED';
}
onMount(async () => {
isLoading = true;
console.log('Component mounted.');
try {
litNodeClient = new LitNodeClient({
litNetwork: 'serrano',
debug: false
});
await litNodeClient.connect();
litAuthClient = new LitAuthClient({
litRelayConfig: {
relayApiKey: 'test-api-key'
},
litNodeClient
});
litAuthClient.initProvider<GoogleProvider>(ProviderType.Google);
console.log('Checking if isSignInRedirect...');
if (!authMethod && isSignInRedirect(redirectUri)) {
console.log('Redirect detected, handling...');
const providerName = getProviderFromUrl();
if (providerName) {
await handleRedirect(providerName);
} else {
console.error('No provider detected in the URL.');
}
} else {
console.log('No redirect detected.');
}
} catch (err) {
console.error(err);
error = err;
view = 'ERROR';
} finally {
isLoading = false;
}
});
function resetView() {
view = authMethod ? 'fetched' : 'sign_in';
error = null;
}
</script>
<main>
{#if error}
<h1>Error</h1>
<p>{error.message}</p>
<button on:click={() => resetView()}>Got it</button>
{:else if isLoading}
<h1>Loading...</h1>
{:else if view === 'sign_in'}
<h1>Sign in with Lit</h1>
<button on:click={authWithGoogle}>Google</button>
{:else if view === 'HANDLE_REDIRECT'}
<h1>Handling Google Authentication...</h1>
{:else if view === 'fetching'}
<h1>Fetching your PKPs...</h1>
{:else if view === 'NO_PKPS'}
<h1>No PKPs found.</h1>
<button on:click={mint}>Mint a PKP</button>
{:else if view === 'fetched'}
<h1>Select a PKP to continue</h1>
<div>
{#each pkps as pkp}
<button on:click={async () => await createSession(pkp)}>
{pkp.ethAddress}
</button>
{/each}
</div>
{:else if view === 'MINTING'}
<h1>Minting your PKP...</h1>
{:else if view === 'MINTED'}
<h1>Minted!</h1>
{:else if view === 'CREATING_SESSION'}
<h1>Creating session...</h1>
{:else if view === 'SESSION_CREATED'}
<h1>Ready for the open web</h1>
<div>
<p>Check out your PKP:</p>
<p>{currentPKP.ethAddress}</p>
</div>
{/if}
</main>

View File

@ -5,6 +5,7 @@
import Send from '$lib/Send.svelte';
import Balance from '$lib/Balance.svelte';
import WalletConnect from '$lib/WalletConnect.svelte';
import GoogleAuth from '$lib/GoogleAuth.svelte';
let pkpWallet;
let authSig;
let pkpPubKey =
@ -14,10 +15,11 @@
<LitStatus />
<AuthSign />
<div class="p-4 bg-gray-200 flex justify-center items-center flex-col">
<!-- <div class="p-4 bg-gray-200 flex justify-center items-center flex-col">
<Wallet bind:pkpWallet bind:authSig />
<Send bind:pkpWallet />
<Balance />
<WalletConnect bind:pkpWallet bind:authSig bind:pkpPubKey />
</div>
</div> -->
<GoogleAuth />

View File

@ -0,0 +1,5 @@
<script>
import GoogleAuth from '$lib/GoogleAuth.svelte';
</script>
<GoogleAuth />