Skip to content

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

Open
@wkillerud

Description

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

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions