TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to Store Session Tokens in a Browser (and the Impacts of Each)

4 点作者 pedro84超过 4 年前

1 comment

franky47超过 4 年前
Another interesting approach is the one used in ProtonMail, using the SessionVars trick by Thomas Frank.<p>It combines in-memory storage for XSS safety, and a combination of SessionStorage and `window.name` to split the token into secret random parts, each taking its separate channel, to ensure the token survives a page reload.<p>I wrote about the details on how it works [1] and packed a TypeScript implementation on NPM [2].<p>[1] <a href="https:&#x2F;&#x2F;francoisbest.com&#x2F;posts&#x2F;2019&#x2F;how-to-store-e2ee-keys-in-the-browser" rel="nofollow">https:&#x2F;&#x2F;francoisbest.com&#x2F;posts&#x2F;2019&#x2F;how-to-store-e2ee-keys-i...</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;47ng&#x2F;session-keystore" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;47ng&#x2F;session-keystore</a>