in src/utils/eif_signer.rs [54:70]
fn parse_kms_arn(s: &str) -> Option<(String, String)> {
// Matches KMS key ARNs in the format:
// arn:partition:kms:region:account-id:key[/|:]key-id where:
// - partition is: aws, aws-cn, or aws-us-gov
// - region is captured: letters, numbers, hyphens
// - account-id: exactly 12 digits
// - key-id is captured: letters, numbers, hyphens
let re = Regex::new(
r"^arn:(?:aws|aws-cn|aws-us-gov):kms:([a-z0-9-]+):\d{12}:key[:/]([a-zA-Z0-9-]+)$",
)
.expect("Regular expression for parsing ARNs must be valid");
re.captures(s).map(|caps| {
// Safe to use index access since we know the pattern has exactly 2 capture groups
(caps[1].to_string(), caps[2].to_string())
})
}