How to get session object from Self.id?

Hi!
I would like to save did-session to localStorage while using Self.ID SDK. Is there any way to do this? I can authorize with webClientSession using useViewerConnection , but I don’t know how to get the session object from SelfID object, so I can’t record it into localStorage as described in this article. DID Session - Ceramic Developers

Hey, @kantaro.eth :).

As of now, it’s not possible to get did-session from Self.ID SDK. We’re looking into adding this possibility, but we don’t have the timeline yet. We will know more in a couple of weeks :).

In the latest release of @self.id/framework@0.3.3 you can now access the session and then manage it as described in docs you mentioned and pass it when connecting/auth.

For example with self.id framework

...
const [connection, connect, disconnect] = useViewerConnection()
...
// get session string you serialized and stored before, manages as needed, check if still valid (or how much longer)
const sessionStr = ...
const selfid = await connect(new EthereumAuthProvider(window.ethereum, accounts[0]), sessionStr)
...
// get session to serialize and store 
const session = selfid.client.session //or connection.selfID.client.session
session.serialize()
...