I am using self-hosting and just logged in and got the tKey private key
const webStorageModule = tKey.modules['webStorage'] as WebStorageModule;
await webStorageModule.inputShareFromWebStorage();
const indexes = tKey.getCurrentShareIndexes();
const reconstructedKey = await tKey.reconstructKey();
After this,
- I just want to verify the reconstructedKey or reconstructedKey.privKey on the backend.
- I want to get the email from this private key
- I want to logout
Can anyone help me?
Originally posted by:
polartar Check the discussion at:
https://github.com/orgs/Web3Auth/discussions/541
Hey @talentdev2020
Thanks for trying out Web3Auth Self Host. Coming to your questions:
I just want to verify the reconstructedKey or reconstructedKey.privKey on the backend.
How do you want to verify the key, I'm not sure about the question. This is because the key is reconstructed on the frontend, and to be non custodial we do not have any direct way for you to verify key on the backend - it might mean storing it somewhere and then checking it. I might suggest checking the user's information from the service provider rather to verify them.
I want to get the email from this private key
You cannot get an email from the private key, but rather on login, you can check with the service provider about the user information. Our Custom Auth SDK is the base for Torus Service Provider, you can see that documentation to execute the user information function: https://github.com/torusresearch/customauth
Additionally, if you're using your own custom authentication, you can directly get the user details from the JWT id_token issued by the login provider.
I want to logout
You can directly trigger the logout function of your login provider from which you're using the custom authentication. I don't think you need a logout function from the Tkey SDK for this. The role of the tkey sdk is to generate/ reconstruct the key. All the login flows are directly handled by you with your login provider.
Originally posted by:
yashovardhan