如何在附近的 dApp 中存储 api 密钥

问题描述 投票:0回答:0

例如,我的应用程序使用 IPFS,我通过 web3.storage 访问它。但是要让 web3.storage 工作,你需要一个 api 令牌,我为此支付了费用。

如果一切都是开源的,把这个令牌存储在哪里?在前端,任何人都可以看到我的令牌并开始使用它。在智能合约中不可能处理大数据

文档说明如下:

function getAccessToken () {
  // If you're just testing, you can paste in a token
  // and uncomment the following line:
  // return 'paste-your-token-here'

  // In a real app, it's better to read an access token from an
  // environement variable or other configuration that's kept outside of
  // your code base. For this to work, you need to set the
  // WEB3STORAGE_TOKEN environment variable before you run your code.
  return process.env.WEB3STORAGE_TOKEN
}

但是任何人都可以轻松调试代码并找出这个令牌

rust smartcontracts ipfs nearprotocol web3
© www.soinside.com 2019 - 2024. All rights reserved.