Skip to content

Instantly share code, notes, and snippets.

@ara4n
Last active December 6, 2016 22:49
Show Gist options
  • Save ara4n/e2eaa28ca93ebd9fde88feb4f0ba0fc5 to your computer and use it in GitHub Desktop.
Save ara4n/e2eaa28ca93ebd9fde88feb4f0ba0fc5 to your computer and use it in GitHub Desktop.
Backup & restore of E2E session data
// backup (tested in Chrome console...). N.B. this does *NOT ENCRYPT THE SESSION KEYS!*
Object.keys(window.localStorage).forEach(k=>{
if (k.match(/^session\.e2e\.sessions\/|^session\.e2e\.inboundgroupsessions\//)) localStorageCopy[k] = window.localStorage[k];
});
blob = new Blob([JSON.stringify(localStorageCopy, null, '\t')], { type: "text/plain;charset=utf-8" });
fetch('https://raw.githubusercontent.com/eligrey/FileSaver.js/master/FileSaver.js')
.then(response => response.text())
.then(text => { eval(text); saveAs(blob, "e2e-backup.json") });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment