Urgent.News

What's breaking now, across thousands of outlets.

Tech

Where to store private keys in your app

The safest place for a private key is somewhere your app can ask for a signature without ever reading the key. On a phone, that means the iOS Keychain or the Android Keystore. On a server, it means a key management service, a hardware security module, or a hosted signer. For a crypto wallet that your app controls, Lit Protocol keeps the key inside a secure enclave and runs your signing rule in…

Private keys should be stored securely in your application to prevent unauthorized access. The best storage options include app-specific secure hardware, like the iOS Keychain or Android Keystore on phones, and key management services, hardware security modules, or hosted signers on servers.

For a crypto wallet controlled by your app, consider using Lit Protocol, which keeps the key in a secure enclave and runs signing rules within the same enclave. Your server should hold an API key to request signatures, with no access to the actual private key.

Never store private keys in source code, even in private repositories, as Git history retains them. Avoid placing keys in frontend bundles or browser storage, as they can be easily accessed. Environment variables offer better security but still pose risks, such as being baked into container images, appearing in crash reports, and being read by other processes.

When a key must be in memory, store it in a secrets manager and load it when the process starts. Run signing code in a separate service to prevent the key from lingering in memory. Use a small balance for the wallet and replenish it from a separate offline wallet. Always have a plan for rotating keys before it becomes necessary.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

I Built a Meeting Notes App That Never Leaves Your Laptop

You know those meeting assistants that politely join your call as "Notetaker", record everyone, ship the audio off to some server and then send you a nice summary... and a monthly invoice?

  • Parla is a meeting notes app for Windows users
  • Operates entirely on user's computer, no cloud services
  • Free, open-source app with MIT license

More from Monday 16 November →