pub fn validate_key_format(provider_id: &str, key: &str) -> ValidationResultExpand description
Validate an API key format for a specific provider.
This performs format validation only (prefix, length). It does NOT make API calls to verify the key works.
ยงExample
use spn_core::{validate_key_format, ValidationResult};
// Valid Anthropic key
let result = validate_key_format("anthropic", "sk-ant-api03-xxxxx");
assert!(result.is_valid());
// Invalid prefix
let result = validate_key_format("anthropic", "sk-wrong-key");
assert!(matches!(result, ValidationResult::InvalidPrefix { .. }));
// Too short
let result = validate_key_format("anthropic", "short");
assert!(matches!(result, ValidationResult::TooShort { .. }));