Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "integrity" to GET /map/<name>/<version> #584

Open
wkillerud opened this issue Aug 7, 2024 · 0 comments
Open

Add "integrity" to GET /map/<name>/<version> #584

wkillerud opened this issue Aug 7, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@wkillerud
Copy link
Contributor

Subresource integrity recently got added to importmap. Since Eik calculates the integrity hash of assets it would be nice to have it included alongside the "imports" key.

{
  "imports": {
    "square": "https://eik.store.com/npm/shapes/v1/square.js"
  },
  "integrity": {
    "https://eik.store.com/npm/shapes/v1/square.js": "sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
  }
}

The workaround with today's API is to:

  • iterate over all entries in "imports"
  • do a GET for the value of the import up to and including the version number/alias (https://eik.store.com/npm/shapes/v1, follow redirects)
  • iterate over that response's "files" to find the correct asset
  • use "integrity" from that entry in "files" to build the "integrity" map
@wkillerud wkillerud added the enhancement New feature or request label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant