Session Management In react native

  • 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.

okay, but can you redirect me to any docs/ example apps where this is used @vjgee ?

also, here it is mentioned that " EncryptedStorage implementation to allow for session management without storing the private key on the device."

but what you just said seems to contradict this point @vjgee

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.

thanks!
also, @maharshi how do I know what exactly is stored, and , how do I get it?

1 Like

@maharshi pinging you again icymi

1 Like

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.

1 Like

alright, i understood this @maharshi
but can you tell me,

  1. how can i GET the encrypted private key from expo-secure-store???
  2. if i can’t, then how do I know that a session is still going on?
1 Like

@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.