Like <script>
and <link>
elements can specify integrity="hashAlgorithm-hash"
and like elements can specify nonce="string-specified-by-content-security-policy"
, ECMAScript modules should be able to leverage those authenticity mechanisms.
I propose the following syntax -
import * from "module" integrity "hashAlgorithm-hash" nonce "string-specified-by-content-security-policy"
Both, either and obviously neither of them can be specified.
import * from "module" integrity "hashAlgorithm-hash"
import * from "module" nonce "string-specified-by-content-security-policy"
Alternative syntax proposal -
import * from "module" #"hashAlgorithm-hash"
import * from "module" @"string-specified-by-content-security-policy"
Or anything else, basically.
It would be good to add this to the (draft) specification before modules ship in stable browser versions, so shipping modules already would already have this aspect included.