This topic was originally posted by abhishek on 8/11/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.
SDK Version: 4.0.0
Expo or Bare Version: 48.0.18
How to do session management in the react-native sdk?
I couldn’t find any docs or example apps highlighting the same. Could you please help me with this?
@abhishek The idea behind session management is to use a session id which encrypts your private key. This session id can be stored easily in the local storage and have some timeout set in the backend. Encrypted private key sits in the backend.
My apologies! The explanation was for Tkey React Native.
We have a new version of the react native SDK, where there will be session management support. This means that the key reconstruction will not be needed for a maximum of 7 days after the login has happened.
I will check with our Dev team and get back to you.
@abhishek I’ll paste the link for the SDK reference here. The 7th parameter from top is sessionTime in SdkInitParams which will be useful for you. Try switching between the table and the type reference for better understanding.
The idea behind session management is to use a session id which encrypts your private key. This session id can be stored easily in the local storage and have some timeout set in the backend. Encrypted private key sits in the backend. Encrypted private key being the highlight here. But all of this done for you in the plug n Play SDK so you needn’t worry. You’ll find sessionTime with our PnP and Corekit-SFA SDKs.
@abhishek I think you should have a look at our expo example here. In our example we check if a user is logged in by the web3auth instance and the web3auth.privKey.
You can also get the private key via web3auth.privKey.