diff --git a/.travis.yml b/.travis.yml index 9f2bbd7..5345ac4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,15 +4,17 @@ before_install: - npm install npm -g node_js: - "6" - - "7" - "8" - - "9" - "10" + - "12" + - "14" + - lts/* + - current matrix: include: - - node_js: "8" + - node_js: "12" env: TEST_SUITE=coverage - - node_js: "8" + - node_js: "12" env: TEST_SUITE=lint env: - TEST_SUITE=test diff --git a/lib/async.js b/lib/async.js index 085142b..8383224 100644 --- a/lib/async.js +++ b/lib/async.js @@ -6,15 +6,15 @@ var Buffer = require('safe-buffer').Buffer var ZERO_BUF var subtle = global.crypto && global.crypto.subtle var toBrowser = { - 'sha': 'SHA-1', + sha: 'SHA-1', 'sha-1': 'SHA-1', - 'sha1': 'SHA-1', - 'sha256': 'SHA-256', + sha1: 'SHA-1', + sha256: 'SHA-256', 'sha-256': 'SHA-256', - 'sha384': 'SHA-384', + sha384: 'SHA-384', 'sha-384': 'SHA-384', 'sha-512': 'SHA-512', - 'sha512': 'SHA-512' + sha512: 'SHA-512' } var checks = [] function checkNative (algo) { diff --git a/lib/default-encoding.js b/lib/default-encoding.js index 420ffd1..4404fd2 100644 --- a/lib/default-encoding.js +++ b/lib/default-encoding.js @@ -9,4 +9,4 @@ if (process.browser) { } else { defaultEncoding = 'utf-8' } -module.exports = defaultEncoding \ No newline at end of file +module.exports = defaultEncoding diff --git a/test/index.js b/test/index.js index b565310..04c8be1 100644 --- a/test/index.js +++ b/test/index.js @@ -10,68 +10,68 @@ var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) /* istanbul ignore next */ if (pVersionMajor !== 4 || process.browser) { fixtures.invalid.push({ - 'key': 'password', - 'salt': 'salt', - 'iterations': 1, - 'dkLen': -1, - 'exception': 'Bad key length' + key: 'password', + salt: 'salt', + iterations: 1, + dkLen: -1, + exception: 'Bad key length' }, { - 'key': 'password', - 'salt': 'salt', - 'iterations': 1, - 'dkLen': 4073741824, - 'exception': 'Bad key length' + key: 'password', + salt: 'salt', + iterations: 1, + dkLen: 4073741824, + exception: 'Bad key length' }) } /* istanbul ignore next */ if (pVersionMajor >= 5 || process.browser) { fixtures.invalid.push({ - 'key': 'password', - 'salt': 'salt', - 'iterations': 1, - 'dkLen': NaN, - 'exception': 'Bad key length' + key: 'password', + salt: 'salt', + iterations: 1, + dkLen: NaN, + exception: 'Bad key length' }, { - 'key': 'password', - 'salt': 'salt', - 'iterations': 1, - 'dkLen': Infinity, - 'exception': 'Bad key length' + key: 'password', + salt: 'salt', + iterations: 1, + dkLen: Infinity, + exception: 'Bad key length' }) } /* istanbul ignore next */ if (pVersionMajor >= 6 || process.browser) { fixtures.valid.push({ - 'description': 'Unicode salt, no truncation', - 'key': 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', - 'salt': 'mnemonicメートルガバヴァぱばぐゞちぢ十人十色', - 'iterations': 2048, - 'dkLen': 64, - 'results': { - 'sha1': '7e042a2f41ba17e2235fbc794e22a150816b0f54a1dfe113919fccb7a056066a109385e538f183c92bad896ae8b7d8e0f4cd66df359c77c8c7785cd1001c9a2c', - 'sha256': '0b57118f2b6b079d9371c94da3a8315c3ada87a1e819b40c4c4e90b36ff2d3c8fd7555538b5119ac4d3da7844aa4259d92f9dd2188e78ac33c4b08d8e6b5964b', - 'sha512': 'ba553eedefe76e67e2602dc20184c564010859faada929a090dd2c57aacb204ceefd15404ab50ef3e8dbeae5195aeae64b0def4d2eead1cdc728a33ced520ffd', - 'sha224': 'd76474c525616ce2a527d23df8d6f6fcc4251cc3535cae4e955810a51ead1ec6acbe9c9619187ca5a3c4fd636de5b5fe58d031714731290bbc081dbf0fcb8fc1', - 'sha384': '15010450f456769467e834db7fa93dd9d353e8bb733b63b0621090f96599ac3316908eb64ac9366094f0787cd4bfb2fea25be41dc271a19309710db6144f9b34', - 'ripemd160': '255321c22a32f41ed925032043e01afe9cacf05470c6506621782c9d768df03c74cb3fe14a4296feba4c2825e736486fb3871e948f9c413ca006cc20b7ff6d37' + description: 'Unicode salt, no truncation', + key: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + salt: 'mnemonicメートルガバヴァぱばぐゞちぢ十人十色', + iterations: 2048, + dkLen: 64, + results: { + sha1: '7e042a2f41ba17e2235fbc794e22a150816b0f54a1dfe113919fccb7a056066a109385e538f183c92bad896ae8b7d8e0f4cd66df359c77c8c7785cd1001c9a2c', + sha256: '0b57118f2b6b079d9371c94da3a8315c3ada87a1e819b40c4c4e90b36ff2d3c8fd7555538b5119ac4d3da7844aa4259d92f9dd2188e78ac33c4b08d8e6b5964b', + sha512: 'ba553eedefe76e67e2602dc20184c564010859faada929a090dd2c57aacb204ceefd15404ab50ef3e8dbeae5195aeae64b0def4d2eead1cdc728a33ced520ffd', + sha224: 'd76474c525616ce2a527d23df8d6f6fcc4251cc3535cae4e955810a51ead1ec6acbe9c9619187ca5a3c4fd636de5b5fe58d031714731290bbc081dbf0fcb8fc1', + sha384: '15010450f456769467e834db7fa93dd9d353e8bb733b63b0621090f96599ac3316908eb64ac9366094f0787cd4bfb2fea25be41dc271a19309710db6144f9b34', + ripemd160: '255321c22a32f41ed925032043e01afe9cacf05470c6506621782c9d768df03c74cb3fe14a4296feba4c2825e736486fb3871e948f9c413ca006cc20b7ff6d37' } }) // 'binary' behaviour, Node 6 defaulted to 'utf-8' } else { fixtures.valid.push({ - 'description': 'Unicode salt, suffers from truncation', - 'key': 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', - 'salt': 'mnemonicメートルガバヴァぱばぐゞちぢ十人十色', - 'iterations': 2048, - 'dkLen': 64, - 'results': { - 'sha1': 'd85d14adcb7bdb5d976160e504f520a98cf71aca4cd5fceadf37759743bd6e1d2ff78bdd4403552aef7658094384b341ede80fffd334182be076f9d988a0a40f', - 'sha256': 'b86b5b900c29ed2724359afd793e10ffc1eb0e7d6f624fc9c85b8ac1785d9a2f0575af52a2338e611f2e6cffdee544adfff6f3d4f43be2ba0e2bd7e917b38a14', - 'sha512': '3a863fa00f2e97a83fa9b18805e0047a6282cbae0ff48438b33a14475771c52d05137daa12e364cb34d84547ac07568b801c5c7f8dd4baaeee18a67a5c6a3377', - 'sha224': '95727793842437774ad9ae27b8154a6f37f208b75a03d3a4d4a2443422bb6bc85efcfa92aa4376926ea89a8f5a63118eecdb58c8ca28ab31007da79437e0a1ef', - 'sha384': '1a7e02e8ba0e357269a55642024b85738b95238d6cdc49bc440204995aefeff499e22cba76d4c7e96b7d4a9596a70e744f53fa94f3547e7dc506fcaf16ceb4a2', - 'ripemd160': 'bac7849db13e90604620945695288ffee20369107c3a6632d6b1d6b926175ac914319b5a742e6b1a37b82841b6f010ad47ebdb5cd608026eb48513bf68cb54f5' + description: 'Unicode salt, suffers from truncation', + key: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', + salt: 'mnemonicメートルガバヴァぱばぐゞちぢ十人十色', + iterations: 2048, + dkLen: 64, + results: { + sha1: 'd85d14adcb7bdb5d976160e504f520a98cf71aca4cd5fceadf37759743bd6e1d2ff78bdd4403552aef7658094384b341ede80fffd334182be076f9d988a0a40f', + sha256: 'b86b5b900c29ed2724359afd793e10ffc1eb0e7d6f624fc9c85b8ac1785d9a2f0575af52a2338e611f2e6cffdee544adfff6f3d4f43be2ba0e2bd7e917b38a14', + sha512: '3a863fa00f2e97a83fa9b18805e0047a6282cbae0ff48438b33a14475771c52d05137daa12e364cb34d84547ac07568b801c5c7f8dd4baaeee18a67a5c6a3377', + sha224: '95727793842437774ad9ae27b8154a6f37f208b75a03d3a4d4a2443422bb6bc85efcfa92aa4376926ea89a8f5a63118eecdb58c8ca28ab31007da79437e0a1ef', + sha384: '1a7e02e8ba0e357269a55642024b85738b95238d6cdc49bc440204995aefeff499e22cba76d4c7e96b7d4a9596a70e744f53fa94f3547e7dc506fcaf16ceb4a2', + ripemd160: 'bac7849db13e90604620945695288ffee20369107c3a6632d6b1d6b926175ac914319b5a742e6b1a37b82841b6f010ad47ebdb5cd608026eb48513bf68cb54f5' } }) }