I have noticed that blockstack.js executes encryption in the foreground which is causing the UI to hang if you are passing it larger files. Is there any chance to use e.g. userSession.encryptContent from within a web worker?
Thanks for the hint. A minimal setup of a worker can look something like this:
importScripts('blockstack.min.js')
const sessionStore = {
data: {},
getSessionData() { return this.data },
setSessionData(data) { this.data = data },
deleteSessionData() { this.data = {} },
}
const userSession = new blockstack.UserSession({
appConfig: new blockstack.AppConfig({ /* ... */ }),
sessionStore,
})
// ... and then given that you have a buffer and a key available in your worker:
userSession.decryptContent(aBuffer, { privateKey })