I think it refers to the fact that you can create a new UserSession object directly and start using that within your code. Will let @zone117x chime in.
Thanks @moxiegirl I’m familiar with how the auth process generally works with the blockstack browser.
My question is more to do with how we can create a valid UserSession without having to open a browser. This would especially be usefull for writing automated unit tests.
This should be the minimum required code to create a UserSession instance that runs in Node.js, and can perform gaia file operations.
const appConfig = new AppConfig(
['store_write'],
'helloblockstack.com' /* your app origin */
)
const dataStore = new InstanceDataStore({
userData: {
appPrivateKey: '8a2c9a65...', /* A user's app private key */
hubUrl: 'https://hub.blockstack.org' /* A user's gaia hub server */
/* The rest of the properties can be null */
}
})
const userSession = new UserSession({
appConfig: appConfig,
sessionStore: dataStore
})
Note: InstanceDataStore is not exported to the top level module. Use import { InstanceDataStore } from 'blockstack/lib/auth/sessionStore'
Hey @zone117x. How were you able to import InstanceDataStore? I don’t see that exposed anywhere in the API. I do however see SessionDataStore in the documentation, but it does not seem to be exposed either, even though the documentation claims that it should be.