Merge #11854: Split up key and script metadata for better type safety