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