pub fn load_private_key(
key_data: Option<&str>,
) -> Result<SigningKey, CryptoError>Expand description
Loads the private key from provided data or environment variable
This function attempts to load the private key in the following order:
- If
key_datais provided, try to parse it (for production/Cloudflare Secrets Store) - Fall back to IRONSHIELD_PRIVATE_KEY environment variable (for local testing)
The key can be in either format:
- Base64-encoded PGP private key (without armor headers)
- Raw base64-encoded Ed25519 private key (32 bytes, legacy format)
§Arguments
key_data: Optional key data string (for Cloudflare Workers/production)
§Returns
Result<SigningKey, CryptoError>: The Ed25519 signing key or an error
§Environment Variables
IRONSHIELD_PRIVATE_KEY: Fallback env var for local testing