Yup, this is basically what TrustedTypes is for!