How to use the ssri.create function in ssri

To help you get started, we’ve selected a few ssri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imsnif / synp / util / integrity.js View on Github external
async getSha1Integrity (integrity, resolved, manifest) {
    // for yarn.lock backwards compatibility
    if (!/^sha1-/.test(integrity)) {
      const url = normalizeUrl(resolved)
      const file = await rp({
        url,
        encoding: null
      })
      const integrity = ssri.create({algorithms: ['sha1']}).update(file)
      return integrity.digest().toString()
    } else {
      return integrity
    }
  }
}

ssri

Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.

ISC
Latest version published 15 days ago

Package Health Score

92 / 100
Full package analysis