diff options
Diffstat (limited to 'deps/npm/node_modules/ssri/index.js')
-rw-r--r-- | deps/npm/node_modules/ssri/index.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/deps/npm/node_modules/ssri/index.js b/deps/npm/node_modules/ssri/index.js index f01986fa51..6ec0d73df6 100644 --- a/deps/npm/node_modules/ssri/index.js +++ b/deps/npm/node_modules/ssri/index.js @@ -1,5 +1,7 @@ 'use strict' +const Buffer = require('safe-buffer').Buffer + const crypto = require('crypto') const Transform = require('stream').Transform @@ -31,7 +33,7 @@ class Hash { this.options = rawOpts ? rawOpts.slice(1).split('?') : [] } hexDigest () { - return this.digest && bufFrom(this.digest, 'base64').toString('hex') + return this.digest && Buffer.from(this.digest, 'base64').toString('hex') } toJSON () { return this.toString() @@ -154,7 +156,7 @@ function fromHex (hexDigest, algorithm, opts) { : '' return parse( `${algorithm}-${ - bufFrom(hexDigest, 'hex').toString('base64') + Buffer.from(hexDigest, 'hex').toString('base64') }${optString}`, opts ) } @@ -257,6 +259,7 @@ function integrityStream (opts) { const match = ( // Integrity verification mode opts.integrity && + newSri[algorithm] && digests && digests.find(hash => { return newSri[algorithm].find(newhash => { @@ -332,7 +335,3 @@ function getPrioritizedHash (algo1, algo2) { ? algo1 : algo2 } - -function bufFrom (data, enc) { - return Buffer.from ? Buffer.from(data, enc) : new Buffer(data, enc) -} |