如何在Chrome扩展中存储源性数据清单V3
我正在研究用反应构建的Chrome扩展,该反应涉及加密钱包,我需要保留其钱包对象,因此每次关闭扩展并再次将其打开后,他们不必重新装修它。因此,我需要以某种方式牢固地存储用户的密码或钱包的助记符。
MetAmask使用持久的背景脚本来保持对象的活力,但这需要清单版本2,不再支持新的扩展名。
因此,有什么方法可以将字符串牢固地存储在清单版本3中的Chrome扩展名中? Chrome Storage和HTML5本地存储是无关的。
I'm working on a Chrome extension built with React that deals with crypto wallets, and I need to preserve their wallet object, so they don't have to decrypt it after every time they close the extension and open it again. So I need to store either the user's password or the wallet's mnemonic securely somehow.
Metamask uses a persistent background script to keep the object alive, but that requires manifest version 2, which is no longer supported for new extensions.
So is there any way to store a string securely in a Chrome extension in manifest version 3? Chrome storage and HTML5 local storage are no-gos.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
chrome.storage.session
,它是为此确切目的而创建的:将变量存储在内存中而不持续到磁盘上。API与任何其他 chrome.storage.storage API,因此数据必须是JSON--兼容:这些类型的字符串,数字,布尔值,null,数组/对象。
存储的最大容量当前为1MB。
清单:json:
Use
chrome.storage.session
, which is created for this exact purpose: to store variables in memory without persisting to the disk.The API is the same as any other chrome.storage API, so the data must be JSON-compatible: string, number, boolean, null, array/object of these types.
The maximum capacity of the storage is currently 1MB.
manifest.json: