Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: adding protect keys faq #1044

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

docs: adding protect keys faq #1044

wants to merge 5 commits into from

Conversation

avarobinson
Copy link
Collaborator

@avarobinson avarobinson commented Oct 10, 2024

Pull Request Checklist


PR-Codex overview

This PR adds a new section to the faqs.mdx file addressing the protection of API keys and Policy IDs in frontend applications. It emphasizes the importance of safeguarding these credentials and provides recommendations for securing them through backend routing and proxy servers.

Detailed summary

  • Added a new section titled "How should I protect my api key and policy id in the frontend?"
  • Explained the importance of protecting API keys and Policy IDs to prevent unauthorized use.
  • Recommended moving API keys to the backend using a proxy.
  • Provided a link to an example of setting up a transport to a backend RPC URL.
  • Discussed methods for protecting Policy IDs using a proxy server.
  • Suggested implementing custom rules on the proxy server to limit gas sponsorship requests.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Oct 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 9:29pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 9:29pm


Protecting your Policy ID requires some custom work, but it’s similar to safeguarding any key on the backend. One solution is to use a proxy server that holds both the API key and Policy ID. In the frontend, when creating an Alchemy client, pass the proxy server URL as the RPC URL instead of a public Alchemy URL.

Additionally, you'll need to implement custom code on your proxy server to limit gas sponsorship requests. This could include rules that make sense for your app, such as limiting gas fees, restricting certain contract or method calls, or implementing limits based on IP addresses or CAPTCHA verification.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have an example we can link people to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an old example from worth of words but might be more confusing than helpful since it's outdated versions. Wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with Ava that it doesn't make sense to link a code sample from an older version. I don't think we have a sample at the moment, but maybe when I get some time I'll update Worth of Words to use UI Components and then we can link it.

dphilipson
dphilipson previously approved these changes Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants