From 1851ce4c24c3e57f59a36e7eda465c2e2461a5d0 Mon Sep 17 00:00:00 2001 From: Pat Cavit Date: Tue, 24 Mar 2020 10:19:26 -0700 Subject: [PATCH] release: 2.0.0 :tada: :rocket: --- dist/aws-sig.cjs.js | 1289 +-------------------------------------- dist/aws-sig.cjs.js.map | 2 +- dist/aws-sig.esm.js | 1287 -------------------------------------- dist/aws-sig.esm.js.map | 1 - dist/aws-sig.umd.js | 3 +- dist/aws-sig.umd.js.map | 2 +- package-lock.json | 2 +- package.json | 2 +- 8 files changed, 13 insertions(+), 2575 deletions(-) delete mode 100644 dist/aws-sig.esm.js delete mode 100644 dist/aws-sig.esm.js.map diff --git a/dist/aws-sig.cjs.js b/dist/aws-sig.cjs.js index e7ba667..c8b187c 100644 --- a/dist/aws-sig.cjs.js +++ b/dist/aws-sig.cjs.js @@ -1,1289 +1,14 @@ +/*! aws-sig@2.0.0 !*/ 'use strict'; -/** - * CryptoJS core components. - */ -/* - * Local polyfil of Object.create - */ -var create = Object.create || (function () { - function F() {} - return function (obj) { - var subtype; +Object.defineProperty(exports, '__esModule', { value: true }); - F.prototype = obj; +require('./sign.cjs.js'); +var signedHeaders = require('./signed-headers.cjs.js'); +var signedQuery = require('./signed-query.cjs.js'); - subtype = new F(); - F.prototype = null; - return subtype; - }; -}()); - -/** - * CryptoJS namespace. - */ -var C = {}; - -/** - * Library namespace. - */ -var C_lib = C.lib = {}; - -/** - * Base object for prototypal inheritance. - */ -var Base = C_lib.Base = (function () { - - - return { - /** - * Creates a new object that inherits from this object. - * - * @param {Object} overrides Properties to copy into the new object. - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * field: 'value', - * - * method: function () { - * } - * }); - */ - extend: function (overrides) { - // Spawn - var subtype = create(this); - - // Augment - if (overrides) { - subtype.mixIn(overrides); - } - - // Create default initializer - if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { - subtype.init = function () { - subtype.$super.init.apply(this, arguments); - }; - } - - // Initializer's prototype is the subtype object - subtype.init.prototype = subtype; - - // Reference supertype - subtype.$super = this; - - return subtype; - }, - - /** - * Extends this object and runs the init method. - * Arguments to create() will be passed to init(). - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var instance = MyType.create(); - */ - create: function () { - var instance = this.extend(); - instance.init.apply(instance, arguments); - - return instance; - }, - - /** - * Initializes a newly created object. - * Override this method to add some logic when your objects are created. - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * init: function () { - * // ... - * } - * }); - */ - init: function () { - }, - - /** - * Copies properties into this object. - * - * @param {Object} properties The properties to mix in. - * - * @example - * - * MyType.mixIn({ - * field: 'value' - * }); - */ - mixIn: function (properties) { - for (var propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - this[propertyName] = properties[propertyName]; - } - } - - // IE won't copy toString using the loop above - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function () { - return this.init.prototype.extend(this); - } - }; -}()); - -/** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ -var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function (words, sigBytes) { - words = this.words = words || []; - - if (sigBytes != undefined) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, - - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function (encoder) { - return (encoder || Hex).stringify(this); - }, - - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function (wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; - - // Clamp excess bits - this.clamp(); - - // Concat - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; - } - } - this.sigBytes += thatSigBytes; - - // Chainable - return this; - }, - - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function () { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; - - // Clamp - words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); - words.length = Math.ceil(sigBytes / 4); - }, - - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function () { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - - return clone; - }, - - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function (nBytes) { - var words = []; - - var r = (function (m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - - return function () { - m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; - m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; - var result = ((m_z << 0x10) + m_w) & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - } - }); - - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); - - rcache = _r() * 0x3ade67b7; - words.push((_r() * 0x100000000) | 0); - } - - return new WordArray.init(words, nBytes); - } -}); - -/** - * Encoder namespace. - */ -var C_enc = C.enc = {}; - -/** - * Hex encoding strategy. - */ -var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. - * - * @static - * - * @example - * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - - // Convert - var hexChars = []; - for (var i = 0; i < sigBytes; i++) { - var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); - } - - return hexChars.join(''); - }, - - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Hex.parse(hexString); - */ - parse: function (hexStr) { - // Shortcut - var hexStrLength = hexStr.length; - - // Convert - var words = []; - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); - } - - return new WordArray.init(words, hexStrLength / 2); - } -}; - -/** - * Latin1 encoding strategy. - */ -var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - - // Convert - var latin1Chars = []; - for (var i = 0; i < sigBytes; i++) { - var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } - - return latin1Chars.join(''); - }, - - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function (latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; - - // Convert - var words = []; - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); - } - - return new WordArray.init(words, latin1StrLength); - } -}; - -/** - * UTF-8 encoding strategy. - */ -var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function (wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, - - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function (utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); - } -}; - -/** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 - */ -var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function () { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; - }, - - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function (data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } - - // Append - this._data.concat(data); - this._nDataBytes += data.sigBytes; - }, - - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function (doFlush) { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; - - // Count blocks ready - var nBlocksReady = dataSigBytes / blockSizeBytes; - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } - - // Count words ready - var nWordsReady = nBlocksReady * blockSize; - - // Count bytes ready - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); - - // Process blocks - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } - - // Remove processed words - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } - - // Return processed words - return new WordArray.init(processedWords, nBytesReady); - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ - clone: function () { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); - - return clone; - }, - - _minBufferSize: 0 -}); - -/** - * Abstract hasher template. - * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) - */ -var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), - - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function (cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); - - // Set initial values - this.reset(); - }, - - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function () { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); - - // Perform concrete-hasher logic - this._doReset(); - }, - - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function (messageUpdate) { - // Append - this._append(messageUpdate); - - // Update the hash - this._process(); - - // Chainable - return this; - }, - - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function (messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } - - // Perform concrete-hasher logic - var hash = this._doFinalize(); - - return hash; - }, - - blockSize: 512/32, - - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function (hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, - - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function (hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; - } -}); - -/** - * Algorithm namespace. - */ -var C_algo = C.algo = {}; - -// Shortcuts -var C$1 = C; -var C_lib$1 = C$1.lib; -var Base$1 = C_lib$1.Base; -var C_enc$1 = C$1.enc; -var Utf8$1 = C_enc$1.Utf8; -var C_algo$1 = C$1.algo; - -/** - * HMAC algorithm. - */ -var HMAC = C_algo$1.HMAC = Base$1.extend({ - /** - * Initializes a newly created HMAC. - * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. - * - * @example - * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); - */ - init: function (hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); - - // Convert string to WordArray, else assume WordArray already - if (typeof key == 'string') { - key = Utf8$1.parse(key); - } - - // Shortcuts - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; - - // Allow arbitrary length keys - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } - - // Clamp excess bits - key.clamp(); - - // Clone key for inner and outer pads - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); - - // Shortcuts - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; - - // XOR keys with pad constants - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; - - // Set initial values - this.reset(); - }, - - /** - * Resets this HMAC to its initial state. - * - * @example - * - * hmacHasher.reset(); - */ - reset: function () { - // Shortcut - var hasher = this._hasher; - - // Reset - hasher.reset(); - hasher.update(this._iKey); - }, - - /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {HMAC} This HMAC instance. - * - * @example - * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); - */ - update: function (messageUpdate) { - this._hasher.update(messageUpdate); - - // Chainable - return this; - }, - - /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. - * - * @example - * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); - */ - finalize: function (messageUpdate) { - // Shortcut - var hasher = this._hasher; - - // Compute HMAC - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - - return hmac; - } -}); - -// Shortcuts -var C$2 = C; -var C_lib$2 = C$2.lib; -var WordArray$1 = C_lib$2.WordArray; -var Hasher$1 = C_lib$2.Hasher; -var C_algo$2 = C$2.algo; - -// Initialization and round constants tables -var H = []; -var K = []; - -// Compute constants -(function () { - function isPrime(n) { - var sqrtN = Math.sqrt(n); - for (var factor = 2; factor <= sqrtN; factor++) { - if (!(n % factor)) { - return false; - } - } - - return true; - } - - function getFractionalBits(n) { - return ((n - (n | 0)) * 0x100000000) | 0; - } - - var n = 2; - var nPrime = 0; - while (nPrime < 64) { - if (isPrime(n)) { - if (nPrime < 8) { - H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); - } - K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); - - nPrime++; - } - - n++; - } -}()); - -// Reusable object -var W = []; - -/** - * SHA-256 hash algorithm. - */ -var SHA256Hasher = C_algo$2.SHA256 = Hasher$1.extend({ - _doReset: function () { - this._hash = new WordArray$1.init(H.slice(0)); - }, - - _doProcessBlock: function (M, offset) { - // Shortcut - var H = this._hash.words; - - // Working variables - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; - var f = H[5]; - var g = H[6]; - var h = H[7]; - - // Computation - for (var i = 0; i < 64; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var gamma0x = W[i - 15]; - var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ - ((gamma0x << 14) | (gamma0x >>> 18)) ^ - (gamma0x >>> 3); - - var gamma1x = W[i - 2]; - var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ - ((gamma1x << 13) | (gamma1x >>> 19)) ^ - (gamma1x >>> 10); - - W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; - } - - var ch = (e & f) ^ (~e & g); - var maj = (a & b) ^ (a & c) ^ (b & c); - - var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); - var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); - - var t1 = h + sigma1 + ch + K[i] + W[i]; - var t2 = sigma0 + maj; - - h = g; - g = f; - f = e; - e = (d + t1) | 0; - d = c; - c = b; - b = a; - a = (t1 + t2) | 0; - } - - // Intermediate hash value - H[0] = (H[0] + a) | 0; - H[1] = (H[1] + b) | 0; - H[2] = (H[2] + c) | 0; - H[3] = (H[3] + d) | 0; - H[4] = (H[4] + e) | 0; - H[5] = (H[5] + f) | 0; - H[6] = (H[6] + g) | 0; - H[7] = (H[7] + h) | 0; - }, - - _doFinalize: function () { - // Shortcuts - var data = this._data; - var dataWords = data.words; - - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; - - // Add padding - dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; - - // Hash final blocks - this._process(); - - // Return final computed hash - return this._hash; - }, - - clone: function () { - var clone = Hasher$1.clone.call(this); - clone._hash = this._hash.clone(); - - return clone; - } -}); - -/** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA256('message'); - * var hash = CryptoJS.SHA256(wordArray); - */ -const SHA256 = Hasher$1._createHelper(SHA256Hasher); - -/** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA256(message, key); - */ -const HmacSHA256 = Hasher$1._createHmacHelper(SHA256Hasher); - -/* eslint-disable new-cap */ - -const hash = (str) => - SHA256(str).toString(); - -const hmac = HmacSHA256; - -// Replace one extra character beyond what encodeURIComponent does, "*" -// See https://github.com/aws/aws-sdk-js/blob/38bf84c144281f696768e8c64500f2847fe6f298/lib/util.js#L39-L49 -const encode = (str) => - encodeURIComponent(str) - .replace(/[*]/g, (x) => - // eslint-disable-next-line newline-per-chained-call - `%${x.charCodeAt(0).toString(16).toUpperCase()}` - ); - -const sort = (a, b) => a.localeCompare(b); - -// Sort query parameters by key -// Then also sort by value because AWS -var query = ({ url }) => { - const source = {}; - const params = []; - - url.searchParams.forEach((value, key) => { - if(!source[key]) { - source[key] = []; - } - - source[key].push(value); - }); - - Object.keys(source) - .sort(sort) - .forEach((key) => { - source[key] - .sort(sort) - .forEach((value) => { - params.push(`${encode(key)}=${encode(value)}`); - }); - }); - - return params.join("&"); -}; - -const trim = (val) => { - return val - .toString() - .trim() - .replace(/\s+/g, " "); -}; - -const values = (headers) => { - if(!headers.length) { - return ""; - } - - return headers - .map(([ key, vals ]) => { - return `${key}:${Array.isArray(vals) ? vals.map(trim).join(",") : trim(vals)}`; - }) - .join("\n"); -}; - -const signed = (headers) => { - return headers - .map(([ key ]) => key) - .join(";"); -}; - -const sorted = ({ headers = {} }) => { - const out = Object.keys(headers).map((key) => [ key.toLowerCase(), headers[key] ]); - - return out.sort(([ keya ], [ keyb ]) => keya.localeCompare(keyb)); -}; - -const multipleSlashesRegex = /\/\/+/g; - -var path = ({ service, url }) => { - // S3 doesn't use normalized paths at all - if(service === "s3") { - return url.pathname; - } - - return url.pathname - .replace(multipleSlashesRegex, "/") - .split("/") - .map(encode) - .join("/"); -}; - -var request = (req) => { - const { method, body, sortedHeaders } = req; - - // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html - return [ - method.toUpperCase(), - - // Canonical Path - path(req), - - // Canonical Query - query(req), - - // Canonical Headers - values(sortedHeaders), - - // Extra linebreak - "", - - // Signed Headers - signed(sortedHeaders), - - // Hashed payload - hash(typeof body === "string" ? body.trim() : body), - ].join("\n"); -}; - -// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html -var stringToSign = ({ algorithm, date, region, service }, canonical) => [ - // Signing Function - algorithm, - - // Date Time - date.long, - - // Scope - `${date.short}/${region}/${service}/aws4_request`, - - // Signed canonical request - hash(canonical), - ].join("\n"); - -// https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html -var signature = ({ date, secretAccessKey, region, service }, sts) => { - const kDate = hmac(date.short, `AWS4${secretAccessKey}`); - const kRegion = hmac(region, kDate); - const kService = hmac(service, kRegion); - const kSignature = hmac("aws4_request", kService); - - return hmac(sts, kSignature); -}; - -const requestRequired = [ - "url", -]; - -const configRequired = [ - "accessKeyId", - "region", - "secretAccessKey", - "service", -]; - -// Check for required params -const validate = (source, config) => { - if(!source) { - throw new Error(`Missing request object`); - } - - if(!config) { - throw new Error(`Missing config object`); - } - - let missing = requestRequired.filter((field) => !source[field]); - - if(missing.length) { - throw new Error(`Missing required request fields: ${missing.join(", ")}`); - } - - missing = configRequired.filter((field) => !config[field]); - - if(missing.length) { - throw new Error(`Missing required config fields: ${missing.join(", ")}`); - } -}; - -const authorization = (req, sig) => { - const { - algorithm, - accessKeyId, - date, - region, - service, - sortedHeaders, - } = req; - - return [ - `${algorithm} Credential=${accessKeyId}/${date.short}/${region}/${service}/aws4_request`, - `SignedHeaders=${signed(sortedHeaders)}`, - `Signature=${sig}`, - ].join(", "); -}; - -const dateCleanRegex = /[:\-]|\.\d{3}/g; - -const parseDate = ({ headers }) => { - const datetime = "X-Amz-Date" in headers ? - headers["X-Amz-Date"] : - (new Date(headers.Date || Date.now())) - .toISOString() - .replace(dateCleanRegex, ""); - - return { - short : datetime.split("T")[0], - long : datetime, - }; -}; - -var index = (source, config) => { - validate(source, config); - - if(!source.headers) { - source.headers = {}; - } - - const details = Object.assign( - Object.create(null), - { - method : "GET", - }, - source, - config, - { - url : new URL(source.url), - algorithm : "AWS4-HMAC-SHA256", - date : parseDate(source), - sortedHeaders : sorted(source), - } - ); - - const canonical = request(details); - const sts = stringToSign(details, canonical); - const sig = signature(details, sts); - const auth = authorization(details, sig); - - source.headers["X-Amz-Date"] = details.date.long; - - if(config.sessionToken) { - source.headers["X-Amz-Security-Token"] = config.sessionToken; - } - - source.headers.Authorization = auth; - - return source; -}; - -module.exports = index; +exports.signedHeaders = signedHeaders.signedHeaders; +exports.signedQuery = signedQuery.signedQuery; //# sourceMappingURL=aws-sig.cjs.js.map diff --git a/dist/aws-sig.cjs.js.map b/dist/aws-sig.cjs.js.map index facf706..10fd585 100644 --- a/dist/aws-sig.cjs.js.map +++ b/dist/aws-sig.cjs.js.map @@ -1 +1 @@ -{"version":3,"file":"aws-sig.cjs.js","sources":["../src/crypto-es/core.js","../src/crypto-es/hmac.js","../src/crypto-es/sha256.js","../src/hash.js","../src/encode.js","../src/request/query.js","../src/request/headers.js","../src/request/path.js","../src/request/request.js","../src/stringtosign.js","../src/signature.js","../src/validate.js","../src/authorization.js","../src/index.js"],"sourcesContent":["/**\r\n * CryptoJS core components.\r\n */\r\n/*\r\n\t* Local polyfil of Object.create\r\n\t*/\r\nvar create = Object.create || (function () {\r\n\tfunction F() {};\r\n\r\n\treturn function (obj) {\r\n\t\tvar subtype;\r\n\r\n\t\tF.prototype = obj;\r\n\r\n\t\tsubtype = new F();\r\n\r\n\t\tF.prototype = null;\r\n\r\n\t\treturn subtype;\r\n\t};\r\n}())\r\n\r\n/**\r\n * CryptoJS namespace.\r\n */\r\nvar C = {};\r\n\r\n/**\r\n * Library namespace.\r\n */\r\nvar C_lib = C.lib = {};\r\n\r\n/**\r\n * Base object for prototypal inheritance.\r\n */\r\nvar Base = C_lib.Base = (function () {\r\n\r\n\r\n\treturn {\r\n\t\t/**\r\n\t\t * Creates a new object that inherits from this object.\r\n\t\t *\r\n\t\t * @param {Object} overrides Properties to copy into the new object.\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * field: 'value',\r\n\t\t *\r\n\t\t * method: function () {\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\textend: function (overrides) {\r\n\t\t\t// Spawn\r\n\t\t\tvar subtype = create(this);\r\n\r\n\t\t\t// Augment\r\n\t\t\tif (overrides) {\r\n\t\t\t\tsubtype.mixIn(overrides);\r\n\t\t\t}\r\n\r\n\t\t\t// Create default initializer\r\n\t\t\tif (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\r\n\t\t\t\tsubtype.init = function () {\r\n\t\t\t\t\tsubtype.$super.init.apply(this, arguments);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\t// Initializer's prototype is the subtype object\r\n\t\t\tsubtype.init.prototype = subtype;\r\n\r\n\t\t\t// Reference supertype\r\n\t\t\tsubtype.$super = this;\r\n\r\n\t\t\treturn subtype;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Extends this object and runs the init method.\r\n\t\t * Arguments to create() will be passed to init().\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var instance = MyType.create();\r\n\t\t */\r\n\t\tcreate: function () {\r\n\t\t\tvar instance = this.extend();\r\n\t\t\tinstance.init.apply(instance, arguments);\r\n\r\n\t\t\treturn instance;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Initializes a newly created object.\r\n\t\t * Override this method to add some logic when your objects are created.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * init: function () {\r\n\t\t * // ...\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\tinit: function () {\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Copies properties into this object.\r\n\t\t *\r\n\t\t * @param {Object} properties The properties to mix in.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * MyType.mixIn({\r\n\t\t * field: 'value'\r\n\t\t * });\r\n\t\t */\r\n\t\tmixIn: function (properties) {\r\n\t\t\tfor (var propertyName in properties) {\r\n\t\t\t\tif (properties.hasOwnProperty(propertyName)) {\r\n\t\t\t\t\tthis[propertyName] = properties[propertyName];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// IE won't copy toString using the loop above\r\n\t\t\tif (properties.hasOwnProperty('toString')) {\r\n\t\t\t\tthis.toString = properties.toString;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Creates a copy of this object.\r\n\t\t *\r\n\t\t * @return {Object} The clone.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var clone = instance.clone();\r\n\t\t */\r\n\t\tclone: function () {\r\n\t\t\treturn this.init.prototype.extend(this);\r\n\t\t}\r\n\t};\r\n}());\r\n\r\n/**\r\n * An array of 32-bit words.\r\n *\r\n * @property {Array} words The array of 32-bit words.\r\n * @property {number} sigBytes The number of significant bytes in this word array.\r\n */\r\nvar WordArray = C_lib.WordArray = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created word array.\r\n\t *\r\n\t * @param {Array} words (Optional) An array of 32-bit words.\r\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.create();\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\r\n\t */\r\n\tinit: function (words, sigBytes) {\r\n\t\twords = this.words = words || [];\r\n\r\n\t\tif (sigBytes != undefined) {\r\n\t\t\tthis.sigBytes = sigBytes;\r\n\t\t} else {\r\n\t\t\tthis.sigBytes = words.length * 4;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts this word array to a string.\r\n\t *\r\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\r\n\t *\r\n\t * @return {string} The stringified word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var string = wordArray + '';\r\n\t * var string = wordArray.toString();\r\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\r\n\t */\r\n\ttoString: function (encoder) {\r\n\t\treturn (encoder || Hex).stringify(this);\r\n\t},\r\n\r\n\t/**\r\n\t * Concatenates a word array to this word array.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array to append.\r\n\t *\r\n\t * @return {WordArray} This word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray1.concat(wordArray2);\r\n\t */\r\n\tconcat: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar thisWords = this.words;\r\n\t\tvar thatWords = wordArray.words;\r\n\t\tvar thisSigBytes = this.sigBytes;\r\n\t\tvar thatSigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Clamp excess bits\r\n\t\tthis.clamp();\r\n\r\n\t\t// Concat\r\n\t\tif (thisSigBytes % 4) {\r\n\t\t\t// Copy one byte at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i++) {\r\n\t\t\t\tvar thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Copy one word at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i += 4) {\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.sigBytes += thatSigBytes;\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Removes insignificant bits.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray.clamp();\r\n\t */\r\n\tclamp: function () {\r\n\t\t// Shortcuts\r\n\t\tvar words = this.words;\r\n\t\tvar sigBytes = this.sigBytes;\r\n\r\n\t\t// Clamp\r\n\t\twords[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\r\n\t\twords.length = Math.ceil(sigBytes / 4);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this word array.\r\n\t *\r\n\t * @return {WordArray} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = wordArray.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone.words = this.words.slice(0);\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a word array filled with random bytes.\r\n\t *\r\n\t * @param {number} nBytes The number of random bytes to generate.\r\n\t *\r\n\t * @return {WordArray} The random word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\r\n\t */\r\n\trandom: function (nBytes) {\r\n\t\tvar words = [];\r\n\r\n\t\tvar r = (function (m_w) {\r\n\t\t\tvar m_w = m_w;\r\n\t\t\tvar m_z = 0x3ade68b1;\r\n\t\t\tvar mask = 0xffffffff;\r\n\r\n\t\t\treturn function () {\r\n\t\t\t\tm_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\r\n\t\t\t\tm_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\r\n\t\t\t\tvar result = ((m_z << 0x10) + m_w) & mask;\r\n\t\t\t\tresult /= 0x100000000;\r\n\t\t\t\tresult += 0.5;\r\n\t\t\t\treturn result * (Math.random() > .5 ? 1 : -1);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfor (var i = 0, rcache; i < nBytes; i += 4) {\r\n\t\t\tvar _r = r((rcache || Math.random()) * 0x100000000);\r\n\r\n\t\t\trcache = _r() * 0x3ade67b7;\r\n\t\t\twords.push((_r() * 0x100000000) | 0);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, nBytes);\r\n\t}\r\n});\r\n\r\n/**\r\n * Encoder namespace.\r\n */\r\nvar C_enc = C.enc = {};\r\n\r\n/**\r\n * Hex encoding strategy.\r\n */\r\nvar Hex = C_enc.Hex = {\r\n\t/**\r\n\t * Converts a word array to a hex string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The hex string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar hexChars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\thexChars.push((bite >>> 4).toString(16));\r\n\t\t\thexChars.push((bite & 0x0f).toString(16));\r\n\t\t}\r\n\r\n\t\treturn hexChars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a hex string to a word array.\r\n\t *\r\n\t * @param {string} hexStr The hex string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\r\n\t */\r\n\tparse: function (hexStr) {\r\n\t\t// Shortcut\r\n\t\tvar hexStrLength = hexStr.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < hexStrLength; i += 2) {\r\n\t\t\twords[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, hexStrLength / 2);\r\n\t}\r\n};\r\n\r\n/**\r\n * Latin1 encoding strategy.\r\n */\r\nvar Latin1 = C_enc.Latin1 = {\r\n\t/**\r\n\t * Converts a word array to a Latin1 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The Latin1 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar latin1Chars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\tlatin1Chars.push(String.fromCharCode(bite));\r\n\t\t}\r\n\r\n\t\treturn latin1Chars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a Latin1 string to a word array.\r\n\t *\r\n\t * @param {string} latin1Str The Latin1 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\r\n\t */\r\n\tparse: function (latin1Str) {\r\n\t\t// Shortcut\r\n\t\tvar latin1StrLength = latin1Str.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < latin1StrLength; i++) {\r\n\t\t\twords[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, latin1StrLength);\r\n\t}\r\n};\r\n\r\n/**\r\n * UTF-8 encoding strategy.\r\n */\r\nvar Utf8 = C_enc.Utf8 = {\r\n\t/**\r\n\t * Converts a word array to a UTF-8 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The UTF-8 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\ttry {\r\n\t\t\treturn decodeURIComponent(escape(Latin1.stringify(wordArray)));\r\n\t\t} catch (e) {\r\n\t\t\tthrow new Error('Malformed UTF-8 data');\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a UTF-8 string to a word array.\r\n\t *\r\n\t * @param {string} utf8Str The UTF-8 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\r\n\t */\r\n\tparse: function (utf8Str) {\r\n\t\treturn Latin1.parse(unescape(encodeURIComponent(utf8Str)));\r\n\t}\r\n};\r\n\r\n/**\r\n * Abstract buffered block algorithm template.\r\n *\r\n * The property blockSize must be implemented in a concrete subtype.\r\n *\r\n * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\r\n */\r\nvar BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\r\n\t/**\r\n\t * Resets this block algorithm's data buffer to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Initial values\r\n\t\tthis._data = new WordArray.init();\r\n\t\tthis._nDataBytes = 0;\r\n\t},\r\n\r\n\t/**\r\n\t * Adds new data to this block algorithm's buffer.\r\n\t *\r\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm._append('data');\r\n\t * bufferedBlockAlgorithm._append(wordArray);\r\n\t */\r\n\t_append: function (data) {\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof data == 'string') {\r\n\t\t\tdata = Utf8.parse(data);\r\n\t\t}\r\n\r\n\t\t// Append\r\n\t\tthis._data.concat(data);\r\n\t\tthis._nDataBytes += data.sigBytes;\r\n\t},\r\n\r\n\t/**\r\n\t * Processes available data blocks.\r\n\t *\r\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\r\n\t *\r\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\r\n\t *\r\n\t * @return {WordArray} The processed data.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var processedData = bufferedBlockAlgorithm._process();\r\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\r\n\t */\r\n\t_process: function (doFlush) {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\t\tvar dataSigBytes = data.sigBytes;\r\n\t\tvar blockSize = this.blockSize;\r\n\t\tvar blockSizeBytes = blockSize * 4;\r\n\r\n\t\t// Count blocks ready\r\n\t\tvar nBlocksReady = dataSigBytes / blockSizeBytes;\r\n\t\tif (doFlush) {\r\n\t\t\t// Round up to include partial blocks\r\n\t\t\tnBlocksReady = Math.ceil(nBlocksReady);\r\n\t\t} else {\r\n\t\t\t// Round down to include only full blocks,\r\n\t\t\t// less the number of blocks that must remain in the buffer\r\n\t\t\tnBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\r\n\t\t}\r\n\r\n\t\t// Count words ready\r\n\t\tvar nWordsReady = nBlocksReady * blockSize;\r\n\r\n\t\t// Count bytes ready\r\n\t\tvar nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\r\n\r\n\t\t// Process blocks\r\n\t\tif (nWordsReady) {\r\n\t\t\tfor (var offset = 0; offset < nWordsReady; offset += blockSize) {\r\n\t\t\t\t// Perform concrete-algorithm logic\r\n\t\t\t\tthis._doProcessBlock(dataWords, offset);\r\n\t\t\t}\r\n\r\n\t\t\t// Remove processed words\r\n\t\t\tvar processedWords = dataWords.splice(0, nWordsReady);\r\n\t\t\tdata.sigBytes -= nBytesReady;\r\n\t\t}\r\n\r\n\t\t// Return processed words\r\n\t\treturn new WordArray.init(processedWords, nBytesReady);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this object.\r\n\t *\r\n\t * @return {Object} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = bufferedBlockAlgorithm.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone._data = this._data.clone();\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t_minBufferSize: 0\r\n});\r\n\r\n/**\r\n * Abstract hasher template.\r\n *\r\n * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\r\n */\r\nvar Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\r\n\t/**\r\n\t * Configuration options.\r\n\t */\r\n\tcfg: Base.extend(),\r\n\r\n\t/**\r\n\t * Initializes a newly created hasher.\r\n\t *\r\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hasher = CryptoJS.algo.SHA256.create();\r\n\t */\r\n\tinit: function (cfg) {\r\n\t\t// Apply config defaults\r\n\t\tthis.cfg = this.cfg.extend(cfg);\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this hasher to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Reset data buffer\r\n\t\tBufferedBlockAlgorithm.reset.call(this);\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tthis._doReset();\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this hasher with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {Hasher} This hasher.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.update('message');\r\n\t * hasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\t// Append\r\n\t\tthis._append(messageUpdate);\r\n\r\n\t\t// Update the hash\r\n\t\tthis._process();\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the hash computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The hash.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hash = hasher.finalize();\r\n\t * var hash = hasher.finalize('message');\r\n\t * var hash = hasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Final message update\r\n\t\tif (messageUpdate) {\r\n\t\t\tthis._append(messageUpdate);\r\n\t\t}\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tvar hash = this._doFinalize();\r\n\r\n\t\treturn hash;\r\n\t},\r\n\r\n\tblockSize: 512/32,\r\n\r\n\t/**\r\n\t * Creates a shortcut function to a hasher's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to create a helper for.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHelper: function (hasher) {\r\n\t\treturn function (message, cfg) {\r\n\t\t\treturn new hasher.init(cfg).finalize(message);\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a shortcut function to the HMAC's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHmacHelper: function (hasher) {\r\n\t\treturn function (message, key) {\r\n\t\t\treturn new C_algo.HMAC.init(hasher, key).finalize(message);\r\n\t\t};\r\n\t}\r\n});\r\n\r\n/**\r\n * Algorithm namespace.\r\n */\r\nvar C_algo = C.algo = {};\r\n\r\nexport default C;\r\n","import Crypto from \"./core.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar Base = C_lib.Base;\r\nvar C_enc = C.enc;\r\nvar Utf8 = C_enc.Utf8;\r\nvar C_algo = C.algo;\r\n\r\n/**\r\n * HMAC algorithm.\r\n */\r\nvar HMAC = C_algo.HMAC = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created HMAC.\r\n\t *\r\n\t * @param {Hasher} hasher The hash algorithm to use.\r\n\t * @param {WordArray|string} key The secret key.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\r\n\t */\r\n\tinit: function (hasher, key) {\r\n\t\t// Init hasher\r\n\t\thasher = this._hasher = new hasher.init();\r\n\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof key == 'string') {\r\n\t\t\tkey = Utf8.parse(key);\r\n\t\t}\r\n\r\n\t\t// Shortcuts\r\n\t\tvar hasherBlockSize = hasher.blockSize;\r\n\t\tvar hasherBlockSizeBytes = hasherBlockSize * 4;\r\n\r\n\t\t// Allow arbitrary length keys\r\n\t\tif (key.sigBytes > hasherBlockSizeBytes) {\r\n\t\t\tkey = hasher.finalize(key);\r\n\t\t}\r\n\r\n\t\t// Clamp excess bits\r\n\t\tkey.clamp();\r\n\r\n\t\t// Clone key for inner and outer pads\r\n\t\tvar oKey = this._oKey = key.clone();\r\n\t\tvar iKey = this._iKey = key.clone();\r\n\r\n\t\t// Shortcuts\r\n\t\tvar oKeyWords = oKey.words;\r\n\t\tvar iKeyWords = iKey.words;\r\n\r\n\t\t// XOR keys with pad constants\r\n\t\tfor (var i = 0; i < hasherBlockSize; i++) {\r\n\t\t\toKeyWords[i] ^= 0x5c5c5c5c;\r\n\t\t\tiKeyWords[i] ^= 0x36363636;\r\n\t\t}\r\n\t\toKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this HMAC to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Reset\r\n\t\thasher.reset();\r\n\t\thasher.update(this._iKey);\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this HMAC with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {HMAC} This HMAC instance.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.update('message');\r\n\t * hmacHasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\tthis._hasher.update(messageUpdate);\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the HMAC computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The HMAC.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmac = hmacHasher.finalize();\r\n\t * var hmac = hmacHasher.finalize('message');\r\n\t * var hmac = hmacHasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Compute HMAC\r\n\t\tvar innerHash = hasher.finalize(messageUpdate);\r\n\t\thasher.reset();\r\n\t\tvar hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\r\n\r\n\t\treturn hmac;\r\n\t}\r\n});\r\n","import Crypto from \"./core.js\";\r\nimport \"./hmac.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar WordArray = C_lib.WordArray;\r\nvar Hasher = C_lib.Hasher;\r\nvar C_algo = C.algo;\r\n\r\n// Initialization and round constants tables\r\nvar H = [];\r\nvar K = [];\r\n\r\n// Compute constants\r\n(function () {\r\n\tfunction isPrime(n) {\r\n\t\tvar sqrtN = Math.sqrt(n);\r\n\t\tfor (var factor = 2; factor <= sqrtN; factor++) {\r\n\t\t\tif (!(n % factor)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\tfunction getFractionalBits(n) {\r\n\t\treturn ((n - (n | 0)) * 0x100000000) | 0;\r\n\t}\r\n\r\n\tvar n = 2;\r\n\tvar nPrime = 0;\r\n\twhile (nPrime < 64) {\r\n\t\tif (isPrime(n)) {\r\n\t\t\tif (nPrime < 8) {\r\n\t\t\t\tH[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\r\n\t\t\t}\r\n\t\t\tK[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\r\n\r\n\t\t\tnPrime++;\r\n\t\t}\r\n\r\n\t\tn++;\r\n\t}\r\n}());\r\n\r\n// Reusable object\r\nvar W = [];\r\n\r\n/**\r\n * SHA-256 hash algorithm.\r\n */\r\nvar SHA256Hasher = C_algo.SHA256 = Hasher.extend({\r\n\t_doReset: function () {\r\n\t\tthis._hash = new WordArray.init(H.slice(0));\r\n\t},\r\n\r\n\t_doProcessBlock: function (M, offset) {\r\n\t\t// Shortcut\r\n\t\tvar H = this._hash.words;\r\n\r\n\t\t// Working variables\r\n\t\tvar a = H[0];\r\n\t\tvar b = H[1];\r\n\t\tvar c = H[2];\r\n\t\tvar d = H[3];\r\n\t\tvar e = H[4];\r\n\t\tvar f = H[5];\r\n\t\tvar g = H[6];\r\n\t\tvar h = H[7];\r\n\r\n\t\t// Computation\r\n\t\tfor (var i = 0; i < 64; i++) {\r\n\t\t\tif (i < 16) {\r\n\t\t\t\tW[i] = M[offset + i] | 0;\r\n\t\t\t} else {\r\n\t\t\t\tvar gamma0x = W[i - 15];\r\n\t\t\t\tvar gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\r\n\t\t\t\t\t\t\t\t((gamma0x << 14) | (gamma0x >>> 18)) ^\r\n\t\t\t\t\t\t\t\t(gamma0x >>> 3);\r\n\r\n\t\t\t\tvar gamma1x = W[i - 2];\r\n\t\t\t\tvar gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\r\n\t\t\t\t\t\t\t\t((gamma1x << 13) | (gamma1x >>> 19)) ^\r\n\t\t\t\t\t\t\t\t(gamma1x >>> 10);\r\n\r\n\t\t\t\tW[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\r\n\t\t\t}\r\n\r\n\t\t\tvar ch = (e & f) ^ (~e & g);\r\n\t\t\tvar maj = (a & b) ^ (a & c) ^ (b & c);\r\n\r\n\t\t\tvar sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\r\n\t\t\tvar sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\r\n\r\n\t\t\tvar t1 = h + sigma1 + ch + K[i] + W[i];\r\n\t\t\tvar t2 = sigma0 + maj;\r\n\r\n\t\t\th = g;\r\n\t\t\tg = f;\r\n\t\t\tf = e;\r\n\t\t\te = (d + t1) | 0;\r\n\t\t\td = c;\r\n\t\t\tc = b;\r\n\t\t\tb = a;\r\n\t\t\ta = (t1 + t2) | 0;\r\n\t\t}\r\n\r\n\t\t// Intermediate hash value\r\n\t\tH[0] = (H[0] + a) | 0;\r\n\t\tH[1] = (H[1] + b) | 0;\r\n\t\tH[2] = (H[2] + c) | 0;\r\n\t\tH[3] = (H[3] + d) | 0;\r\n\t\tH[4] = (H[4] + e) | 0;\r\n\t\tH[5] = (H[5] + f) | 0;\r\n\t\tH[6] = (H[6] + g) | 0;\r\n\t\tH[7] = (H[7] + h) | 0;\r\n\t},\r\n\r\n\t_doFinalize: function () {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\r\n\t\tvar nBitsTotal = this._nDataBytes * 8;\r\n\t\tvar nBitsLeft = data.sigBytes * 8;\r\n\r\n\t\t// Add padding\r\n\t\tdataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\r\n\t\tdata.sigBytes = dataWords.length * 4;\r\n\r\n\t\t// Hash final blocks\r\n\t\tthis._process();\r\n\r\n\t\t// Return final computed hash\r\n\t\treturn this._hash;\r\n\t},\r\n\r\n\tclone: function () {\r\n\t\tvar clone = Hasher.clone.call(this);\r\n\t\tclone._hash = this._hash.clone();\r\n\r\n\t\treturn clone;\r\n\t}\r\n});\r\n\r\n/**\r\n * Shortcut function to the hasher's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n *\r\n * @return {WordArray} The hash.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hash = CryptoJS.SHA256('message');\r\n * var hash = CryptoJS.SHA256(wordArray);\r\n */\r\nconst SHA256 = Hasher._createHelper(SHA256Hasher);\r\n\r\n/**\r\n * Shortcut function to the HMAC's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n * @param {WordArray|string} key The secret key.\r\n *\r\n * @return {WordArray} The HMAC.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hmac = CryptoJS.HmacSHA256(message, key);\r\n */\r\nconst HmacSHA256 = Hasher._createHmacHelper(SHA256Hasher);\r\n\r\nexport { SHA256, HmacSHA256 };\r\n","/* eslint-disable new-cap */\r\nimport { SHA256, HmacSHA256 } from \"./crypto-es/sha256.js\";\r\n\r\nconst hash = (str) =>\r\n SHA256(str).toString();\r\n\r\nconst hmac = HmacSHA256;\r\n \r\nexport { hmac, hash };\r\n","\"use strict\";\r\n\r\n// Replace one extra character beyond what encodeURIComponent does, \"*\"\r\n// See https://github.com/aws/aws-sdk-js/blob/38bf84c144281f696768e8c64500f2847fe6f298/lib/util.js#L39-L49\r\nconst encode = (str) =>\r\n encodeURIComponent(str)\r\n .replace(/[*]/g, (x) =>\r\n // eslint-disable-next-line newline-per-chained-call\r\n `%${x.charCodeAt(0).toString(16).toUpperCase()}`\r\n );\r\n\r\nexport default encode;\r\n","import encode from \"../encode.js\";\r\n\r\nconst sort = (a, b) => a.localeCompare(b);\r\n\r\n// Sort query parameters by key\r\n// Then also sort by value because AWS\r\nexport default ({ url }) => {\r\n const source = {};\r\n const params = [];\r\n \r\n url.searchParams.forEach((value, key) => {\r\n if(!source[key]) {\r\n source[key] = [];\r\n }\r\n\r\n source[key].push(value);\r\n });\r\n\r\n Object.keys(source)\r\n .sort(sort)\r\n .forEach((key) => {\r\n source[key]\r\n .sort(sort)\r\n .forEach((value) => {\r\n params.push(`${encode(key)}=${encode(value)}`);\r\n });\r\n });\r\n\r\n return params.join(\"&\");\r\n};\r\n","const trim = (val) => {\r\n return val\r\n .toString()\r\n .trim()\r\n .replace(/\\s+/g, \" \");\r\n};\r\n\r\nconst values = (headers) => {\r\n if(!headers.length) {\r\n return \"\";\r\n }\r\n\r\n return headers\r\n .map(([ key, vals ]) => {\r\n return `${key}:${Array.isArray(vals) ? vals.map(trim).join(\",\") : trim(vals)}`;\r\n })\r\n .join(\"\\n\");\r\n};\r\n\r\nconst signed = (headers) => {\r\n return headers\r\n .map(([ key ]) => key)\r\n .join(\";\");\r\n};\r\n\r\nconst sorted = ({ headers = {} }) => {\r\n const out = Object.keys(headers).map((key) => [ key.toLowerCase(), headers[key] ]);\r\n\r\n return out.sort(([ keya ], [ keyb ]) => keya.localeCompare(keyb));\r\n};\r\n\r\nexport { sorted, values, signed };\r\n","import encode from \"../encode.js\";\r\n\r\nconst multipleSlashesRegex = /\\/\\/+/g;\r\n\r\nexport default ({ service, url }) => {\r\n // S3 doesn't use normalized paths at all\r\n if(service === \"s3\") {\r\n return url.pathname;\r\n }\r\n \r\n return url.pathname\r\n .replace(multipleSlashesRegex, \"/\")\r\n .split(\"/\")\r\n .map(encode)\r\n .join(\"/\");\r\n};\r\n","import { hash } from \"../hash.js\";\r\n\r\nimport query from \"./query.js\";\r\nimport { values, signed } from \"./headers.js\";\r\nimport path from \"./path.js\";\r\n\r\nexport default (req) => {\r\n const { method, body, sortedHeaders } = req;\r\n\r\n // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\r\n return [\r\n method.toUpperCase(),\r\n \r\n // Canonical Path\r\n path(req),\r\n \r\n // Canonical Query\r\n query(req),\r\n \r\n // Canonical Headers\r\n values(sortedHeaders),\r\n\r\n // Extra linebreak\r\n \"\",\r\n\r\n // Signed Headers\r\n signed(sortedHeaders),\r\n\r\n // Hashed payload\r\n hash(typeof body === \"string\" ? body.trim() : body),\r\n ].join(\"\\n\");\r\n};\r\n","import { hash } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\r\nexport default ({ algorithm, date, region, service }, canonical) => [\r\n // Signing Function\r\n algorithm,\r\n \r\n // Date Time\r\n date.long,\r\n \r\n // Scope\r\n `${date.short}/${region}/${service}/aws4_request`,\r\n \r\n // Signed canonical request\r\n hash(canonical),\r\n ].join(\"\\n\");\r\n","import { hmac } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\r\nexport default ({ date, secretAccessKey, region, service }, sts) => {\r\n const kDate = hmac(date.short, `AWS4${secretAccessKey}`);\r\n const kRegion = hmac(region, kDate);\r\n const kService = hmac(service, kRegion);\r\n const kSignature = hmac(\"aws4_request\", kService);\r\n\r\n return hmac(sts, kSignature);\r\n};\r\n","const requestRequired = [\r\n \"url\",\r\n];\r\n\r\nconst configRequired = [\r\n \"accessKeyId\",\r\n \"region\",\r\n \"secretAccessKey\",\r\n \"service\",\r\n];\r\n\r\n// Check for required params\r\nconst validate = (source, config) => {\r\n if(!source) {\r\n throw new Error(`Missing request object`);\r\n }\r\n\r\n if(!config) {\r\n throw new Error(`Missing config object`);\r\n }\r\n\r\n let missing = requestRequired.filter((field) => !source[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required request fields: ${missing.join(\", \")}`);\r\n }\r\n \r\n missing = configRequired.filter((field) => !config[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required config fields: ${missing.join(\", \")}`);\r\n }\r\n};\r\n\r\nexport default validate;\r\n","import { signed } from \"./request/headers.js\";\r\n\r\nconst authorization = (req, sig) => {\r\n const {\r\n algorithm,\r\n accessKeyId,\r\n date,\r\n region,\r\n service,\r\n sortedHeaders,\r\n } = req;\r\n\r\n return [\r\n `${algorithm} Credential=${accessKeyId}/${date.short}/${region}/${service}/aws4_request`,\r\n `SignedHeaders=${signed(sortedHeaders)}`,\r\n `Signature=${sig}`,\r\n ].join(\", \");\r\n};\r\n\r\nexport default authorization;\r\n","import testing from \"consts:testing\";\r\n\r\nimport request from \"./request/request.js\";\r\nimport { sorted } from \"./request/headers.js\";\r\nimport stringToSign from \"./stringtosign.js\";\r\nimport signature from \"./signature.js\";\r\nimport validate from \"./validate.js\";\r\nimport authorization from \"./authorization.js\";\r\n\r\nconst dateCleanRegex = /[:\\-]|\\.\\d{3}/g;\r\n\r\nconst parseDate = ({ headers }) => {\r\n const datetime = \"X-Amz-Date\" in headers ?\r\n headers[\"X-Amz-Date\"] :\r\n (new Date(headers.Date || Date.now()))\r\n .toISOString()\r\n .replace(dateCleanRegex, \"\");\r\n\r\n return {\r\n short : datetime.split(\"T\")[0],\r\n long : datetime,\r\n };\r\n};\r\n\r\nexport default (source, config) => {\r\n validate(source, config);\r\n\r\n if(!source.headers) {\r\n source.headers = {};\r\n }\r\n\r\n const details = Object.assign(\r\n Object.create(null),\r\n {\r\n method : \"GET\",\r\n },\r\n source,\r\n config,\r\n {\r\n url : new URL(source.url),\r\n algorithm : \"AWS4-HMAC-SHA256\",\r\n date : parseDate(source),\r\n sortedHeaders : sorted(source),\r\n }\r\n );\r\n\r\n const canonical = request(details);\r\n const sts = stringToSign(details, canonical);\r\n const sig = signature(details, sts);\r\n const auth = authorization(details, sig);\r\n\r\n source.headers[\"X-Amz-Date\"] = details.date.long;\r\n \r\n if(config.sessionToken) {\r\n source.headers[\"X-Amz-Security-Token\"] = config.sessionToken;\r\n }\r\n \r\n source.headers.Authorization = auth;\r\n\r\n // Add partial output to response for tests so each step can be validated\r\n /* istanbul ignore next */\r\n if(testing) {\r\n source.test = {\r\n canonical,\r\n sts,\r\n auth,\r\n };\r\n }\r\n\r\n return source;\r\n};\r\n"],"names":["C","Crypto","C_lib","Base","C_enc","Utf8","C_algo","WordArray","Hasher"],"mappings":";;AAAA;;;;;;AAMA,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,YAAY;CAC1C,SAAS,CAAC,GAAG,EAAE,AAChB;CACC,OAAO,UAAU,GAAG,EAAE;EACrB,IAAI,OAAO,CAAC;;EAEZ,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;;EAElB,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;;EAElB,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;;EAEnB,OAAO,OAAO,CAAC;EACf,CAAC;CACF,EAAE,EAAC;;;;;AAKJ,I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S,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;;IAEzC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;;IAEjD,GAAG,MAAM,CAAC,YAAY,EAAE;QACpB,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC;KAChE;;IAED,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;AACxC,AAUA;IACI,OAAO,MAAM,CAAC;CACjB,CAAC;;;;"} \ No newline at end of file +{"version":3,"file":"aws-sig.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/aws-sig.esm.js b/dist/aws-sig.esm.js deleted file mode 100644 index c33a4b0..0000000 --- a/dist/aws-sig.esm.js +++ /dev/null @@ -1,1287 +0,0 @@ -/** - * CryptoJS core components. - */ -/* - * Local polyfil of Object.create - */ -var create = Object.create || (function () { - function F() {} - return function (obj) { - var subtype; - - F.prototype = obj; - - subtype = new F(); - - F.prototype = null; - - return subtype; - }; -}()); - -/** - * CryptoJS namespace. - */ -var C = {}; - -/** - * Library namespace. - */ -var C_lib = C.lib = {}; - -/** - * Base object for prototypal inheritance. - */ -var Base = C_lib.Base = (function () { - - - return { - /** - * Creates a new object that inherits from this object. - * - * @param {Object} overrides Properties to copy into the new object. - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * field: 'value', - * - * method: function () { - * } - * }); - */ - extend: function (overrides) { - // Spawn - var subtype = create(this); - - // Augment - if (overrides) { - subtype.mixIn(overrides); - } - - // Create default initializer - if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { - subtype.init = function () { - subtype.$super.init.apply(this, arguments); - }; - } - - // Initializer's prototype is the subtype object - subtype.init.prototype = subtype; - - // Reference supertype - subtype.$super = this; - - return subtype; - }, - - /** - * Extends this object and runs the init method. - * Arguments to create() will be passed to init(). - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var instance = MyType.create(); - */ - create: function () { - var instance = this.extend(); - instance.init.apply(instance, arguments); - - return instance; - }, - - /** - * Initializes a newly created object. - * Override this method to add some logic when your objects are created. - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * init: function () { - * // ... - * } - * }); - */ - init: function () { - }, - - /** - * Copies properties into this object. - * - * @param {Object} properties The properties to mix in. - * - * @example - * - * MyType.mixIn({ - * field: 'value' - * }); - */ - mixIn: function (properties) { - for (var propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - this[propertyName] = properties[propertyName]; - } - } - - // IE won't copy toString using the loop above - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function () { - return this.init.prototype.extend(this); - } - }; -}()); - -/** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ -var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function (words, sigBytes) { - words = this.words = words || []; - - if (sigBytes != undefined) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, - - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function (encoder) { - return (encoder || Hex).stringify(this); - }, - - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function (wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; - - // Clamp excess bits - this.clamp(); - - // Concat - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; - } - } - this.sigBytes += thatSigBytes; - - // Chainable - return this; - }, - - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function () { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; - - // Clamp - words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); - words.length = Math.ceil(sigBytes / 4); - }, - - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function () { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - - return clone; - }, - - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function (nBytes) { - var words = []; - - var r = (function (m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - - return function () { - m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; - m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; - var result = ((m_z << 0x10) + m_w) & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - } - }); - - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); - - rcache = _r() * 0x3ade67b7; - words.push((_r() * 0x100000000) | 0); - } - - return new WordArray.init(words, nBytes); - } -}); - -/** - * Encoder namespace. - */ -var C_enc = C.enc = {}; - -/** - * Hex encoding strategy. - */ -var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. - * - * @static - * - * @example - * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - - // Convert - var hexChars = []; - for (var i = 0; i < sigBytes; i++) { - var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); - } - - return hexChars.join(''); - }, - - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Hex.parse(hexString); - */ - parse: function (hexStr) { - // Shortcut - var hexStrLength = hexStr.length; - - // Convert - var words = []; - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); - } - - return new WordArray.init(words, hexStrLength / 2); - } -}; - -/** - * Latin1 encoding strategy. - */ -var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - - // Convert - var latin1Chars = []; - for (var i = 0; i < sigBytes; i++) { - var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } - - return latin1Chars.join(''); - }, - - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function (latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; - - // Convert - var words = []; - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); - } - - return new WordArray.init(words, latin1StrLength); - } -}; - -/** - * UTF-8 encoding strategy. - */ -var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function (wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, - - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function (utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); - } -}; - -/** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 - */ -var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function () { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; - }, - - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function (data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } - - // Append - this._data.concat(data); - this._nDataBytes += data.sigBytes; - }, - - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function (doFlush) { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; - - // Count blocks ready - var nBlocksReady = dataSigBytes / blockSizeBytes; - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } - - // Count words ready - var nWordsReady = nBlocksReady * blockSize; - - // Count bytes ready - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); - - // Process blocks - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } - - // Remove processed words - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } - - // Return processed words - return new WordArray.init(processedWords, nBytesReady); - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ - clone: function () { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); - - return clone; - }, - - _minBufferSize: 0 -}); - -/** - * Abstract hasher template. - * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) - */ -var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), - - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function (cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); - - // Set initial values - this.reset(); - }, - - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function () { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); - - // Perform concrete-hasher logic - this._doReset(); - }, - - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function (messageUpdate) { - // Append - this._append(messageUpdate); - - // Update the hash - this._process(); - - // Chainable - return this; - }, - - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function (messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } - - // Perform concrete-hasher logic - var hash = this._doFinalize(); - - return hash; - }, - - blockSize: 512/32, - - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function (hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, - - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function (hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; - } -}); - -/** - * Algorithm namespace. - */ -var C_algo = C.algo = {}; - -// Shortcuts -var C$1 = C; -var C_lib$1 = C$1.lib; -var Base$1 = C_lib$1.Base; -var C_enc$1 = C$1.enc; -var Utf8$1 = C_enc$1.Utf8; -var C_algo$1 = C$1.algo; - -/** - * HMAC algorithm. - */ -var HMAC = C_algo$1.HMAC = Base$1.extend({ - /** - * Initializes a newly created HMAC. - * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. - * - * @example - * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); - */ - init: function (hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); - - // Convert string to WordArray, else assume WordArray already - if (typeof key == 'string') { - key = Utf8$1.parse(key); - } - - // Shortcuts - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; - - // Allow arbitrary length keys - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } - - // Clamp excess bits - key.clamp(); - - // Clone key for inner and outer pads - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); - - // Shortcuts - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; - - // XOR keys with pad constants - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; - - // Set initial values - this.reset(); - }, - - /** - * Resets this HMAC to its initial state. - * - * @example - * - * hmacHasher.reset(); - */ - reset: function () { - // Shortcut - var hasher = this._hasher; - - // Reset - hasher.reset(); - hasher.update(this._iKey); - }, - - /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {HMAC} This HMAC instance. - * - * @example - * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); - */ - update: function (messageUpdate) { - this._hasher.update(messageUpdate); - - // Chainable - return this; - }, - - /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. - * - * @example - * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); - */ - finalize: function (messageUpdate) { - // Shortcut - var hasher = this._hasher; - - // Compute HMAC - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - - return hmac; - } -}); - -// Shortcuts -var C$2 = C; -var C_lib$2 = C$2.lib; -var WordArray$1 = C_lib$2.WordArray; -var Hasher$1 = C_lib$2.Hasher; -var C_algo$2 = C$2.algo; - -// Initialization and round constants tables -var H = []; -var K = []; - -// Compute constants -(function () { - function isPrime(n) { - var sqrtN = Math.sqrt(n); - for (var factor = 2; factor <= sqrtN; factor++) { - if (!(n % factor)) { - return false; - } - } - - return true; - } - - function getFractionalBits(n) { - return ((n - (n | 0)) * 0x100000000) | 0; - } - - var n = 2; - var nPrime = 0; - while (nPrime < 64) { - if (isPrime(n)) { - if (nPrime < 8) { - H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); - } - K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); - - nPrime++; - } - - n++; - } -}()); - -// Reusable object -var W = []; - -/** - * SHA-256 hash algorithm. - */ -var SHA256Hasher = C_algo$2.SHA256 = Hasher$1.extend({ - _doReset: function () { - this._hash = new WordArray$1.init(H.slice(0)); - }, - - _doProcessBlock: function (M, offset) { - // Shortcut - var H = this._hash.words; - - // Working variables - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; - var f = H[5]; - var g = H[6]; - var h = H[7]; - - // Computation - for (var i = 0; i < 64; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var gamma0x = W[i - 15]; - var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ - ((gamma0x << 14) | (gamma0x >>> 18)) ^ - (gamma0x >>> 3); - - var gamma1x = W[i - 2]; - var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ - ((gamma1x << 13) | (gamma1x >>> 19)) ^ - (gamma1x >>> 10); - - W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; - } - - var ch = (e & f) ^ (~e & g); - var maj = (a & b) ^ (a & c) ^ (b & c); - - var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); - var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); - - var t1 = h + sigma1 + ch + K[i] + W[i]; - var t2 = sigma0 + maj; - - h = g; - g = f; - f = e; - e = (d + t1) | 0; - d = c; - c = b; - b = a; - a = (t1 + t2) | 0; - } - - // Intermediate hash value - H[0] = (H[0] + a) | 0; - H[1] = (H[1] + b) | 0; - H[2] = (H[2] + c) | 0; - H[3] = (H[3] + d) | 0; - H[4] = (H[4] + e) | 0; - H[5] = (H[5] + f) | 0; - H[6] = (H[6] + g) | 0; - H[7] = (H[7] + h) | 0; - }, - - _doFinalize: function () { - // Shortcuts - var data = this._data; - var dataWords = data.words; - - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; - - // Add padding - dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; - - // Hash final blocks - this._process(); - - // Return final computed hash - return this._hash; - }, - - clone: function () { - var clone = Hasher$1.clone.call(this); - clone._hash = this._hash.clone(); - - return clone; - } -}); - -/** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA256('message'); - * var hash = CryptoJS.SHA256(wordArray); - */ -const SHA256 = Hasher$1._createHelper(SHA256Hasher); - -/** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA256(message, key); - */ -const HmacSHA256 = Hasher$1._createHmacHelper(SHA256Hasher); - -/* eslint-disable new-cap */ - -const hash = (str) => - SHA256(str).toString(); - -const hmac = HmacSHA256; - -// Replace one extra character beyond what encodeURIComponent does, "*" -// See https://github.com/aws/aws-sdk-js/blob/38bf84c144281f696768e8c64500f2847fe6f298/lib/util.js#L39-L49 -const encode = (str) => - encodeURIComponent(str) - .replace(/[*]/g, (x) => - // eslint-disable-next-line newline-per-chained-call - `%${x.charCodeAt(0).toString(16).toUpperCase()}` - ); - -const sort = (a, b) => a.localeCompare(b); - -// Sort query parameters by key -// Then also sort by value because AWS -var query = ({ url }) => { - const source = {}; - const params = []; - - url.searchParams.forEach((value, key) => { - if(!source[key]) { - source[key] = []; - } - - source[key].push(value); - }); - - Object.keys(source) - .sort(sort) - .forEach((key) => { - source[key] - .sort(sort) - .forEach((value) => { - params.push(`${encode(key)}=${encode(value)}`); - }); - }); - - return params.join("&"); -}; - -const trim = (val) => { - return val - .toString() - .trim() - .replace(/\s+/g, " "); -}; - -const values = (headers) => { - if(!headers.length) { - return ""; - } - - return headers - .map(([ key, vals ]) => { - return `${key}:${Array.isArray(vals) ? vals.map(trim).join(",") : trim(vals)}`; - }) - .join("\n"); -}; - -const signed = (headers) => { - return headers - .map(([ key ]) => key) - .join(";"); -}; - -const sorted = ({ headers = {} }) => { - const out = Object.keys(headers).map((key) => [ key.toLowerCase(), headers[key] ]); - - return out.sort(([ keya ], [ keyb ]) => keya.localeCompare(keyb)); -}; - -const multipleSlashesRegex = /\/\/+/g; - -var path = ({ service, url }) => { - // S3 doesn't use normalized paths at all - if(service === "s3") { - return url.pathname; - } - - return url.pathname - .replace(multipleSlashesRegex, "/") - .split("/") - .map(encode) - .join("/"); -}; - -var request = (req) => { - const { method, body, sortedHeaders } = req; - - // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html - return [ - method.toUpperCase(), - - // Canonical Path - path(req), - - // Canonical Query - query(req), - - // Canonical Headers - values(sortedHeaders), - - // Extra linebreak - "", - - // Signed Headers - signed(sortedHeaders), - - // Hashed payload - hash(typeof body === "string" ? body.trim() : body), - ].join("\n"); -}; - -// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html -var stringToSign = ({ algorithm, date, region, service }, canonical) => [ - // Signing Function - algorithm, - - // Date Time - date.long, - - // Scope - `${date.short}/${region}/${service}/aws4_request`, - - // Signed canonical request - hash(canonical), - ].join("\n"); - -// https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html -var signature = ({ date, secretAccessKey, region, service }, sts) => { - const kDate = hmac(date.short, `AWS4${secretAccessKey}`); - const kRegion = hmac(region, kDate); - const kService = hmac(service, kRegion); - const kSignature = hmac("aws4_request", kService); - - return hmac(sts, kSignature); -}; - -const requestRequired = [ - "url", -]; - -const configRequired = [ - "accessKeyId", - "region", - "secretAccessKey", - "service", -]; - -// Check for required params -const validate = (source, config) => { - if(!source) { - throw new Error(`Missing request object`); - } - - if(!config) { - throw new Error(`Missing config object`); - } - - let missing = requestRequired.filter((field) => !source[field]); - - if(missing.length) { - throw new Error(`Missing required request fields: ${missing.join(", ")}`); - } - - missing = configRequired.filter((field) => !config[field]); - - if(missing.length) { - throw new Error(`Missing required config fields: ${missing.join(", ")}`); - } -}; - -const authorization = (req, sig) => { - const { - algorithm, - accessKeyId, - date, - region, - service, - sortedHeaders, - } = req; - - return [ - `${algorithm} Credential=${accessKeyId}/${date.short}/${region}/${service}/aws4_request`, - `SignedHeaders=${signed(sortedHeaders)}`, - `Signature=${sig}`, - ].join(", "); -}; - -const dateCleanRegex = /[:\-]|\.\d{3}/g; - -const parseDate = ({ headers }) => { - const datetime = "X-Amz-Date" in headers ? - headers["X-Amz-Date"] : - (new Date(headers.Date || Date.now())) - .toISOString() - .replace(dateCleanRegex, ""); - - return { - short : datetime.split("T")[0], - long : datetime, - }; -}; - -var index = (source, config) => { - validate(source, config); - - if(!source.headers) { - source.headers = {}; - } - - const details = Object.assign( - Object.create(null), - { - method : "GET", - }, - source, - config, - { - url : new URL(source.url), - algorithm : "AWS4-HMAC-SHA256", - date : parseDate(source), - sortedHeaders : sorted(source), - } - ); - - const canonical = request(details); - const sts = stringToSign(details, canonical); - const sig = signature(details, sts); - const auth = authorization(details, sig); - - source.headers["X-Amz-Date"] = details.date.long; - - if(config.sessionToken) { - source.headers["X-Amz-Security-Token"] = config.sessionToken; - } - - source.headers.Authorization = auth; - - return source; -}; - -export default index; -//# sourceMappingURL=aws-sig.esm.js.map diff --git a/dist/aws-sig.esm.js.map b/dist/aws-sig.esm.js.map deleted file mode 100644 index 6c4fde3..0000000 --- a/dist/aws-sig.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"aws-sig.esm.js","sources":["../src/crypto-es/core.js","../src/crypto-es/hmac.js","../src/crypto-es/sha256.js","../src/hash.js","../src/encode.js","../src/request/query.js","../src/request/headers.js","../src/request/path.js","../src/request/request.js","../src/stringtosign.js","../src/signature.js","../src/validate.js","../src/authorization.js","../src/index.js"],"sourcesContent":["/**\r\n * CryptoJS core components.\r\n */\r\n/*\r\n\t* Local polyfil of Object.create\r\n\t*/\r\nvar create = Object.create || (function () {\r\n\tfunction F() {};\r\n\r\n\treturn function (obj) {\r\n\t\tvar subtype;\r\n\r\n\t\tF.prototype = obj;\r\n\r\n\t\tsubtype = new F();\r\n\r\n\t\tF.prototype = null;\r\n\r\n\t\treturn subtype;\r\n\t};\r\n}())\r\n\r\n/**\r\n * CryptoJS namespace.\r\n */\r\nvar C = {};\r\n\r\n/**\r\n * Library namespace.\r\n */\r\nvar C_lib = C.lib = {};\r\n\r\n/**\r\n * Base object for prototypal inheritance.\r\n */\r\nvar Base = C_lib.Base = (function () {\r\n\r\n\r\n\treturn {\r\n\t\t/**\r\n\t\t * Creates a new object that inherits from this object.\r\n\t\t *\r\n\t\t * @param {Object} overrides Properties to copy into the new object.\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * field: 'value',\r\n\t\t *\r\n\t\t * method: function () {\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\textend: function (overrides) {\r\n\t\t\t// Spawn\r\n\t\t\tvar subtype = create(this);\r\n\r\n\t\t\t// Augment\r\n\t\t\tif (overrides) {\r\n\t\t\t\tsubtype.mixIn(overrides);\r\n\t\t\t}\r\n\r\n\t\t\t// Create default initializer\r\n\t\t\tif (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\r\n\t\t\t\tsubtype.init = function () {\r\n\t\t\t\t\tsubtype.$super.init.apply(this, arguments);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\t// Initializer's prototype is the subtype object\r\n\t\t\tsubtype.init.prototype = subtype;\r\n\r\n\t\t\t// Reference supertype\r\n\t\t\tsubtype.$super = this;\r\n\r\n\t\t\treturn subtype;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Extends this object and runs the init method.\r\n\t\t * Arguments to create() will be passed to init().\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var instance = MyType.create();\r\n\t\t */\r\n\t\tcreate: function () {\r\n\t\t\tvar instance = this.extend();\r\n\t\t\tinstance.init.apply(instance, arguments);\r\n\r\n\t\t\treturn instance;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Initializes a newly created object.\r\n\t\t * Override this method to add some logic when your objects are created.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * init: function () {\r\n\t\t * // ...\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\tinit: function () {\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Copies properties into this object.\r\n\t\t *\r\n\t\t * @param {Object} properties The properties to mix in.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * MyType.mixIn({\r\n\t\t * field: 'value'\r\n\t\t * });\r\n\t\t */\r\n\t\tmixIn: function (properties) {\r\n\t\t\tfor (var propertyName in properties) {\r\n\t\t\t\tif (properties.hasOwnProperty(propertyName)) {\r\n\t\t\t\t\tthis[propertyName] = properties[propertyName];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// IE won't copy toString using the loop above\r\n\t\t\tif (properties.hasOwnProperty('toString')) {\r\n\t\t\t\tthis.toString = properties.toString;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Creates a copy of this object.\r\n\t\t *\r\n\t\t * @return {Object} The clone.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var clone = instance.clone();\r\n\t\t */\r\n\t\tclone: function () {\r\n\t\t\treturn this.init.prototype.extend(this);\r\n\t\t}\r\n\t};\r\n}());\r\n\r\n/**\r\n * An array of 32-bit words.\r\n *\r\n * @property {Array} words The array of 32-bit words.\r\n * @property {number} sigBytes The number of significant bytes in this word array.\r\n */\r\nvar WordArray = C_lib.WordArray = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created word array.\r\n\t *\r\n\t * @param {Array} words (Optional) An array of 32-bit words.\r\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.create();\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\r\n\t */\r\n\tinit: function (words, sigBytes) {\r\n\t\twords = this.words = words || [];\r\n\r\n\t\tif (sigBytes != undefined) {\r\n\t\t\tthis.sigBytes = sigBytes;\r\n\t\t} else {\r\n\t\t\tthis.sigBytes = words.length * 4;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts this word array to a string.\r\n\t *\r\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\r\n\t *\r\n\t * @return {string} The stringified word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var string = wordArray + '';\r\n\t * var string = wordArray.toString();\r\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\r\n\t */\r\n\ttoString: function (encoder) {\r\n\t\treturn (encoder || Hex).stringify(this);\r\n\t},\r\n\r\n\t/**\r\n\t * Concatenates a word array to this word array.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array to append.\r\n\t *\r\n\t * @return {WordArray} This word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray1.concat(wordArray2);\r\n\t */\r\n\tconcat: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar thisWords = this.words;\r\n\t\tvar thatWords = wordArray.words;\r\n\t\tvar thisSigBytes = this.sigBytes;\r\n\t\tvar thatSigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Clamp excess bits\r\n\t\tthis.clamp();\r\n\r\n\t\t// Concat\r\n\t\tif (thisSigBytes % 4) {\r\n\t\t\t// Copy one byte at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i++) {\r\n\t\t\t\tvar thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Copy one word at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i += 4) {\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.sigBytes += thatSigBytes;\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Removes insignificant bits.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray.clamp();\r\n\t */\r\n\tclamp: function () {\r\n\t\t// Shortcuts\r\n\t\tvar words = this.words;\r\n\t\tvar sigBytes = this.sigBytes;\r\n\r\n\t\t// Clamp\r\n\t\twords[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\r\n\t\twords.length = Math.ceil(sigBytes / 4);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this word array.\r\n\t *\r\n\t * @return {WordArray} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = wordArray.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone.words = this.words.slice(0);\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a word array filled with random bytes.\r\n\t *\r\n\t * @param {number} nBytes The number of random bytes to generate.\r\n\t *\r\n\t * @return {WordArray} The random word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\r\n\t */\r\n\trandom: function (nBytes) {\r\n\t\tvar words = [];\r\n\r\n\t\tvar r = (function (m_w) {\r\n\t\t\tvar m_w = m_w;\r\n\t\t\tvar m_z = 0x3ade68b1;\r\n\t\t\tvar mask = 0xffffffff;\r\n\r\n\t\t\treturn function () {\r\n\t\t\t\tm_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\r\n\t\t\t\tm_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\r\n\t\t\t\tvar result = ((m_z << 0x10) + m_w) & mask;\r\n\t\t\t\tresult /= 0x100000000;\r\n\t\t\t\tresult += 0.5;\r\n\t\t\t\treturn result * (Math.random() > .5 ? 1 : -1);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfor (var i = 0, rcache; i < nBytes; i += 4) {\r\n\t\t\tvar _r = r((rcache || Math.random()) * 0x100000000);\r\n\r\n\t\t\trcache = _r() * 0x3ade67b7;\r\n\t\t\twords.push((_r() * 0x100000000) | 0);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, nBytes);\r\n\t}\r\n});\r\n\r\n/**\r\n * Encoder namespace.\r\n */\r\nvar C_enc = C.enc = {};\r\n\r\n/**\r\n * Hex encoding strategy.\r\n */\r\nvar Hex = C_enc.Hex = {\r\n\t/**\r\n\t * Converts a word array to a hex string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The hex string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar hexChars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\thexChars.push((bite >>> 4).toString(16));\r\n\t\t\thexChars.push((bite & 0x0f).toString(16));\r\n\t\t}\r\n\r\n\t\treturn hexChars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a hex string to a word array.\r\n\t *\r\n\t * @param {string} hexStr The hex string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\r\n\t */\r\n\tparse: function (hexStr) {\r\n\t\t// Shortcut\r\n\t\tvar hexStrLength = hexStr.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < hexStrLength; i += 2) {\r\n\t\t\twords[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, hexStrLength / 2);\r\n\t}\r\n};\r\n\r\n/**\r\n * Latin1 encoding strategy.\r\n */\r\nvar Latin1 = C_enc.Latin1 = {\r\n\t/**\r\n\t * Converts a word array to a Latin1 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The Latin1 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar latin1Chars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\tlatin1Chars.push(String.fromCharCode(bite));\r\n\t\t}\r\n\r\n\t\treturn latin1Chars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a Latin1 string to a word array.\r\n\t *\r\n\t * @param {string} latin1Str The Latin1 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\r\n\t */\r\n\tparse: function (latin1Str) {\r\n\t\t// Shortcut\r\n\t\tvar latin1StrLength = latin1Str.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < latin1StrLength; i++) {\r\n\t\t\twords[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, latin1StrLength);\r\n\t}\r\n};\r\n\r\n/**\r\n * UTF-8 encoding strategy.\r\n */\r\nvar Utf8 = C_enc.Utf8 = {\r\n\t/**\r\n\t * Converts a word array to a UTF-8 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The UTF-8 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\ttry {\r\n\t\t\treturn decodeURIComponent(escape(Latin1.stringify(wordArray)));\r\n\t\t} catch (e) {\r\n\t\t\tthrow new Error('Malformed UTF-8 data');\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a UTF-8 string to a word array.\r\n\t *\r\n\t * @param {string} utf8Str The UTF-8 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\r\n\t */\r\n\tparse: function (utf8Str) {\r\n\t\treturn Latin1.parse(unescape(encodeURIComponent(utf8Str)));\r\n\t}\r\n};\r\n\r\n/**\r\n * Abstract buffered block algorithm template.\r\n *\r\n * The property blockSize must be implemented in a concrete subtype.\r\n *\r\n * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\r\n */\r\nvar BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\r\n\t/**\r\n\t * Resets this block algorithm's data buffer to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Initial values\r\n\t\tthis._data = new WordArray.init();\r\n\t\tthis._nDataBytes = 0;\r\n\t},\r\n\r\n\t/**\r\n\t * Adds new data to this block algorithm's buffer.\r\n\t *\r\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm._append('data');\r\n\t * bufferedBlockAlgorithm._append(wordArray);\r\n\t */\r\n\t_append: function (data) {\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof data == 'string') {\r\n\t\t\tdata = Utf8.parse(data);\r\n\t\t}\r\n\r\n\t\t// Append\r\n\t\tthis._data.concat(data);\r\n\t\tthis._nDataBytes += data.sigBytes;\r\n\t},\r\n\r\n\t/**\r\n\t * Processes available data blocks.\r\n\t *\r\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\r\n\t *\r\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\r\n\t *\r\n\t * @return {WordArray} The processed data.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var processedData = bufferedBlockAlgorithm._process();\r\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\r\n\t */\r\n\t_process: function (doFlush) {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\t\tvar dataSigBytes = data.sigBytes;\r\n\t\tvar blockSize = this.blockSize;\r\n\t\tvar blockSizeBytes = blockSize * 4;\r\n\r\n\t\t// Count blocks ready\r\n\t\tvar nBlocksReady = dataSigBytes / blockSizeBytes;\r\n\t\tif (doFlush) {\r\n\t\t\t// Round up to include partial blocks\r\n\t\t\tnBlocksReady = Math.ceil(nBlocksReady);\r\n\t\t} else {\r\n\t\t\t// Round down to include only full blocks,\r\n\t\t\t// less the number of blocks that must remain in the buffer\r\n\t\t\tnBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\r\n\t\t}\r\n\r\n\t\t// Count words ready\r\n\t\tvar nWordsReady = nBlocksReady * blockSize;\r\n\r\n\t\t// Count bytes ready\r\n\t\tvar nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\r\n\r\n\t\t// Process blocks\r\n\t\tif (nWordsReady) {\r\n\t\t\tfor (var offset = 0; offset < nWordsReady; offset += blockSize) {\r\n\t\t\t\t// Perform concrete-algorithm logic\r\n\t\t\t\tthis._doProcessBlock(dataWords, offset);\r\n\t\t\t}\r\n\r\n\t\t\t// Remove processed words\r\n\t\t\tvar processedWords = dataWords.splice(0, nWordsReady);\r\n\t\t\tdata.sigBytes -= nBytesReady;\r\n\t\t}\r\n\r\n\t\t// Return processed words\r\n\t\treturn new WordArray.init(processedWords, nBytesReady);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this object.\r\n\t *\r\n\t * @return {Object} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = bufferedBlockAlgorithm.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone._data = this._data.clone();\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t_minBufferSize: 0\r\n});\r\n\r\n/**\r\n * Abstract hasher template.\r\n *\r\n * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\r\n */\r\nvar Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\r\n\t/**\r\n\t * Configuration options.\r\n\t */\r\n\tcfg: Base.extend(),\r\n\r\n\t/**\r\n\t * Initializes a newly created hasher.\r\n\t *\r\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hasher = CryptoJS.algo.SHA256.create();\r\n\t */\r\n\tinit: function (cfg) {\r\n\t\t// Apply config defaults\r\n\t\tthis.cfg = this.cfg.extend(cfg);\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this hasher to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Reset data buffer\r\n\t\tBufferedBlockAlgorithm.reset.call(this);\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tthis._doReset();\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this hasher with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {Hasher} This hasher.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.update('message');\r\n\t * hasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\t// Append\r\n\t\tthis._append(messageUpdate);\r\n\r\n\t\t// Update the hash\r\n\t\tthis._process();\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the hash computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The hash.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hash = hasher.finalize();\r\n\t * var hash = hasher.finalize('message');\r\n\t * var hash = hasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Final message update\r\n\t\tif (messageUpdate) {\r\n\t\t\tthis._append(messageUpdate);\r\n\t\t}\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tvar hash = this._doFinalize();\r\n\r\n\t\treturn hash;\r\n\t},\r\n\r\n\tblockSize: 512/32,\r\n\r\n\t/**\r\n\t * Creates a shortcut function to a hasher's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to create a helper for.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHelper: function (hasher) {\r\n\t\treturn function (message, cfg) {\r\n\t\t\treturn new hasher.init(cfg).finalize(message);\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a shortcut function to the HMAC's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHmacHelper: function (hasher) {\r\n\t\treturn function (message, key) {\r\n\t\t\treturn new C_algo.HMAC.init(hasher, key).finalize(message);\r\n\t\t};\r\n\t}\r\n});\r\n\r\n/**\r\n * Algorithm namespace.\r\n */\r\nvar C_algo = C.algo = {};\r\n\r\nexport default C;\r\n","import Crypto from \"./core.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar Base = C_lib.Base;\r\nvar C_enc = C.enc;\r\nvar Utf8 = C_enc.Utf8;\r\nvar C_algo = C.algo;\r\n\r\n/**\r\n * HMAC algorithm.\r\n */\r\nvar HMAC = C_algo.HMAC = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created HMAC.\r\n\t *\r\n\t * @param {Hasher} hasher The hash algorithm to use.\r\n\t * @param {WordArray|string} key The secret key.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\r\n\t */\r\n\tinit: function (hasher, key) {\r\n\t\t// Init hasher\r\n\t\thasher = this._hasher = new hasher.init();\r\n\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof key == 'string') {\r\n\t\t\tkey = Utf8.parse(key);\r\n\t\t}\r\n\r\n\t\t// Shortcuts\r\n\t\tvar hasherBlockSize = hasher.blockSize;\r\n\t\tvar hasherBlockSizeBytes = hasherBlockSize * 4;\r\n\r\n\t\t// Allow arbitrary length keys\r\n\t\tif (key.sigBytes > hasherBlockSizeBytes) {\r\n\t\t\tkey = hasher.finalize(key);\r\n\t\t}\r\n\r\n\t\t// Clamp excess bits\r\n\t\tkey.clamp();\r\n\r\n\t\t// Clone key for inner and outer pads\r\n\t\tvar oKey = this._oKey = key.clone();\r\n\t\tvar iKey = this._iKey = key.clone();\r\n\r\n\t\t// Shortcuts\r\n\t\tvar oKeyWords = oKey.words;\r\n\t\tvar iKeyWords = iKey.words;\r\n\r\n\t\t// XOR keys with pad constants\r\n\t\tfor (var i = 0; i < hasherBlockSize; i++) {\r\n\t\t\toKeyWords[i] ^= 0x5c5c5c5c;\r\n\t\t\tiKeyWords[i] ^= 0x36363636;\r\n\t\t}\r\n\t\toKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this HMAC to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Reset\r\n\t\thasher.reset();\r\n\t\thasher.update(this._iKey);\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this HMAC with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {HMAC} This HMAC instance.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.update('message');\r\n\t * hmacHasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\tthis._hasher.update(messageUpdate);\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the HMAC computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The HMAC.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmac = hmacHasher.finalize();\r\n\t * var hmac = hmacHasher.finalize('message');\r\n\t * var hmac = hmacHasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Compute HMAC\r\n\t\tvar innerHash = hasher.finalize(messageUpdate);\r\n\t\thasher.reset();\r\n\t\tvar hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\r\n\r\n\t\treturn hmac;\r\n\t}\r\n});\r\n","import Crypto from \"./core.js\";\r\nimport \"./hmac.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar WordArray = C_lib.WordArray;\r\nvar Hasher = C_lib.Hasher;\r\nvar C_algo = C.algo;\r\n\r\n// Initialization and round constants tables\r\nvar H = [];\r\nvar K = [];\r\n\r\n// Compute constants\r\n(function () {\r\n\tfunction isPrime(n) {\r\n\t\tvar sqrtN = Math.sqrt(n);\r\n\t\tfor (var factor = 2; factor <= sqrtN; factor++) {\r\n\t\t\tif (!(n % factor)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\tfunction getFractionalBits(n) {\r\n\t\treturn ((n - (n | 0)) * 0x100000000) | 0;\r\n\t}\r\n\r\n\tvar n = 2;\r\n\tvar nPrime = 0;\r\n\twhile (nPrime < 64) {\r\n\t\tif (isPrime(n)) {\r\n\t\t\tif (nPrime < 8) {\r\n\t\t\t\tH[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\r\n\t\t\t}\r\n\t\t\tK[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\r\n\r\n\t\t\tnPrime++;\r\n\t\t}\r\n\r\n\t\tn++;\r\n\t}\r\n}());\r\n\r\n// Reusable object\r\nvar W = [];\r\n\r\n/**\r\n * SHA-256 hash algorithm.\r\n */\r\nvar SHA256Hasher = C_algo.SHA256 = Hasher.extend({\r\n\t_doReset: function () {\r\n\t\tthis._hash = new WordArray.init(H.slice(0));\r\n\t},\r\n\r\n\t_doProcessBlock: function (M, offset) {\r\n\t\t// Shortcut\r\n\t\tvar H = this._hash.words;\r\n\r\n\t\t// Working variables\r\n\t\tvar a = H[0];\r\n\t\tvar b = H[1];\r\n\t\tvar c = H[2];\r\n\t\tvar d = H[3];\r\n\t\tvar e = H[4];\r\n\t\tvar f = H[5];\r\n\t\tvar g = H[6];\r\n\t\tvar h = H[7];\r\n\r\n\t\t// Computation\r\n\t\tfor (var i = 0; i < 64; i++) {\r\n\t\t\tif (i < 16) {\r\n\t\t\t\tW[i] = M[offset + i] | 0;\r\n\t\t\t} else {\r\n\t\t\t\tvar gamma0x = W[i - 15];\r\n\t\t\t\tvar gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\r\n\t\t\t\t\t\t\t\t((gamma0x << 14) | (gamma0x >>> 18)) ^\r\n\t\t\t\t\t\t\t\t(gamma0x >>> 3);\r\n\r\n\t\t\t\tvar gamma1x = W[i - 2];\r\n\t\t\t\tvar gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\r\n\t\t\t\t\t\t\t\t((gamma1x << 13) | (gamma1x >>> 19)) ^\r\n\t\t\t\t\t\t\t\t(gamma1x >>> 10);\r\n\r\n\t\t\t\tW[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\r\n\t\t\t}\r\n\r\n\t\t\tvar ch = (e & f) ^ (~e & g);\r\n\t\t\tvar maj = (a & b) ^ (a & c) ^ (b & c);\r\n\r\n\t\t\tvar sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\r\n\t\t\tvar sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\r\n\r\n\t\t\tvar t1 = h + sigma1 + ch + K[i] + W[i];\r\n\t\t\tvar t2 = sigma0 + maj;\r\n\r\n\t\t\th = g;\r\n\t\t\tg = f;\r\n\t\t\tf = e;\r\n\t\t\te = (d + t1) | 0;\r\n\t\t\td = c;\r\n\t\t\tc = b;\r\n\t\t\tb = a;\r\n\t\t\ta = (t1 + t2) | 0;\r\n\t\t}\r\n\r\n\t\t// Intermediate hash value\r\n\t\tH[0] = (H[0] + a) | 0;\r\n\t\tH[1] = (H[1] + b) | 0;\r\n\t\tH[2] = (H[2] + c) | 0;\r\n\t\tH[3] = (H[3] + d) | 0;\r\n\t\tH[4] = (H[4] + e) | 0;\r\n\t\tH[5] = (H[5] + f) | 0;\r\n\t\tH[6] = (H[6] + g) | 0;\r\n\t\tH[7] = (H[7] + h) | 0;\r\n\t},\r\n\r\n\t_doFinalize: function () {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\r\n\t\tvar nBitsTotal = this._nDataBytes * 8;\r\n\t\tvar nBitsLeft = data.sigBytes * 8;\r\n\r\n\t\t// Add padding\r\n\t\tdataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\r\n\t\tdata.sigBytes = dataWords.length * 4;\r\n\r\n\t\t// Hash final blocks\r\n\t\tthis._process();\r\n\r\n\t\t// Return final computed hash\r\n\t\treturn this._hash;\r\n\t},\r\n\r\n\tclone: function () {\r\n\t\tvar clone = Hasher.clone.call(this);\r\n\t\tclone._hash = this._hash.clone();\r\n\r\n\t\treturn clone;\r\n\t}\r\n});\r\n\r\n/**\r\n * Shortcut function to the hasher's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n *\r\n * @return {WordArray} The hash.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hash = CryptoJS.SHA256('message');\r\n * var hash = CryptoJS.SHA256(wordArray);\r\n */\r\nconst SHA256 = Hasher._createHelper(SHA256Hasher);\r\n\r\n/**\r\n * Shortcut function to the HMAC's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n * @param {WordArray|string} key The secret key.\r\n *\r\n * @return {WordArray} The HMAC.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hmac = CryptoJS.HmacSHA256(message, key);\r\n */\r\nconst HmacSHA256 = Hasher._createHmacHelper(SHA256Hasher);\r\n\r\nexport { SHA256, HmacSHA256 };\r\n","/* eslint-disable new-cap */\r\nimport { SHA256, HmacSHA256 } from \"./crypto-es/sha256.js\";\r\n\r\nconst hash = (str) =>\r\n SHA256(str).toString();\r\n\r\nconst hmac = HmacSHA256;\r\n \r\nexport { hmac, hash };\r\n","\"use strict\";\r\n\r\n// Replace one extra character beyond what encodeURIComponent does, \"*\"\r\n// See https://github.com/aws/aws-sdk-js/blob/38bf84c144281f696768e8c64500f2847fe6f298/lib/util.js#L39-L49\r\nconst encode = (str) =>\r\n encodeURIComponent(str)\r\n .replace(/[*]/g, (x) =>\r\n // eslint-disable-next-line newline-per-chained-call\r\n `%${x.charCodeAt(0).toString(16).toUpperCase()}`\r\n );\r\n\r\nexport default encode;\r\n","import encode from \"../encode.js\";\r\n\r\nconst sort = (a, b) => a.localeCompare(b);\r\n\r\n// Sort query parameters by key\r\n// Then also sort by value because AWS\r\nexport default ({ url }) => {\r\n const source = {};\r\n const params = [];\r\n \r\n url.searchParams.forEach((value, key) => {\r\n if(!source[key]) {\r\n source[key] = [];\r\n }\r\n\r\n source[key].push(value);\r\n });\r\n\r\n Object.keys(source)\r\n .sort(sort)\r\n .forEach((key) => {\r\n source[key]\r\n .sort(sort)\r\n .forEach((value) => {\r\n params.push(`${encode(key)}=${encode(value)}`);\r\n });\r\n });\r\n\r\n return params.join(\"&\");\r\n};\r\n","const trim = (val) => {\r\n return val\r\n .toString()\r\n .trim()\r\n .replace(/\\s+/g, \" \");\r\n};\r\n\r\nconst values = (headers) => {\r\n if(!headers.length) {\r\n return \"\";\r\n }\r\n\r\n return headers\r\n .map(([ key, vals ]) => {\r\n return `${key}:${Array.isArray(vals) ? vals.map(trim).join(\",\") : trim(vals)}`;\r\n })\r\n .join(\"\\n\");\r\n};\r\n\r\nconst signed = (headers) => {\r\n return headers\r\n .map(([ key ]) => key)\r\n .join(\";\");\r\n};\r\n\r\nconst sorted = ({ headers = {} }) => {\r\n const out = Object.keys(headers).map((key) => [ key.toLowerCase(), headers[key] ]);\r\n\r\n return out.sort(([ keya ], [ keyb ]) => keya.localeCompare(keyb));\r\n};\r\n\r\nexport { sorted, values, signed };\r\n","import encode from \"../encode.js\";\r\n\r\nconst multipleSlashesRegex = /\\/\\/+/g;\r\n\r\nexport default ({ service, url }) => {\r\n // S3 doesn't use normalized paths at all\r\n if(service === \"s3\") {\r\n return url.pathname;\r\n }\r\n \r\n return url.pathname\r\n .replace(multipleSlashesRegex, \"/\")\r\n .split(\"/\")\r\n .map(encode)\r\n .join(\"/\");\r\n};\r\n","import { hash } from \"../hash.js\";\r\n\r\nimport query from \"./query.js\";\r\nimport { values, signed } from \"./headers.js\";\r\nimport path from \"./path.js\";\r\n\r\nexport default (req) => {\r\n const { method, body, sortedHeaders } = req;\r\n\r\n // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\r\n return [\r\n method.toUpperCase(),\r\n \r\n // Canonical Path\r\n path(req),\r\n \r\n // Canonical Query\r\n query(req),\r\n \r\n // Canonical Headers\r\n values(sortedHeaders),\r\n\r\n // Extra linebreak\r\n \"\",\r\n\r\n // Signed Headers\r\n signed(sortedHeaders),\r\n\r\n // Hashed payload\r\n hash(typeof body === \"string\" ? body.trim() : body),\r\n ].join(\"\\n\");\r\n};\r\n","import { hash } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\r\nexport default ({ algorithm, date, region, service }, canonical) => [\r\n // Signing Function\r\n algorithm,\r\n \r\n // Date Time\r\n date.long,\r\n \r\n // Scope\r\n `${date.short}/${region}/${service}/aws4_request`,\r\n \r\n // Signed canonical request\r\n hash(canonical),\r\n ].join(\"\\n\");\r\n","import { hmac } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\r\nexport default ({ date, secretAccessKey, region, service }, sts) => {\r\n const kDate = hmac(date.short, `AWS4${secretAccessKey}`);\r\n const kRegion = hmac(region, kDate);\r\n const kService = hmac(service, kRegion);\r\n const kSignature = hmac(\"aws4_request\", kService);\r\n\r\n return hmac(sts, kSignature);\r\n};\r\n","const requestRequired = [\r\n \"url\",\r\n];\r\n\r\nconst configRequired = [\r\n \"accessKeyId\",\r\n \"region\",\r\n \"secretAccessKey\",\r\n \"service\",\r\n];\r\n\r\n// Check for required params\r\nconst validate = (source, config) => {\r\n if(!source) {\r\n throw new Error(`Missing request object`);\r\n }\r\n\r\n if(!config) {\r\n throw new Error(`Missing config object`);\r\n }\r\n\r\n let missing = requestRequired.filter((field) => !source[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required request fields: ${missing.join(\", \")}`);\r\n }\r\n \r\n missing = configRequired.filter((field) => !config[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required config fields: ${missing.join(\", \")}`);\r\n }\r\n};\r\n\r\nexport default validate;\r\n","import { signed } from \"./request/headers.js\";\r\n\r\nconst authorization = (req, sig) => {\r\n const {\r\n algorithm,\r\n accessKeyId,\r\n date,\r\n region,\r\n service,\r\n sortedHeaders,\r\n } = req;\r\n\r\n return [\r\n `${algorithm} Credential=${accessKeyId}/${date.short}/${region}/${service}/aws4_request`,\r\n `SignedHeaders=${signed(sortedHeaders)}`,\r\n `Signature=${sig}`,\r\n ].join(\", \");\r\n};\r\n\r\nexport default authorization;\r\n","import testing from \"consts:testing\";\r\n\r\nimport request from \"./request/request.js\";\r\nimport { sorted } from \"./request/headers.js\";\r\nimport stringToSign from \"./stringtosign.js\";\r\nimport signature from \"./signature.js\";\r\nimport validate from \"./validate.js\";\r\nimport authorization from \"./authorization.js\";\r\n\r\nconst dateCleanRegex = /[:\\-]|\\.\\d{3}/g;\r\n\r\nconst parseDate = ({ headers }) => {\r\n const datetime = \"X-Amz-Date\" in headers ?\r\n headers[\"X-Amz-Date\"] :\r\n (new Date(headers.Date || Date.now()))\r\n .toISOString()\r\n .replace(dateCleanRegex, \"\");\r\n\r\n return {\r\n short : datetime.split(\"T\")[0],\r\n long : datetime,\r\n };\r\n};\r\n\r\nexport default (source, config) => {\r\n validate(source, config);\r\n\r\n if(!source.headers) {\r\n source.headers = {};\r\n }\r\n\r\n const details = Object.assign(\r\n Object.create(null),\r\n {\r\n method : \"GET\",\r\n },\r\n source,\r\n config,\r\n {\r\n url : new URL(source.url),\r\n algorithm : \"AWS4-HMAC-SHA256\",\r\n date : parseDate(source),\r\n sortedHeaders : sorted(source),\r\n }\r\n );\r\n\r\n const canonical = request(details);\r\n const sts = stringToSign(details, canonical);\r\n const sig = signature(details, sts);\r\n const auth = authorization(details, sig);\r\n\r\n source.headers[\"X-Amz-Date\"] = details.date.long;\r\n \r\n if(config.sessionToken) {\r\n source.headers[\"X-Amz-Security-Token\"] = config.sessionToken;\r\n }\r\n \r\n source.headers.Authorization = auth;\r\n\r\n // Add partial output to response for tests so each step can be validated\r\n /* istanbul ignore next */\r\n if(testing) {\r\n source.test = {\r\n canonical,\r\n sts,\r\n auth,\r\n };\r\n }\r\n\r\n return source;\r\n};\r\n"],"names":["C","Crypto","C_lib","Base","C_enc","Utf8","C_algo","WordArray","Hasher"],"mappings":"AAAA;;;;;;AAMA,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK,YAAY;CAC1C,SAAS,CAAC,GAAG,EAAE,AAChB;CACC,OAAO,UAAU,GAAG,EAAE;EACrB,IAAI,OAAO,CAAC;;EAEZ,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;;EAElB,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;;EAElB,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC;;EAEnB,OAAO,OAAO,CAAC;EACf,CAAC;CACF,EAAE,EAAC;;;;;AAKJ,IAAI,CAAC,GAAG,EAAE,CAAC;;;;;AAKX,IAAI,KAAK,GAAG,CAAC,C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AAG,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;;IAEzC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;;IAEjD,GAAG,MAAM,CAAC,YAAY,EAAE;QACpB,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC;KAChE;;IAED,MAAM,CAAC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;AACxC,AAUA;IACI,OAAO,MAAM,CAAC;CACjB,CAAC;;;;"} \ No newline at end of file diff --git a/dist/aws-sig.umd.js b/dist/aws-sig.umd.js index 45d456a..5267231 100644 --- a/dist/aws-sig.umd.js +++ b/dist/aws-sig.umd.js @@ -1,2 +1,3 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self)["aws-sig"]=e()}(this,function(){"use strict";var t=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),e={},n=e.lib={},r=n.Base={extend:function(e){var n=t(this);return e&&n.mixIn(e),n.hasOwnProperty("init")&&this.init!==n.init||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},i=n.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o>>2]>>>24-o%4*8&255;e[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=Math.ceil(e/4)},clone:function(){var t=r.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e,n=[],r=function(t){t=t;var e=987654321,n=4294967295;return function(){var r=((e=36969*(65535&e)+(e>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return r/=4294967296,(r+=.5)*(Math.random()>.5?1:-1)}},o=0;o>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},a=o.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(a.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return a.parse(unescape(encodeURIComponent(t)))}},u=n.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,n=e.words,r=e.sigBytes,o=this.blockSize,s=r/(4*o),a=(s=t?Math.ceil(s):Math.max((0|s)-this._minBufferSize,0))*o,c=Math.min(4*a,r);if(a){for(var u=0;ur&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),o=this._iKey=e.clone(),s=i.words,a=o.words,c=0;c>>7)^(l<<14|l>>>18)^l>>>3,p=B[h-2],g=(p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10;B[h]=d+B[h-7]+g+B[h-16]}var y=r&i^r&o^i&o,v=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+_[h]+B[h];f=u,u=c,c=a,a=s+w|0,s=o,o=i,i=r,r=w+(v+y)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+c|0,n[6]=n[6]+u|0,n[7]=n[7]+f|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=v.clone.call(this);return t._hash=this._hash.clone(),t}}),A=v._createHelper(S),j=v._createHmacHelper(S),z=function(t){return A(t).toString()},H=j,M=function(t){return encodeURIComponent(t).replace(/[*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})},b=function(t,e){return t.localeCompare(e)};function x(t){var e=t.url,n={},r=[];return e.searchParams.forEach(function(t,e){n[e]||(n[e]=[]),n[e].push(t)}),Object.keys(n).sort(b).forEach(function(t){n[t].sort(b).forEach(function(e){r.push(M(t)+"="+M(e))})}),r.join("&")}var C=function(t){return t.toString().trim().replace(/\s+/g," ")},k=function(t){return t.length?t.map(function(t){var e=t[0],n=t[1];return e+":"+(Array.isArray(n)?n.map(C).join(","):C(n))}).join("\n"):""},D=function(t){return t.map(function(t){return t[0]}).join(";")},E=function(t){var e=t.headers;return void 0===e&&(e={}),Object.keys(e).map(function(t){return[t.toLowerCase(),e[t]]}).sort(function(t,e){var n=t[0],r=e[0];return n.localeCompare(r)})},I=/\/\/+/g;var O=["url"],U=["accessKeyId","region","secretAccessKey","service"],q=function(t,e){if(!t)throw new Error("Missing request object");if(!e)throw new Error("Missing config object");var n=O.filter(function(e){return!t[e]});if(n.length)throw new Error("Missing required request fields: "+n.join(", "));if((n=U.filter(function(t){return!e[t]})).length)throw new Error("Missing required config fields: "+n.join(", "))},K=function(t,e){var n=t.algorithm,r=t.accessKeyId,i=t.date,o=t.region,s=t.service,a=t.sortedHeaders;return[n+" Credential="+r+"/"+i.short+"/"+o+"/"+s+"/aws4_request","SignedHeaders="+D(a),"Signature="+e].join(", ")},P=/[:\-]|\.\d{3}/g,R=function(t){var e=t.headers,n="X-Amz-Date"in e?e["X-Amz-Date"]:new Date(e.Date||Date.now()).toISOString().replace(P,"");return{short:n.split("T")[0],long:n}};return function(t,e){q(t,e),t.headers||(t.headers={});var n,r,i,o,s,a,c,u=Object.assign(Object.create(null),{method:"GET"},t,e,{url:new URL(t.url),algorithm:"AWS4-HMAC-SHA256",date:R(t),sortedHeaders:E(t)}),f=function(t,e){var n=t.date,r=t.secretAccessKey,i=t.region,o=t.service,s=H(n.short,"AWS4"+r),a=H(i,s),c=H(o,a),u=H("aws4_request",c);return H(e,u)}(u,function(t,e){var n=t.algorithm,r=t.date,i=t.region,o=t.service;return[n,r.long,r.short+"/"+i+"/"+o+"/aws4_request",z(e)].join("\n")}(u,(s=(n=u).method,a=n.body,c=n.sortedHeaders,[s.toUpperCase(),(r=n,i=r.service,o=r.url,"s3"===i?o.pathname:o.pathname.replace(I,"/").split("/").map(M).join("/")),x(n),k(c),"",D(c),z("string"==typeof a?a.trim():a)].join("\n")))),h=K(u,f);return t.headers["X-Amz-Date"]=u.date.long,e.sessionToken&&(t.headers["X-Amz-Security-Token"]=e.sessionToken),t.headers.Authorization=h,t}}); +/*! aws-sig@2.0.0 !*/ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["aws-sig"]={})}(this,(function(e){"use strict";var t=function(e){return e.toString().trim().replace(/\s+/g," ")},r=function(e){return e.map((function(e){return e[0]})).join(";")},n=function(e){var t=e.headers;return void 0===t&&(t={}),Object.keys(t).map((function(e){return[e.toLowerCase(),t[e]]})).sort((function(e,t){var r=e[0],n=t[0];return r.localeCompare(n)}))},i=function(e){var t=e.accessKeyId,r=e.date,n=e.region,i=e.service;return t+"/"+r.short+"/"+n+"/"+i+"/aws4_request"},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),s={},a=s.lib={},u=a.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=u.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=Math.ceil(t/4)},clone:function(){var e=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t,r=[],n=function(e){e=e;var t=987654321,r=4294967295;return function(){var n=((t=36969*(65535&t)+(t>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return n/=4294967296,(n+=.5)*(Math.random()>.5?1:-1)}},i=0;i>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},d=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},l=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},g=a.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,n=t.sigBytes,i=this.blockSize,o=n/(4*i),s=(o=e?Math.ceil(o):Math.max((0|o)-this._minBufferSize,0))*i,a=Math.min(4*s,n);if(s){for(var u=0;un&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,a=o.words,u=0;u>>7)^(d<<14|d>>>18)^d>>>3,g=b[h-2],p=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;b[h]=l+b[h-7]+p+b[h-16]}var v=n&i^n&o^i&o,y=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&c)+j[h]+b[h];f=c,c=u,u=a,a=s+m|0,s=o,o=i,i=n,n=m+(y+v)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+c|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=A.clone.call(this);return e._hash=this._hash.clone(),e}}),M=A._createHelper(H),x=A._createHmacHelper(H),C=function(e){return M(e).toString()},k=x,O=function(e){return encodeURIComponent(e).replace(/[*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))},T=function(e,t){return e.localeCompare(t)};function D(e){var t=e.url,r={},n=[];return t.searchParams.forEach((function(e,t){r[t]||(r[t]=[]),r[t].push(e)})),Object.keys(r).sort(T).forEach((function(e){r[e].sort(T).forEach((function(t){n.push(O(e)+"="+O(t))}))})),n.join("&")}var E=/\/\/+/g;function I(e,t){var r=e.algorithm,n=e.date,i=e.region,o=e.service;return[r,n.long,n.short+"/"+i+"/"+o+"/aws4_request",C(t)].join("\n")}var U=["url"],X=["accessKeyId","region","secretAccessKey","service"],q=/[:\-]|\.\d{3}/g,K=function(e){var t=e.headers,r=t["X-Amz-Date"],n=t.Date,i=r||new Date(n||Date.now()).toISOString().replace(q,"");return{short:i.split("T")[0],long:i}},P=function(e,i,o){var s=o.before,a=o.after;!function(e,t){if(!e)throw new Error("Missing request object");if(!t)throw new Error("Missing config object");var r=U.filter((function(t){return!e[t]}));if(r.length)throw new Error("Missing required request fields: "+r.join(", "));if((r=X.filter((function(e){return!t[e]}))).length)throw new Error("Missing required config fields: "+r.join(", "))}(e,i),e.headers||(e.headers={});var u=Object.assign(Object.create(null),{method:"GET"},e,i,{url:new URL(e.url),algorithm:"AWS4-HMAC-SHA256",date:K(e),sortedHeaders:n(e)}),c=function(e){var n,i,o,s,a=e.method,u=e.body,c=e.sortedHeaders;return[a.toUpperCase(),(i=e,o=i.service,s=i.url,"s3"===o?s.pathname:s.pathname.replace(E,"/").split("/").map(O).join("/")),D(e),(n=c,n.length?n.map((function(e){var r=e[0],n=e[1];return r+":"+(Array.isArray(n)?n.map(t).join(","):t(n))})).join("\n"):""),"",r(c),C("string"==typeof u?u.trim():u)].join("\n")}(u=s(u)),f=function(e,t){var r=e.date,n=e.secretAccessKey,i=e.region,o=e.service,s=k(r.short,"AWS4"+n),a=k(i,s),u=k(o,a),c=k("aws4_request",u);return k(t,c)}(u,I(u,c));return u.signed={canonical:c,stringToSign:I,signature:f},{url:(u=a(u)).url.toString(),headers:u.headers,method:u.method,body:u.body}},R=function(e){return e},W=function(e){var t=function(e){var t=e.algorithm,n=e.sortedHeaders,o=e.signed.signature;return[t+" Credential="+i(e),"SignedHeaders="+r(n),"Signature="+o].join(", ")}(e);return e.headers["X-Amz-Date"]=e.date.long,e.sessionToken&&(e.headers["X-Amz-Security-Token"]=e.sessionToken),e.headers.Authorization=t,e},F=function(e){var t=e.url;e.headers.host=t.host,e.sortedHeaders=n(e);var r=[["X-Amz-Algorithm",e.algorithm],["X-Amz-Credential",i(e)],["X-Amz-Date",e.date.long],!!e.sessionToken&&["X-Amz-Security-Token",e.sessionToken],["X-Amz-SignedHeaders",e.sortedHeaders.map((function(e){return e[0]})).join(",")]].filter(Boolean).map((function(e){var t=e[0],r=e[1];return t+"="+O(r)})).join("&");return t.search=t.search.length?t.search+"&"+r:r,e},L=function(e){var t=e.url,r=e.signed,n="X-Amz-Signature="+O(r.signature);return t.search=t.search+"&"+n,e.url=t.toString(),e};e.signedHeaders=function(e,t){return P(e,t,{before:R,after:W})},e.signedQuery=function(e,t){return P(e,t,{before:F,after:L})},Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=aws-sig.umd.js.map diff --git a/dist/aws-sig.umd.js.map b/dist/aws-sig.umd.js.map index 9fc162a..7011257 100644 --- a/dist/aws-sig.umd.js.map +++ b/dist/aws-sig.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"aws-sig.umd.js","sources":["../src/crypto-es/core.js","../src/crypto-es/hmac.js","../src/crypto-es/sha256.js","../src/hash.js","../src/encode.js","../src/request/query.js","../src/request/headers.js","../src/request/path.js","../src/validate.js","../src/authorization.js","../src/index.js","../src/request/request.js","../src/signature.js","../src/stringtosign.js"],"sourcesContent":["/**\r\n * CryptoJS core components.\r\n */\r\n/*\r\n\t* Local polyfil of Object.create\r\n\t*/\r\nvar create = Object.create || (function () {\r\n\tfunction F() {};\r\n\r\n\treturn function (obj) {\r\n\t\tvar subtype;\r\n\r\n\t\tF.prototype = obj;\r\n\r\n\t\tsubtype = new F();\r\n\r\n\t\tF.prototype = null;\r\n\r\n\t\treturn subtype;\r\n\t};\r\n}())\r\n\r\n/**\r\n * CryptoJS namespace.\r\n */\r\nvar C = {};\r\n\r\n/**\r\n * Library namespace.\r\n */\r\nvar C_lib = C.lib = {};\r\n\r\n/**\r\n * Base object for prototypal inheritance.\r\n */\r\nvar Base = C_lib.Base = (function () {\r\n\r\n\r\n\treturn {\r\n\t\t/**\r\n\t\t * Creates a new object that inherits from this object.\r\n\t\t *\r\n\t\t * @param {Object} overrides Properties to copy into the new object.\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * field: 'value',\r\n\t\t *\r\n\t\t * method: function () {\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\textend: function (overrides) {\r\n\t\t\t// Spawn\r\n\t\t\tvar subtype = create(this);\r\n\r\n\t\t\t// Augment\r\n\t\t\tif (overrides) {\r\n\t\t\t\tsubtype.mixIn(overrides);\r\n\t\t\t}\r\n\r\n\t\t\t// Create default initializer\r\n\t\t\tif (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\r\n\t\t\t\tsubtype.init = function () {\r\n\t\t\t\t\tsubtype.$super.init.apply(this, arguments);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\t// Initializer's prototype is the subtype object\r\n\t\t\tsubtype.init.prototype = subtype;\r\n\r\n\t\t\t// Reference supertype\r\n\t\t\tsubtype.$super = this;\r\n\r\n\t\t\treturn subtype;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Extends this object and runs the init method.\r\n\t\t * Arguments to create() will be passed to init().\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var instance = MyType.create();\r\n\t\t */\r\n\t\tcreate: function () {\r\n\t\t\tvar instance = this.extend();\r\n\t\t\tinstance.init.apply(instance, arguments);\r\n\r\n\t\t\treturn instance;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Initializes a newly created object.\r\n\t\t * Override this method to add some logic when your objects are created.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * init: function () {\r\n\t\t * // ...\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\tinit: function () {\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Copies properties into this object.\r\n\t\t *\r\n\t\t * @param {Object} properties The properties to mix in.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * MyType.mixIn({\r\n\t\t * field: 'value'\r\n\t\t * });\r\n\t\t */\r\n\t\tmixIn: function (properties) {\r\n\t\t\tfor (var propertyName in properties) {\r\n\t\t\t\tif (properties.hasOwnProperty(propertyName)) {\r\n\t\t\t\t\tthis[propertyName] = properties[propertyName];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// IE won't copy toString using the loop above\r\n\t\t\tif (properties.hasOwnProperty('toString')) {\r\n\t\t\t\tthis.toString = properties.toString;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Creates a copy of this object.\r\n\t\t *\r\n\t\t * @return {Object} The clone.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var clone = instance.clone();\r\n\t\t */\r\n\t\tclone: function () {\r\n\t\t\treturn this.init.prototype.extend(this);\r\n\t\t}\r\n\t};\r\n}());\r\n\r\n/**\r\n * An array of 32-bit words.\r\n *\r\n * @property {Array} words The array of 32-bit words.\r\n * @property {number} sigBytes The number of significant bytes in this word array.\r\n */\r\nvar WordArray = C_lib.WordArray = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created word array.\r\n\t *\r\n\t * @param {Array} words (Optional) An array of 32-bit words.\r\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.create();\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\r\n\t */\r\n\tinit: function (words, sigBytes) {\r\n\t\twords = this.words = words || [];\r\n\r\n\t\tif (sigBytes != undefined) {\r\n\t\t\tthis.sigBytes = sigBytes;\r\n\t\t} else {\r\n\t\t\tthis.sigBytes = words.length * 4;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts this word array to a string.\r\n\t *\r\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\r\n\t *\r\n\t * @return {string} The stringified word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var string = wordArray + '';\r\n\t * var string = wordArray.toString();\r\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\r\n\t */\r\n\ttoString: function (encoder) {\r\n\t\treturn (encoder || Hex).stringify(this);\r\n\t},\r\n\r\n\t/**\r\n\t * Concatenates a word array to this word array.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array to append.\r\n\t *\r\n\t * @return {WordArray} This word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray1.concat(wordArray2);\r\n\t */\r\n\tconcat: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar thisWords = this.words;\r\n\t\tvar thatWords = wordArray.words;\r\n\t\tvar thisSigBytes = this.sigBytes;\r\n\t\tvar thatSigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Clamp excess bits\r\n\t\tthis.clamp();\r\n\r\n\t\t// Concat\r\n\t\tif (thisSigBytes % 4) {\r\n\t\t\t// Copy one byte at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i++) {\r\n\t\t\t\tvar thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Copy one word at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i += 4) {\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.sigBytes += thatSigBytes;\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Removes insignificant bits.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray.clamp();\r\n\t */\r\n\tclamp: function () {\r\n\t\t// Shortcuts\r\n\t\tvar words = this.words;\r\n\t\tvar sigBytes = this.sigBytes;\r\n\r\n\t\t// Clamp\r\n\t\twords[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\r\n\t\twords.length = Math.ceil(sigBytes / 4);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this word array.\r\n\t *\r\n\t * @return {WordArray} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = wordArray.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone.words = this.words.slice(0);\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a word array filled with random bytes.\r\n\t *\r\n\t * @param {number} nBytes The number of random bytes to generate.\r\n\t *\r\n\t * @return {WordArray} The random word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\r\n\t */\r\n\trandom: function (nBytes) {\r\n\t\tvar words = [];\r\n\r\n\t\tvar r = (function (m_w) {\r\n\t\t\tvar m_w = m_w;\r\n\t\t\tvar m_z = 0x3ade68b1;\r\n\t\t\tvar mask = 0xffffffff;\r\n\r\n\t\t\treturn function () {\r\n\t\t\t\tm_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\r\n\t\t\t\tm_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\r\n\t\t\t\tvar result = ((m_z << 0x10) + m_w) & mask;\r\n\t\t\t\tresult /= 0x100000000;\r\n\t\t\t\tresult += 0.5;\r\n\t\t\t\treturn result * (Math.random() > .5 ? 1 : -1);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfor (var i = 0, rcache; i < nBytes; i += 4) {\r\n\t\t\tvar _r = r((rcache || Math.random()) * 0x100000000);\r\n\r\n\t\t\trcache = _r() * 0x3ade67b7;\r\n\t\t\twords.push((_r() * 0x100000000) | 0);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, nBytes);\r\n\t}\r\n});\r\n\r\n/**\r\n * Encoder namespace.\r\n */\r\nvar C_enc = C.enc = {};\r\n\r\n/**\r\n * Hex encoding strategy.\r\n */\r\nvar Hex = C_enc.Hex = {\r\n\t/**\r\n\t * Converts a word array to a hex string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The hex string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar hexChars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\thexChars.push((bite >>> 4).toString(16));\r\n\t\t\thexChars.push((bite & 0x0f).toString(16));\r\n\t\t}\r\n\r\n\t\treturn hexChars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a hex string to a word array.\r\n\t *\r\n\t * @param {string} hexStr The hex string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\r\n\t */\r\n\tparse: function (hexStr) {\r\n\t\t// Shortcut\r\n\t\tvar hexStrLength = hexStr.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < hexStrLength; i += 2) {\r\n\t\t\twords[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, hexStrLength / 2);\r\n\t}\r\n};\r\n\r\n/**\r\n * Latin1 encoding strategy.\r\n */\r\nvar Latin1 = C_enc.Latin1 = {\r\n\t/**\r\n\t * Converts a word array to a Latin1 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The Latin1 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar latin1Chars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\tlatin1Chars.push(String.fromCharCode(bite));\r\n\t\t}\r\n\r\n\t\treturn latin1Chars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a Latin1 string to a word array.\r\n\t *\r\n\t * @param {string} latin1Str The Latin1 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\r\n\t */\r\n\tparse: function (latin1Str) {\r\n\t\t// Shortcut\r\n\t\tvar latin1StrLength = latin1Str.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < latin1StrLength; i++) {\r\n\t\t\twords[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, latin1StrLength);\r\n\t}\r\n};\r\n\r\n/**\r\n * UTF-8 encoding strategy.\r\n */\r\nvar Utf8 = C_enc.Utf8 = {\r\n\t/**\r\n\t * Converts a word array to a UTF-8 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The UTF-8 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\ttry {\r\n\t\t\treturn decodeURIComponent(escape(Latin1.stringify(wordArray)));\r\n\t\t} catch (e) {\r\n\t\t\tthrow new Error('Malformed UTF-8 data');\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a UTF-8 string to a word array.\r\n\t *\r\n\t * @param {string} utf8Str The UTF-8 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\r\n\t */\r\n\tparse: function (utf8Str) {\r\n\t\treturn Latin1.parse(unescape(encodeURIComponent(utf8Str)));\r\n\t}\r\n};\r\n\r\n/**\r\n * Abstract buffered block algorithm template.\r\n *\r\n * The property blockSize must be implemented in a concrete subtype.\r\n *\r\n * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\r\n */\r\nvar BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\r\n\t/**\r\n\t * Resets this block algorithm's data buffer to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Initial values\r\n\t\tthis._data = new WordArray.init();\r\n\t\tthis._nDataBytes = 0;\r\n\t},\r\n\r\n\t/**\r\n\t * Adds new data to this block algorithm's buffer.\r\n\t *\r\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm._append('data');\r\n\t * bufferedBlockAlgorithm._append(wordArray);\r\n\t */\r\n\t_append: function (data) {\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof data == 'string') {\r\n\t\t\tdata = Utf8.parse(data);\r\n\t\t}\r\n\r\n\t\t// Append\r\n\t\tthis._data.concat(data);\r\n\t\tthis._nDataBytes += data.sigBytes;\r\n\t},\r\n\r\n\t/**\r\n\t * Processes available data blocks.\r\n\t *\r\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\r\n\t *\r\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\r\n\t *\r\n\t * @return {WordArray} The processed data.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var processedData = bufferedBlockAlgorithm._process();\r\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\r\n\t */\r\n\t_process: function (doFlush) {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\t\tvar dataSigBytes = data.sigBytes;\r\n\t\tvar blockSize = this.blockSize;\r\n\t\tvar blockSizeBytes = blockSize * 4;\r\n\r\n\t\t// Count blocks ready\r\n\t\tvar nBlocksReady = dataSigBytes / blockSizeBytes;\r\n\t\tif (doFlush) {\r\n\t\t\t// Round up to include partial blocks\r\n\t\t\tnBlocksReady = Math.ceil(nBlocksReady);\r\n\t\t} else {\r\n\t\t\t// Round down to include only full blocks,\r\n\t\t\t// less the number of blocks that must remain in the buffer\r\n\t\t\tnBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\r\n\t\t}\r\n\r\n\t\t// Count words ready\r\n\t\tvar nWordsReady = nBlocksReady * blockSize;\r\n\r\n\t\t// Count bytes ready\r\n\t\tvar nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\r\n\r\n\t\t// Process blocks\r\n\t\tif (nWordsReady) {\r\n\t\t\tfor (var offset = 0; offset < nWordsReady; offset += blockSize) {\r\n\t\t\t\t// Perform concrete-algorithm logic\r\n\t\t\t\tthis._doProcessBlock(dataWords, offset);\r\n\t\t\t}\r\n\r\n\t\t\t// Remove processed words\r\n\t\t\tvar processedWords = dataWords.splice(0, nWordsReady);\r\n\t\t\tdata.sigBytes -= nBytesReady;\r\n\t\t}\r\n\r\n\t\t// Return processed words\r\n\t\treturn new WordArray.init(processedWords, nBytesReady);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this object.\r\n\t *\r\n\t * @return {Object} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = bufferedBlockAlgorithm.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone._data = this._data.clone();\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t_minBufferSize: 0\r\n});\r\n\r\n/**\r\n * Abstract hasher template.\r\n *\r\n * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\r\n */\r\nvar Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\r\n\t/**\r\n\t * Configuration options.\r\n\t */\r\n\tcfg: Base.extend(),\r\n\r\n\t/**\r\n\t * Initializes a newly created hasher.\r\n\t *\r\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hasher = CryptoJS.algo.SHA256.create();\r\n\t */\r\n\tinit: function (cfg) {\r\n\t\t// Apply config defaults\r\n\t\tthis.cfg = this.cfg.extend(cfg);\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this hasher to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Reset data buffer\r\n\t\tBufferedBlockAlgorithm.reset.call(this);\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tthis._doReset();\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this hasher with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {Hasher} This hasher.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.update('message');\r\n\t * hasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\t// Append\r\n\t\tthis._append(messageUpdate);\r\n\r\n\t\t// Update the hash\r\n\t\tthis._process();\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the hash computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The hash.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hash = hasher.finalize();\r\n\t * var hash = hasher.finalize('message');\r\n\t * var hash = hasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Final message update\r\n\t\tif (messageUpdate) {\r\n\t\t\tthis._append(messageUpdate);\r\n\t\t}\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tvar hash = this._doFinalize();\r\n\r\n\t\treturn hash;\r\n\t},\r\n\r\n\tblockSize: 512/32,\r\n\r\n\t/**\r\n\t * Creates a shortcut function to a hasher's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to create a helper for.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHelper: function (hasher) {\r\n\t\treturn function (message, cfg) {\r\n\t\t\treturn new hasher.init(cfg).finalize(message);\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a shortcut function to the HMAC's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHmacHelper: function (hasher) {\r\n\t\treturn function (message, key) {\r\n\t\t\treturn new C_algo.HMAC.init(hasher, key).finalize(message);\r\n\t\t};\r\n\t}\r\n});\r\n\r\n/**\r\n * Algorithm namespace.\r\n */\r\nvar C_algo = C.algo = {};\r\n\r\nexport default C;\r\n","import Crypto from \"./core.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar Base = C_lib.Base;\r\nvar C_enc = C.enc;\r\nvar Utf8 = C_enc.Utf8;\r\nvar C_algo = C.algo;\r\n\r\n/**\r\n * HMAC algorithm.\r\n */\r\nvar HMAC = C_algo.HMAC = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created HMAC.\r\n\t *\r\n\t * @param {Hasher} hasher The hash algorithm to use.\r\n\t * @param {WordArray|string} key The secret key.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\r\n\t */\r\n\tinit: function (hasher, key) {\r\n\t\t// Init hasher\r\n\t\thasher = this._hasher = new hasher.init();\r\n\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof key == 'string') {\r\n\t\t\tkey = Utf8.parse(key);\r\n\t\t}\r\n\r\n\t\t// Shortcuts\r\n\t\tvar hasherBlockSize = hasher.blockSize;\r\n\t\tvar hasherBlockSizeBytes = hasherBlockSize * 4;\r\n\r\n\t\t// Allow arbitrary length keys\r\n\t\tif (key.sigBytes > hasherBlockSizeBytes) {\r\n\t\t\tkey = hasher.finalize(key);\r\n\t\t}\r\n\r\n\t\t// Clamp excess bits\r\n\t\tkey.clamp();\r\n\r\n\t\t// Clone key for inner and outer pads\r\n\t\tvar oKey = this._oKey = key.clone();\r\n\t\tvar iKey = this._iKey = key.clone();\r\n\r\n\t\t// Shortcuts\r\n\t\tvar oKeyWords = oKey.words;\r\n\t\tvar iKeyWords = iKey.words;\r\n\r\n\t\t// XOR keys with pad constants\r\n\t\tfor (var i = 0; i < hasherBlockSize; i++) {\r\n\t\t\toKeyWords[i] ^= 0x5c5c5c5c;\r\n\t\t\tiKeyWords[i] ^= 0x36363636;\r\n\t\t}\r\n\t\toKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this HMAC to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Reset\r\n\t\thasher.reset();\r\n\t\thasher.update(this._iKey);\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this HMAC with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {HMAC} This HMAC instance.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.update('message');\r\n\t * hmacHasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\tthis._hasher.update(messageUpdate);\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the HMAC computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The HMAC.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmac = hmacHasher.finalize();\r\n\t * var hmac = hmacHasher.finalize('message');\r\n\t * var hmac = hmacHasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Compute HMAC\r\n\t\tvar innerHash = hasher.finalize(messageUpdate);\r\n\t\thasher.reset();\r\n\t\tvar hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\r\n\r\n\t\treturn hmac;\r\n\t}\r\n});\r\n","import Crypto from \"./core.js\";\r\nimport \"./hmac.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar WordArray = C_lib.WordArray;\r\nvar Hasher = C_lib.Hasher;\r\nvar C_algo = C.algo;\r\n\r\n// Initialization and round constants tables\r\nvar H = [];\r\nvar K = [];\r\n\r\n// Compute constants\r\n(function () {\r\n\tfunction isPrime(n) {\r\n\t\tvar sqrtN = Math.sqrt(n);\r\n\t\tfor (var factor = 2; factor <= sqrtN; factor++) {\r\n\t\t\tif (!(n % factor)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\tfunction getFractionalBits(n) {\r\n\t\treturn ((n - (n | 0)) * 0x100000000) | 0;\r\n\t}\r\n\r\n\tvar n = 2;\r\n\tvar nPrime = 0;\r\n\twhile (nPrime < 64) {\r\n\t\tif (isPrime(n)) {\r\n\t\t\tif (nPrime < 8) {\r\n\t\t\t\tH[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\r\n\t\t\t}\r\n\t\t\tK[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\r\n\r\n\t\t\tnPrime++;\r\n\t\t}\r\n\r\n\t\tn++;\r\n\t}\r\n}());\r\n\r\n// Reusable object\r\nvar W = [];\r\n\r\n/**\r\n * SHA-256 hash algorithm.\r\n */\r\nvar SHA256Hasher = C_algo.SHA256 = Hasher.extend({\r\n\t_doReset: function () {\r\n\t\tthis._hash = new WordArray.init(H.slice(0));\r\n\t},\r\n\r\n\t_doProcessBlock: function (M, offset) {\r\n\t\t// Shortcut\r\n\t\tvar H = this._hash.words;\r\n\r\n\t\t// Working variables\r\n\t\tvar a = H[0];\r\n\t\tvar b = H[1];\r\n\t\tvar c = H[2];\r\n\t\tvar d = H[3];\r\n\t\tvar e = H[4];\r\n\t\tvar f = H[5];\r\n\t\tvar g = H[6];\r\n\t\tvar h = H[7];\r\n\r\n\t\t// Computation\r\n\t\tfor (var i = 0; i < 64; i++) {\r\n\t\t\tif (i < 16) {\r\n\t\t\t\tW[i] = M[offset + i] | 0;\r\n\t\t\t} else {\r\n\t\t\t\tvar gamma0x = W[i - 15];\r\n\t\t\t\tvar gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\r\n\t\t\t\t\t\t\t\t((gamma0x << 14) | (gamma0x >>> 18)) ^\r\n\t\t\t\t\t\t\t\t(gamma0x >>> 3);\r\n\r\n\t\t\t\tvar gamma1x = W[i - 2];\r\n\t\t\t\tvar gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\r\n\t\t\t\t\t\t\t\t((gamma1x << 13) | (gamma1x >>> 19)) ^\r\n\t\t\t\t\t\t\t\t(gamma1x >>> 10);\r\n\r\n\t\t\t\tW[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\r\n\t\t\t}\r\n\r\n\t\t\tvar ch = (e & f) ^ (~e & g);\r\n\t\t\tvar maj = (a & b) ^ (a & c) ^ (b & c);\r\n\r\n\t\t\tvar sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\r\n\t\t\tvar sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\r\n\r\n\t\t\tvar t1 = h + sigma1 + ch + K[i] + W[i];\r\n\t\t\tvar t2 = sigma0 + maj;\r\n\r\n\t\t\th = g;\r\n\t\t\tg = f;\r\n\t\t\tf = e;\r\n\t\t\te = (d + t1) | 0;\r\n\t\t\td = c;\r\n\t\t\tc = b;\r\n\t\t\tb = a;\r\n\t\t\ta = (t1 + t2) | 0;\r\n\t\t}\r\n\r\n\t\t// Intermediate hash value\r\n\t\tH[0] = (H[0] + a) | 0;\r\n\t\tH[1] = (H[1] + b) | 0;\r\n\t\tH[2] = (H[2] + c) | 0;\r\n\t\tH[3] = (H[3] + d) | 0;\r\n\t\tH[4] = (H[4] + e) | 0;\r\n\t\tH[5] = (H[5] + f) | 0;\r\n\t\tH[6] = (H[6] + g) | 0;\r\n\t\tH[7] = (H[7] + h) | 0;\r\n\t},\r\n\r\n\t_doFinalize: function () {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\r\n\t\tvar nBitsTotal = this._nDataBytes * 8;\r\n\t\tvar nBitsLeft = data.sigBytes * 8;\r\n\r\n\t\t// Add padding\r\n\t\tdataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\r\n\t\tdata.sigBytes = dataWords.length * 4;\r\n\r\n\t\t// Hash final blocks\r\n\t\tthis._process();\r\n\r\n\t\t// Return final computed hash\r\n\t\treturn this._hash;\r\n\t},\r\n\r\n\tclone: function () {\r\n\t\tvar clone = Hasher.clone.call(this);\r\n\t\tclone._hash = this._hash.clone();\r\n\r\n\t\treturn clone;\r\n\t}\r\n});\r\n\r\n/**\r\n * Shortcut function to the hasher's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n *\r\n * @return {WordArray} The hash.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hash = CryptoJS.SHA256('message');\r\n * var hash = CryptoJS.SHA256(wordArray);\r\n */\r\nconst SHA256 = Hasher._createHelper(SHA256Hasher);\r\n\r\n/**\r\n * Shortcut function to the HMAC's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n * @param {WordArray|string} key The secret key.\r\n *\r\n * @return {WordArray} The HMAC.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hmac = CryptoJS.HmacSHA256(message, key);\r\n */\r\nconst HmacSHA256 = Hasher._createHmacHelper(SHA256Hasher);\r\n\r\nexport { SHA256, HmacSHA256 };\r\n","/* eslint-disable new-cap */\r\nimport { SHA256, HmacSHA256 } from \"./crypto-es/sha256.js\";\r\n\r\nconst hash = (str) =>\r\n SHA256(str).toString();\r\n\r\nconst hmac = HmacSHA256;\r\n \r\nexport { hmac, hash };\r\n","\"use strict\";\r\n\r\n// Replace one extra character beyond what encodeURIComponent does, \"*\"\r\n// See https://github.com/aws/aws-sdk-js/blob/38bf84c144281f696768e8c64500f2847fe6f298/lib/util.js#L39-L49\r\nconst encode = (str) =>\r\n encodeURIComponent(str)\r\n .replace(/[*]/g, (x) =>\r\n // eslint-disable-next-line newline-per-chained-call\r\n `%${x.charCodeAt(0).toString(16).toUpperCase()}`\r\n );\r\n\r\nexport default encode;\r\n","import encode from \"../encode.js\";\r\n\r\nconst sort = (a, b) => a.localeCompare(b);\r\n\r\n// Sort query parameters by key\r\n// Then also sort by value because AWS\r\nexport default ({ url }) => {\r\n const source = {};\r\n const params = [];\r\n \r\n url.searchParams.forEach((value, key) => {\r\n if(!source[key]) {\r\n source[key] = [];\r\n }\r\n\r\n source[key].push(value);\r\n });\r\n\r\n Object.keys(source)\r\n .sort(sort)\r\n .forEach((key) => {\r\n source[key]\r\n .sort(sort)\r\n .forEach((value) => {\r\n params.push(`${encode(key)}=${encode(value)}`);\r\n });\r\n });\r\n\r\n return params.join(\"&\");\r\n};\r\n","const trim = (val) => {\r\n return val\r\n .toString()\r\n .trim()\r\n .replace(/\\s+/g, \" \");\r\n};\r\n\r\nconst values = (headers) => {\r\n if(!headers.length) {\r\n return \"\";\r\n }\r\n\r\n return headers\r\n .map(([ key, vals ]) => {\r\n return `${key}:${Array.isArray(vals) ? vals.map(trim).join(\",\") : trim(vals)}`;\r\n })\r\n .join(\"\\n\");\r\n};\r\n\r\nconst signed = (headers) => {\r\n return headers\r\n .map(([ key ]) => key)\r\n .join(\";\");\r\n};\r\n\r\nconst sorted = ({ headers = {} }) => {\r\n const out = Object.keys(headers).map((key) => [ key.toLowerCase(), headers[key] ]);\r\n\r\n return out.sort(([ keya ], [ keyb ]) => keya.localeCompare(keyb));\r\n};\r\n\r\nexport { sorted, values, signed };\r\n","import encode from \"../encode.js\";\r\n\r\nconst multipleSlashesRegex = /\\/\\/+/g;\r\n\r\nexport default ({ service, url }) => {\r\n // S3 doesn't use normalized paths at all\r\n if(service === \"s3\") {\r\n return url.pathname;\r\n }\r\n \r\n return url.pathname\r\n .replace(multipleSlashesRegex, \"/\")\r\n .split(\"/\")\r\n .map(encode)\r\n .join(\"/\");\r\n};\r\n","const requestRequired = [\r\n \"url\",\r\n];\r\n\r\nconst configRequired = [\r\n \"accessKeyId\",\r\n \"region\",\r\n \"secretAccessKey\",\r\n \"service\",\r\n];\r\n\r\n// Check for required params\r\nconst validate = (source, config) => {\r\n if(!source) {\r\n throw new Error(`Missing request object`);\r\n }\r\n\r\n if(!config) {\r\n throw new Error(`Missing config object`);\r\n }\r\n\r\n let missing = requestRequired.filter((field) => !source[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required request fields: ${missing.join(\", \")}`);\r\n }\r\n \r\n missing = configRequired.filter((field) => !config[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required config fields: ${missing.join(\", \")}`);\r\n }\r\n};\r\n\r\nexport default validate;\r\n","import { signed } from \"./request/headers.js\";\r\n\r\nconst authorization = (req, sig) => {\r\n const {\r\n algorithm,\r\n accessKeyId,\r\n date,\r\n region,\r\n service,\r\n sortedHeaders,\r\n } = req;\r\n\r\n return [\r\n `${algorithm} Credential=${accessKeyId}/${date.short}/${region}/${service}/aws4_request`,\r\n `SignedHeaders=${signed(sortedHeaders)}`,\r\n `Signature=${sig}`,\r\n ].join(\", \");\r\n};\r\n\r\nexport default authorization;\r\n","import testing from \"consts:testing\";\r\n\r\nimport request from \"./request/request.js\";\r\nimport { sorted } from \"./request/headers.js\";\r\nimport stringToSign from \"./stringtosign.js\";\r\nimport signature from \"./signature.js\";\r\nimport validate from \"./validate.js\";\r\nimport authorization from \"./authorization.js\";\r\n\r\nconst dateCleanRegex = /[:\\-]|\\.\\d{3}/g;\r\n\r\nconst parseDate = ({ headers }) => {\r\n const datetime = \"X-Amz-Date\" in headers ?\r\n headers[\"X-Amz-Date\"] :\r\n (new Date(headers.Date || Date.now()))\r\n .toISOString()\r\n .replace(dateCleanRegex, \"\");\r\n\r\n return {\r\n short : datetime.split(\"T\")[0],\r\n long : datetime,\r\n };\r\n};\r\n\r\nexport default (source, config) => {\r\n validate(source, config);\r\n\r\n if(!source.headers) {\r\n source.headers = {};\r\n }\r\n\r\n const details = Object.assign(\r\n Object.create(null),\r\n {\r\n method : \"GET\",\r\n },\r\n source,\r\n config,\r\n {\r\n url : new URL(source.url),\r\n algorithm : \"AWS4-HMAC-SHA256\",\r\n date : parseDate(source),\r\n sortedHeaders : sorted(source),\r\n }\r\n );\r\n\r\n const canonical = request(details);\r\n const sts = stringToSign(details, canonical);\r\n const sig = signature(details, sts);\r\n const auth = authorization(details, sig);\r\n\r\n source.headers[\"X-Amz-Date\"] = details.date.long;\r\n \r\n if(config.sessionToken) {\r\n source.headers[\"X-Amz-Security-Token\"] = config.sessionToken;\r\n }\r\n \r\n source.headers.Authorization = auth;\r\n\r\n // Add partial output to response for tests so each step can be validated\r\n /* istanbul ignore next */\r\n if(testing) {\r\n source.test = {\r\n canonical,\r\n sts,\r\n auth,\r\n };\r\n }\r\n\r\n return source;\r\n};\r\n","import { hash } from \"../hash.js\";\r\n\r\nimport query from \"./query.js\";\r\nimport { values, signed } from \"./headers.js\";\r\nimport path from \"./path.js\";\r\n\r\nexport default (req) => {\r\n const { method, body, sortedHeaders } = req;\r\n\r\n // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\r\n return [\r\n method.toUpperCase(),\r\n \r\n // Canonical Path\r\n path(req),\r\n \r\n // Canonical Query\r\n query(req),\r\n \r\n // Canonical Headers\r\n values(sortedHeaders),\r\n\r\n // Extra linebreak\r\n \"\",\r\n\r\n // Signed Headers\r\n signed(sortedHeaders),\r\n\r\n // Hashed payload\r\n hash(typeof body === \"string\" ? body.trim() : body),\r\n ].join(\"\\n\");\r\n};\r\n","import { hmac } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\r\nexport default ({ date, secretAccessKey, region, service }, sts) => {\r\n const kDate = hmac(date.short, `AWS4${secretAccessKey}`);\r\n const kRegion = hmac(region, kDate);\r\n const kService = hmac(service, kRegion);\r\n const kSignature = hmac(\"aws4_request\", kService);\r\n\r\n return hmac(sts, kSignature);\r\n};\r\n","import { hash } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\r\nexport default ({ algorithm, date, region, service }, canonical) => [\r\n // Signing Function\r\n algorithm,\r\n \r\n // Date Time\r\n date.long,\r\n \r\n // Scope\r\n `${date.short}/${region}/${service}/aws4_request`,\r\n \r\n // Signed canonical request\r\n hash(canonical),\r\n ].join(\"\\n\");\r\n"],"names":["create","Object","F","obj","subtype","prototype","C","C_lib","lib","Base","extend","overrides","this","mixIn","hasOwnProperty","init","$super","apply","arguments","instance","properties","propertyName","toString","clone","WordArray","words","sigBytes","undefined","length","encoder","Hex","stringify","concat","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","i","thatByte","Math","ceil","call","slice","random","nBytes","rcache","r","m_w","m_z","mask","result","_r","push","C_enc","enc","hexChars","bite","join","parse","hexStr","hexStrLength","parseInt","substr","Latin1","latin1Chars","String","fromCharCode","latin1Str","latin1StrLength","charCodeAt","Utf8","decodeURIComponent","escape","e","Error","utf8Str","unescape","encodeURIComponent","BufferedBlockAlgorithm","reset","_data","_nDataBytes","_append","data","_process","doFlush","dataWords","dataSigBytes","blockSize","nBlocksReady","nWordsReady","max","_minBufferSize","nBytesReady","min","offset","_doProcessBlock","processedWords","splice","C_algo","Hasher","cfg","_doReset","update","messageUpdate","finalize","_doFinalize","_createHelper","hasher","message","_createHmacHelper","key","HMAC","algo","Crypto","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","innerHash","H","K","isPrime","n","sqrtN","sqrt","factor","getFractionalBits","nPrime","pow","W","SHA256Hasher","SHA256","_hash","M","a","b","c","d","f","g","h","gamma0x","gamma0","gamma1x","gamma1","maj","sigma0","t1","nBitsTotal","nBitsLeft","floor","HmacSHA256","hash","str","hmac","encode","replace","x","toUpperCase","sort","localeCompare","ref","source","params","url","searchParams","forEach","value","keys","const","trim","val","values","headers","map","Array","isArray","vals","signed","sorted","toLowerCase","ref$1","keya","keyb","multipleSlashesRegex","requestRequired","configRequired","validate","config","let","missing","filter","field","authorization","req","sig","algorithm","accessKeyId","date","region","service","sortedHeaders","dateCleanRegex","parseDate","datetime","Date","now","toISOString","short","split","long","details","assign","method","URL","sts","kDate","secretAccessKey","kRegion","kService","kSignature","signature","canonical","stringToSign","pathname","query","body","auth","sessionToken","Authorization"],"mappings":"gMAMA,IAAIA,EAASC,OAAOD,QAAW,WAC9B,SAASE,KAET,OAAO,SAAUC,GAChB,IAAIC,EAQJ,OANAF,EAAEG,UAAYF,EAEdC,EAAU,IAAIF,EAEdA,EAAEG,UAAY,KAEPD,MAOLE,EAAI,GAKJC,EAAQD,EAAEE,IAAM,GAKhBC,EAAOF,EAAME,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MHgCK4K,CAAaZ,MCzCbjB,EDwCciB,qCCpCnB,CACHE,EAAOvD,eJPCG,EIUHiC,sBJRM,OAAZM,EACQpC,EAAI4D,SAGR5D,EAAI4D,SACNpE,QAAQ4B,EAAsB,KAC9ByB,MAAM,KACNnC,IAAInB,GACJxG,KAAK,MIGN8K,EAAM/B,GAGNtB,EAAO6B,GAGP,GAGAvB,EAAOuB,GAGPjD,EAAqB,iBAAT0E,EAAoBA,EAAKxD,OAASwD,IAChD/K,KAAK,SDmBDgL,EAAOlC,EAAckB,EAAShB,GAoBpC,OAlBAjC,EAAOW,QAAQ,cAAgBsC,EAAQb,KAAKY,KAEzCtB,EAAOwC,eACNlE,EAAOW,QAAQ,wBAA0Be,EAAOwC,cAGpDlE,EAAOW,QAAQwD,cAAgBF,EAYxBjE"} \ No newline at end of file +{"version":3,"file":"aws-sig.umd.js","sources":["../src/request/headers.js","../src/lib/credential.js","../src/crypto-es/core.js","../src/crypto-es/hmac.js","../src/crypto-es/sha256.js","../src/lib/hash.js","../src/lib/encode.js","../src/request/query.js","../src/request/path.js","../src/lib/stringtosign.js","../src/lib/validate.js","../src/sign.js","../src/request/request.js","../src/lib/signature.js","../src/signed-headers.js","../src/signed-query.js"],"sourcesContent":["const trim = (val) => {\r\n return val\r\n .toString()\r\n .trim()\r\n .replace(/\\s+/g, \" \");\r\n};\r\n\r\nconst values = (headers) => {\r\n if(!headers.length) {\r\n return \"\";\r\n }\r\n\r\n return headers\r\n .map(([ key, vals ]) => {\r\n return `${key}:${Array.isArray(vals) ? vals.map(trim).join(\",\") : trim(vals)}`;\r\n })\r\n .join(\"\\n\");\r\n};\r\n\r\nconst signed = (headers) => {\r\n return headers\r\n .map(([ key ]) => key)\r\n .join(\";\");\r\n};\r\n\r\nconst sorted = ({ headers = {} }) => {\r\n const out = Object.keys(headers).map((key) => [ key.toLowerCase(), headers[key] ]);\r\n\r\n return out.sort(([ keya ], [ keyb ]) => keya.localeCompare(keyb));\r\n};\r\n\r\nexport { sorted, values, signed };\r\n","const credential = (req) => {\r\n const {\r\n accessKeyId,\r\n date,\r\n region,\r\n service,\r\n } = req;\r\n\r\n return `${accessKeyId}/${date.short}/${region}/${service}/aws4_request`;\r\n};\r\n\r\nexport default credential;\r\n","/**\r\n * CryptoJS core components.\r\n */\r\n/*\r\n\t* Local polyfil of Object.create\r\n\t*/\r\nvar create = Object.create || (function () {\r\n\tfunction F() {};\r\n\r\n\treturn function (obj) {\r\n\t\tvar subtype;\r\n\r\n\t\tF.prototype = obj;\r\n\r\n\t\tsubtype = new F();\r\n\r\n\t\tF.prototype = null;\r\n\r\n\t\treturn subtype;\r\n\t};\r\n}())\r\n\r\n/**\r\n * CryptoJS namespace.\r\n */\r\nvar C = {};\r\n\r\n/**\r\n * Library namespace.\r\n */\r\nvar C_lib = C.lib = {};\r\n\r\n/**\r\n * Base object for prototypal inheritance.\r\n */\r\nvar Base = C_lib.Base = (function () {\r\n\r\n\r\n\treturn {\r\n\t\t/**\r\n\t\t * Creates a new object that inherits from this object.\r\n\t\t *\r\n\t\t * @param {Object} overrides Properties to copy into the new object.\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * field: 'value',\r\n\t\t *\r\n\t\t * method: function () {\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\textend: function (overrides) {\r\n\t\t\t// Spawn\r\n\t\t\tvar subtype = create(this);\r\n\r\n\t\t\t// Augment\r\n\t\t\tif (overrides) {\r\n\t\t\t\tsubtype.mixIn(overrides);\r\n\t\t\t}\r\n\r\n\t\t\t// Create default initializer\r\n\t\t\tif (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\r\n\t\t\t\tsubtype.init = function () {\r\n\t\t\t\t\tsubtype.$super.init.apply(this, arguments);\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\t// Initializer's prototype is the subtype object\r\n\t\t\tsubtype.init.prototype = subtype;\r\n\r\n\t\t\t// Reference supertype\r\n\t\t\tsubtype.$super = this;\r\n\r\n\t\t\treturn subtype;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Extends this object and runs the init method.\r\n\t\t * Arguments to create() will be passed to init().\r\n\t\t *\r\n\t\t * @return {Object} The new object.\r\n\t\t *\r\n\t\t * @static\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var instance = MyType.create();\r\n\t\t */\r\n\t\tcreate: function () {\r\n\t\t\tvar instance = this.extend();\r\n\t\t\tinstance.init.apply(instance, arguments);\r\n\r\n\t\t\treturn instance;\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Initializes a newly created object.\r\n\t\t * Override this method to add some logic when your objects are created.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var MyType = CryptoJS.lib.Base.extend({\r\n\t\t * init: function () {\r\n\t\t * // ...\r\n\t\t * }\r\n\t\t * });\r\n\t\t */\r\n\t\tinit: function () {\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Copies properties into this object.\r\n\t\t *\r\n\t\t * @param {Object} properties The properties to mix in.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * MyType.mixIn({\r\n\t\t * field: 'value'\r\n\t\t * });\r\n\t\t */\r\n\t\tmixIn: function (properties) {\r\n\t\t\tfor (var propertyName in properties) {\r\n\t\t\t\tif (properties.hasOwnProperty(propertyName)) {\r\n\t\t\t\t\tthis[propertyName] = properties[propertyName];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// IE won't copy toString using the loop above\r\n\t\t\tif (properties.hasOwnProperty('toString')) {\r\n\t\t\t\tthis.toString = properties.toString;\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\t/**\r\n\t\t * Creates a copy of this object.\r\n\t\t *\r\n\t\t * @return {Object} The clone.\r\n\t\t *\r\n\t\t * @example\r\n\t\t *\r\n\t\t * var clone = instance.clone();\r\n\t\t */\r\n\t\tclone: function () {\r\n\t\t\treturn this.init.prototype.extend(this);\r\n\t\t}\r\n\t};\r\n}());\r\n\r\n/**\r\n * An array of 32-bit words.\r\n *\r\n * @property {Array} words The array of 32-bit words.\r\n * @property {number} sigBytes The number of significant bytes in this word array.\r\n */\r\nvar WordArray = C_lib.WordArray = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created word array.\r\n\t *\r\n\t * @param {Array} words (Optional) An array of 32-bit words.\r\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.create();\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\r\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\r\n\t */\r\n\tinit: function (words, sigBytes) {\r\n\t\twords = this.words = words || [];\r\n\r\n\t\tif (sigBytes != undefined) {\r\n\t\t\tthis.sigBytes = sigBytes;\r\n\t\t} else {\r\n\t\t\tthis.sigBytes = words.length * 4;\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts this word array to a string.\r\n\t *\r\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\r\n\t *\r\n\t * @return {string} The stringified word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var string = wordArray + '';\r\n\t * var string = wordArray.toString();\r\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\r\n\t */\r\n\ttoString: function (encoder) {\r\n\t\treturn (encoder || Hex).stringify(this);\r\n\t},\r\n\r\n\t/**\r\n\t * Concatenates a word array to this word array.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array to append.\r\n\t *\r\n\t * @return {WordArray} This word array.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray1.concat(wordArray2);\r\n\t */\r\n\tconcat: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar thisWords = this.words;\r\n\t\tvar thatWords = wordArray.words;\r\n\t\tvar thisSigBytes = this.sigBytes;\r\n\t\tvar thatSigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Clamp excess bits\r\n\t\tthis.clamp();\r\n\r\n\t\t// Concat\r\n\t\tif (thisSigBytes % 4) {\r\n\t\t\t// Copy one byte at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i++) {\r\n\t\t\t\tvar thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Copy one word at a time\r\n\t\t\tfor (var i = 0; i < thatSigBytes; i += 4) {\r\n\t\t\t\tthisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.sigBytes += thatSigBytes;\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Removes insignificant bits.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * wordArray.clamp();\r\n\t */\r\n\tclamp: function () {\r\n\t\t// Shortcuts\r\n\t\tvar words = this.words;\r\n\t\tvar sigBytes = this.sigBytes;\r\n\r\n\t\t// Clamp\r\n\t\twords[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\r\n\t\twords.length = Math.ceil(sigBytes / 4);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this word array.\r\n\t *\r\n\t * @return {WordArray} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = wordArray.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone.words = this.words.slice(0);\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a word array filled with random bytes.\r\n\t *\r\n\t * @param {number} nBytes The number of random bytes to generate.\r\n\t *\r\n\t * @return {WordArray} The random word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\r\n\t */\r\n\trandom: function (nBytes) {\r\n\t\tvar words = [];\r\n\r\n\t\tvar r = (function (m_w) {\r\n\t\t\tvar m_w = m_w;\r\n\t\t\tvar m_z = 0x3ade68b1;\r\n\t\t\tvar mask = 0xffffffff;\r\n\r\n\t\t\treturn function () {\r\n\t\t\t\tm_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\r\n\t\t\t\tm_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\r\n\t\t\t\tvar result = ((m_z << 0x10) + m_w) & mask;\r\n\t\t\t\tresult /= 0x100000000;\r\n\t\t\t\tresult += 0.5;\r\n\t\t\t\treturn result * (Math.random() > .5 ? 1 : -1);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tfor (var i = 0, rcache; i < nBytes; i += 4) {\r\n\t\t\tvar _r = r((rcache || Math.random()) * 0x100000000);\r\n\r\n\t\t\trcache = _r() * 0x3ade67b7;\r\n\t\t\twords.push((_r() * 0x100000000) | 0);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, nBytes);\r\n\t}\r\n});\r\n\r\n/**\r\n * Encoder namespace.\r\n */\r\nvar C_enc = C.enc = {};\r\n\r\n/**\r\n * Hex encoding strategy.\r\n */\r\nvar Hex = C_enc.Hex = {\r\n\t/**\r\n\t * Converts a word array to a hex string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The hex string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar hexChars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\thexChars.push((bite >>> 4).toString(16));\r\n\t\t\thexChars.push((bite & 0x0f).toString(16));\r\n\t\t}\r\n\r\n\t\treturn hexChars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a hex string to a word array.\r\n\t *\r\n\t * @param {string} hexStr The hex string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\r\n\t */\r\n\tparse: function (hexStr) {\r\n\t\t// Shortcut\r\n\t\tvar hexStrLength = hexStr.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < hexStrLength; i += 2) {\r\n\t\t\twords[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, hexStrLength / 2);\r\n\t}\r\n};\r\n\r\n/**\r\n * Latin1 encoding strategy.\r\n */\r\nvar Latin1 = C_enc.Latin1 = {\r\n\t/**\r\n\t * Converts a word array to a Latin1 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The Latin1 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\t// Shortcuts\r\n\t\tvar words = wordArray.words;\r\n\t\tvar sigBytes = wordArray.sigBytes;\r\n\r\n\t\t// Convert\r\n\t\tvar latin1Chars = [];\r\n\t\tfor (var i = 0; i < sigBytes; i++) {\r\n\t\t\tvar bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\r\n\t\t\tlatin1Chars.push(String.fromCharCode(bite));\r\n\t\t}\r\n\r\n\t\treturn latin1Chars.join('');\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a Latin1 string to a word array.\r\n\t *\r\n\t * @param {string} latin1Str The Latin1 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\r\n\t */\r\n\tparse: function (latin1Str) {\r\n\t\t// Shortcut\r\n\t\tvar latin1StrLength = latin1Str.length;\r\n\r\n\t\t// Convert\r\n\t\tvar words = [];\r\n\t\tfor (var i = 0; i < latin1StrLength; i++) {\r\n\t\t\twords[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\r\n\t\t}\r\n\r\n\t\treturn new WordArray.init(words, latin1StrLength);\r\n\t}\r\n};\r\n\r\n/**\r\n * UTF-8 encoding strategy.\r\n */\r\nvar Utf8 = C_enc.Utf8 = {\r\n\t/**\r\n\t * Converts a word array to a UTF-8 string.\r\n\t *\r\n\t * @param {WordArray} wordArray The word array.\r\n\t *\r\n\t * @return {string} The UTF-8 string.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\r\n\t */\r\n\tstringify: function (wordArray) {\r\n\t\ttry {\r\n\t\t\treturn decodeURIComponent(escape(Latin1.stringify(wordArray)));\r\n\t\t} catch (e) {\r\n\t\t\tthrow new Error('Malformed UTF-8 data');\r\n\t\t}\r\n\t},\r\n\r\n\t/**\r\n\t * Converts a UTF-8 string to a word array.\r\n\t *\r\n\t * @param {string} utf8Str The UTF-8 string.\r\n\t *\r\n\t * @return {WordArray} The word array.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\r\n\t */\r\n\tparse: function (utf8Str) {\r\n\t\treturn Latin1.parse(unescape(encodeURIComponent(utf8Str)));\r\n\t}\r\n};\r\n\r\n/**\r\n * Abstract buffered block algorithm template.\r\n *\r\n * The property blockSize must be implemented in a concrete subtype.\r\n *\r\n * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\r\n */\r\nvar BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\r\n\t/**\r\n\t * Resets this block algorithm's data buffer to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Initial values\r\n\t\tthis._data = new WordArray.init();\r\n\t\tthis._nDataBytes = 0;\r\n\t},\r\n\r\n\t/**\r\n\t * Adds new data to this block algorithm's buffer.\r\n\t *\r\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * bufferedBlockAlgorithm._append('data');\r\n\t * bufferedBlockAlgorithm._append(wordArray);\r\n\t */\r\n\t_append: function (data) {\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof data == 'string') {\r\n\t\t\tdata = Utf8.parse(data);\r\n\t\t}\r\n\r\n\t\t// Append\r\n\t\tthis._data.concat(data);\r\n\t\tthis._nDataBytes += data.sigBytes;\r\n\t},\r\n\r\n\t/**\r\n\t * Processes available data blocks.\r\n\t *\r\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\r\n\t *\r\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\r\n\t *\r\n\t * @return {WordArray} The processed data.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var processedData = bufferedBlockAlgorithm._process();\r\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\r\n\t */\r\n\t_process: function (doFlush) {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\t\tvar dataSigBytes = data.sigBytes;\r\n\t\tvar blockSize = this.blockSize;\r\n\t\tvar blockSizeBytes = blockSize * 4;\r\n\r\n\t\t// Count blocks ready\r\n\t\tvar nBlocksReady = dataSigBytes / blockSizeBytes;\r\n\t\tif (doFlush) {\r\n\t\t\t// Round up to include partial blocks\r\n\t\t\tnBlocksReady = Math.ceil(nBlocksReady);\r\n\t\t} else {\r\n\t\t\t// Round down to include only full blocks,\r\n\t\t\t// less the number of blocks that must remain in the buffer\r\n\t\t\tnBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\r\n\t\t}\r\n\r\n\t\t// Count words ready\r\n\t\tvar nWordsReady = nBlocksReady * blockSize;\r\n\r\n\t\t// Count bytes ready\r\n\t\tvar nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\r\n\r\n\t\t// Process blocks\r\n\t\tif (nWordsReady) {\r\n\t\t\tfor (var offset = 0; offset < nWordsReady; offset += blockSize) {\r\n\t\t\t\t// Perform concrete-algorithm logic\r\n\t\t\t\tthis._doProcessBlock(dataWords, offset);\r\n\t\t\t}\r\n\r\n\t\t\t// Remove processed words\r\n\t\t\tvar processedWords = dataWords.splice(0, nWordsReady);\r\n\t\t\tdata.sigBytes -= nBytesReady;\r\n\t\t}\r\n\r\n\t\t// Return processed words\r\n\t\treturn new WordArray.init(processedWords, nBytesReady);\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a copy of this object.\r\n\t *\r\n\t * @return {Object} The clone.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var clone = bufferedBlockAlgorithm.clone();\r\n\t */\r\n\tclone: function () {\r\n\t\tvar clone = Base.clone.call(this);\r\n\t\tclone._data = this._data.clone();\r\n\r\n\t\treturn clone;\r\n\t},\r\n\r\n\t_minBufferSize: 0\r\n});\r\n\r\n/**\r\n * Abstract hasher template.\r\n *\r\n * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\r\n */\r\nvar Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\r\n\t/**\r\n\t * Configuration options.\r\n\t */\r\n\tcfg: Base.extend(),\r\n\r\n\t/**\r\n\t * Initializes a newly created hasher.\r\n\t *\r\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hasher = CryptoJS.algo.SHA256.create();\r\n\t */\r\n\tinit: function (cfg) {\r\n\t\t// Apply config defaults\r\n\t\tthis.cfg = this.cfg.extend(cfg);\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this hasher to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Reset data buffer\r\n\t\tBufferedBlockAlgorithm.reset.call(this);\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tthis._doReset();\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this hasher with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {Hasher} This hasher.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hasher.update('message');\r\n\t * hasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\t// Append\r\n\t\tthis._append(messageUpdate);\r\n\r\n\t\t// Update the hash\r\n\t\tthis._process();\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the hash computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The hash.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hash = hasher.finalize();\r\n\t * var hash = hasher.finalize('message');\r\n\t * var hash = hasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Final message update\r\n\t\tif (messageUpdate) {\r\n\t\t\tthis._append(messageUpdate);\r\n\t\t}\r\n\r\n\t\t// Perform concrete-hasher logic\r\n\t\tvar hash = this._doFinalize();\r\n\r\n\t\treturn hash;\r\n\t},\r\n\r\n\tblockSize: 512/32,\r\n\r\n\t/**\r\n\t * Creates a shortcut function to a hasher's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to create a helper for.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHelper: function (hasher) {\r\n\t\treturn function (message, cfg) {\r\n\t\t\treturn new hasher.init(cfg).finalize(message);\r\n\t\t};\r\n\t},\r\n\r\n\t/**\r\n\t * Creates a shortcut function to the HMAC's object interface.\r\n\t *\r\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\r\n\t *\r\n\t * @return {Function} The shortcut function.\r\n\t *\r\n\t * @static\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\r\n\t */\r\n\t_createHmacHelper: function (hasher) {\r\n\t\treturn function (message, key) {\r\n\t\t\treturn new C_algo.HMAC.init(hasher, key).finalize(message);\r\n\t\t};\r\n\t}\r\n});\r\n\r\n/**\r\n * Algorithm namespace.\r\n */\r\nvar C_algo = C.algo = {};\r\n\r\nexport default C;\r\n","import Crypto from \"./core.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar Base = C_lib.Base;\r\nvar C_enc = C.enc;\r\nvar Utf8 = C_enc.Utf8;\r\nvar C_algo = C.algo;\r\n\r\n/**\r\n * HMAC algorithm.\r\n */\r\nvar HMAC = C_algo.HMAC = Base.extend({\r\n\t/**\r\n\t * Initializes a newly created HMAC.\r\n\t *\r\n\t * @param {Hasher} hasher The hash algorithm to use.\r\n\t * @param {WordArray|string} key The secret key.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\r\n\t */\r\n\tinit: function (hasher, key) {\r\n\t\t// Init hasher\r\n\t\thasher = this._hasher = new hasher.init();\r\n\r\n\t\t// Convert string to WordArray, else assume WordArray already\r\n\t\tif (typeof key == 'string') {\r\n\t\t\tkey = Utf8.parse(key);\r\n\t\t}\r\n\r\n\t\t// Shortcuts\r\n\t\tvar hasherBlockSize = hasher.blockSize;\r\n\t\tvar hasherBlockSizeBytes = hasherBlockSize * 4;\r\n\r\n\t\t// Allow arbitrary length keys\r\n\t\tif (key.sigBytes > hasherBlockSizeBytes) {\r\n\t\t\tkey = hasher.finalize(key);\r\n\t\t}\r\n\r\n\t\t// Clamp excess bits\r\n\t\tkey.clamp();\r\n\r\n\t\t// Clone key for inner and outer pads\r\n\t\tvar oKey = this._oKey = key.clone();\r\n\t\tvar iKey = this._iKey = key.clone();\r\n\r\n\t\t// Shortcuts\r\n\t\tvar oKeyWords = oKey.words;\r\n\t\tvar iKeyWords = iKey.words;\r\n\r\n\t\t// XOR keys with pad constants\r\n\t\tfor (var i = 0; i < hasherBlockSize; i++) {\r\n\t\t\toKeyWords[i] ^= 0x5c5c5c5c;\r\n\t\t\tiKeyWords[i] ^= 0x36363636;\r\n\t\t}\r\n\t\toKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\r\n\r\n\t\t// Set initial values\r\n\t\tthis.reset();\r\n\t},\r\n\r\n\t/**\r\n\t * Resets this HMAC to its initial state.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.reset();\r\n\t */\r\n\treset: function () {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Reset\r\n\t\thasher.reset();\r\n\t\thasher.update(this._iKey);\r\n\t},\r\n\r\n\t/**\r\n\t * Updates this HMAC with a message.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate The message to append.\r\n\t *\r\n\t * @return {HMAC} This HMAC instance.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * hmacHasher.update('message');\r\n\t * hmacHasher.update(wordArray);\r\n\t */\r\n\tupdate: function (messageUpdate) {\r\n\t\tthis._hasher.update(messageUpdate);\r\n\r\n\t\t// Chainable\r\n\t\treturn this;\r\n\t},\r\n\r\n\t/**\r\n\t * Finalizes the HMAC computation.\r\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\r\n\t *\r\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\r\n\t *\r\n\t * @return {WordArray} The HMAC.\r\n\t *\r\n\t * @example\r\n\t *\r\n\t * var hmac = hmacHasher.finalize();\r\n\t * var hmac = hmacHasher.finalize('message');\r\n\t * var hmac = hmacHasher.finalize(wordArray);\r\n\t */\r\n\tfinalize: function (messageUpdate) {\r\n\t\t// Shortcut\r\n\t\tvar hasher = this._hasher;\r\n\r\n\t\t// Compute HMAC\r\n\t\tvar innerHash = hasher.finalize(messageUpdate);\r\n\t\thasher.reset();\r\n\t\tvar hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\r\n\r\n\t\treturn hmac;\r\n\t}\r\n});\r\n","import Crypto from \"./core.js\";\r\nimport \"./hmac.js\";\r\n\r\n// Shortcuts\r\nvar C = Crypto;\r\nvar C_lib = C.lib;\r\nvar WordArray = C_lib.WordArray;\r\nvar Hasher = C_lib.Hasher;\r\nvar C_algo = C.algo;\r\n\r\n// Initialization and round constants tables\r\nvar H = [];\r\nvar K = [];\r\n\r\n// Compute constants\r\n(function () {\r\n\tfunction isPrime(n) {\r\n\t\tvar sqrtN = Math.sqrt(n);\r\n\t\tfor (var factor = 2; factor <= sqrtN; factor++) {\r\n\t\t\tif (!(n % factor)) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n\r\n\tfunction getFractionalBits(n) {\r\n\t\treturn ((n - (n | 0)) * 0x100000000) | 0;\r\n\t}\r\n\r\n\tvar n = 2;\r\n\tvar nPrime = 0;\r\n\twhile (nPrime < 64) {\r\n\t\tif (isPrime(n)) {\r\n\t\t\tif (nPrime < 8) {\r\n\t\t\t\tH[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));\r\n\t\t\t}\r\n\t\t\tK[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));\r\n\r\n\t\t\tnPrime++;\r\n\t\t}\r\n\r\n\t\tn++;\r\n\t}\r\n}());\r\n\r\n// Reusable object\r\nvar W = [];\r\n\r\n/**\r\n * SHA-256 hash algorithm.\r\n */\r\nvar SHA256Hasher = C_algo.SHA256 = Hasher.extend({\r\n\t_doReset: function () {\r\n\t\tthis._hash = new WordArray.init(H.slice(0));\r\n\t},\r\n\r\n\t_doProcessBlock: function (M, offset) {\r\n\t\t// Shortcut\r\n\t\tvar H = this._hash.words;\r\n\r\n\t\t// Working variables\r\n\t\tvar a = H[0];\r\n\t\tvar b = H[1];\r\n\t\tvar c = H[2];\r\n\t\tvar d = H[3];\r\n\t\tvar e = H[4];\r\n\t\tvar f = H[5];\r\n\t\tvar g = H[6];\r\n\t\tvar h = H[7];\r\n\r\n\t\t// Computation\r\n\t\tfor (var i = 0; i < 64; i++) {\r\n\t\t\tif (i < 16) {\r\n\t\t\t\tW[i] = M[offset + i] | 0;\r\n\t\t\t} else {\r\n\t\t\t\tvar gamma0x = W[i - 15];\r\n\t\t\t\tvar gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^\r\n\t\t\t\t\t\t\t\t((gamma0x << 14) | (gamma0x >>> 18)) ^\r\n\t\t\t\t\t\t\t\t(gamma0x >>> 3);\r\n\r\n\t\t\t\tvar gamma1x = W[i - 2];\r\n\t\t\t\tvar gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^\r\n\t\t\t\t\t\t\t\t((gamma1x << 13) | (gamma1x >>> 19)) ^\r\n\t\t\t\t\t\t\t\t(gamma1x >>> 10);\r\n\r\n\t\t\t\tW[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];\r\n\t\t\t}\r\n\r\n\t\t\tvar ch = (e & f) ^ (~e & g);\r\n\t\t\tvar maj = (a & b) ^ (a & c) ^ (b & c);\r\n\r\n\t\t\tvar sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));\r\n\t\t\tvar sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));\r\n\r\n\t\t\tvar t1 = h + sigma1 + ch + K[i] + W[i];\r\n\t\t\tvar t2 = sigma0 + maj;\r\n\r\n\t\t\th = g;\r\n\t\t\tg = f;\r\n\t\t\tf = e;\r\n\t\t\te = (d + t1) | 0;\r\n\t\t\td = c;\r\n\t\t\tc = b;\r\n\t\t\tb = a;\r\n\t\t\ta = (t1 + t2) | 0;\r\n\t\t}\r\n\r\n\t\t// Intermediate hash value\r\n\t\tH[0] = (H[0] + a) | 0;\r\n\t\tH[1] = (H[1] + b) | 0;\r\n\t\tH[2] = (H[2] + c) | 0;\r\n\t\tH[3] = (H[3] + d) | 0;\r\n\t\tH[4] = (H[4] + e) | 0;\r\n\t\tH[5] = (H[5] + f) | 0;\r\n\t\tH[6] = (H[6] + g) | 0;\r\n\t\tH[7] = (H[7] + h) | 0;\r\n\t},\r\n\r\n\t_doFinalize: function () {\r\n\t\t// Shortcuts\r\n\t\tvar data = this._data;\r\n\t\tvar dataWords = data.words;\r\n\r\n\t\tvar nBitsTotal = this._nDataBytes * 8;\r\n\t\tvar nBitsLeft = data.sigBytes * 8;\r\n\r\n\t\t// Add padding\r\n\t\tdataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\r\n\t\tdataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\r\n\t\tdata.sigBytes = dataWords.length * 4;\r\n\r\n\t\t// Hash final blocks\r\n\t\tthis._process();\r\n\r\n\t\t// Return final computed hash\r\n\t\treturn this._hash;\r\n\t},\r\n\r\n\tclone: function () {\r\n\t\tvar clone = Hasher.clone.call(this);\r\n\t\tclone._hash = this._hash.clone();\r\n\r\n\t\treturn clone;\r\n\t}\r\n});\r\n\r\n/**\r\n * Shortcut function to the hasher's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n *\r\n * @return {WordArray} The hash.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hash = CryptoJS.SHA256('message');\r\n * var hash = CryptoJS.SHA256(wordArray);\r\n */\r\nconst SHA256 = Hasher._createHelper(SHA256Hasher);\r\n\r\n/**\r\n * Shortcut function to the HMAC's object interface.\r\n *\r\n * @param {WordArray|string} message The message to hash.\r\n * @param {WordArray|string} key The secret key.\r\n *\r\n * @return {WordArray} The HMAC.\r\n *\r\n * @static\r\n *\r\n * @example\r\n *\r\n * var hmac = CryptoJS.HmacSHA256(message, key);\r\n */\r\nconst HmacSHA256 = Hasher._createHmacHelper(SHA256Hasher);\r\n\r\nexport { SHA256, HmacSHA256 };\r\n","/* eslint-disable new-cap */\r\nimport { SHA256, HmacSHA256 } from \"../crypto-es/sha256.js\";\r\n\r\nconst hash = (str) =>\r\n SHA256(str).toString();\r\n\r\nconst hmac = HmacSHA256;\r\n \r\nexport { hmac, hash };\r\n","\"use strict\";\r\n\r\n// Replace one extra character beyond what encodeURIComponent does, \"*\"\r\n// See https://github.com/aws/aws-sdk-js/blob/38bf84c144281f696768e8c64500f2847fe6f298/lib/util.js#L39-L49\r\nconst encode = (str) =>\r\n encodeURIComponent(str)\r\n .replace(/[*]/g, (x) =>\r\n // eslint-disable-next-line newline-per-chained-call\r\n `%${x.charCodeAt(0).toString(16).toUpperCase()}`\r\n );\r\n\r\nexport default encode;\r\n","import encode from \"../lib/encode.js\";\r\n\r\nconst sort = (a, b) => a.localeCompare(b);\r\n\r\n// Sort query parameters by key\r\n// Then also sort by value because AWS\r\nexport default ({ url }) => {\r\n const source = {};\r\n const params = [];\r\n \r\n url.searchParams.forEach((value, key) => {\r\n if(!source[key]) {\r\n source[key] = [];\r\n }\r\n\r\n source[key].push(value);\r\n });\r\n\r\n Object.keys(source)\r\n .sort(sort)\r\n .forEach((key) => {\r\n source[key]\r\n .sort(sort)\r\n .forEach((value) => {\r\n params.push(`${encode(key)}=${encode(value)}`);\r\n });\r\n });\r\n\r\n return params.join(\"&\");\r\n};\r\n","import encode from \"../lib/encode.js\";\r\n\r\nconst multipleSlashesRegex = /\\/\\/+/g;\r\n\r\nexport default ({ service, url }) => {\r\n // S3 doesn't use normalized paths at all\r\n if(service === \"s3\") {\r\n return url.pathname;\r\n }\r\n \r\n return url.pathname\r\n .replace(multipleSlashesRegex, \"/\")\r\n .split(\"/\")\r\n .map(encode)\r\n .join(\"/\");\r\n};\r\n","import { hash } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html\r\nexport default ({ algorithm, date, region, service }, canonical) => [\r\n // Signing Function\r\n algorithm,\r\n \r\n // Date Time\r\n date.long,\r\n \r\n // Scope\r\n `${date.short}/${region}/${service}/aws4_request`,\r\n \r\n // Signed canonical request\r\n hash(canonical),\r\n ].join(\"\\n\");\r\n","const requestRequired = [\r\n \"url\",\r\n];\r\n\r\nconst configRequired = [\r\n \"accessKeyId\",\r\n \"region\",\r\n \"secretAccessKey\",\r\n \"service\",\r\n];\r\n\r\n// Check for required params\r\nconst validate = (source, config) => {\r\n if(!source) {\r\n throw new Error(`Missing request object`);\r\n }\r\n\r\n if(!config) {\r\n throw new Error(`Missing config object`);\r\n }\r\n\r\n let missing = requestRequired.filter((field) => !source[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required request fields: ${missing.join(\", \")}`);\r\n }\r\n \r\n missing = configRequired.filter((field) => !config[field]);\r\n\r\n if(missing.length) {\r\n throw new Error(`Missing required config fields: ${missing.join(\", \")}`);\r\n }\r\n};\r\n\r\nexport default validate;\r\n","import testing from \"consts:testing\";\r\n\r\nimport request from \"./request/request.js\";\r\nimport { sorted } from \"./request/headers.js\";\r\nimport stringToSign from \"./lib/stringtosign.js\";\r\nimport signature from \"./lib/signature.js\";\r\nimport validate from \"./lib/validate.js\";\r\n\r\nconst dateCleanRegex = /[:\\-]|\\.\\d{3}/g;\r\n\r\nconst parseDate = ({ headers : { \"X-Amz-Date\" : amzdate, Date : date } }) => {\r\n const datetime = amzdate ?\r\n amzdate :\r\n (new Date(date || Date.now()))\r\n .toISOString()\r\n .replace(dateCleanRegex, \"\");\r\n\r\n return {\r\n short : datetime.split(\"T\")[0],\r\n long : datetime,\r\n };\r\n};\r\n\r\n// eslint-disable-next-line max-statements\r\nconst sign = (source, config, { before, after }) => {\r\n validate(source, config);\r\n\r\n if(!source.headers) {\r\n source.headers = {};\r\n }\r\n\r\n let details = Object.assign(\r\n Object.create(null),\r\n {\r\n method : \"GET\",\r\n },\r\n source,\r\n config,\r\n {\r\n url : new URL(source.url),\r\n algorithm : \"AWS4-HMAC-SHA256\",\r\n date : parseDate(source),\r\n sortedHeaders : sorted(source),\r\n }\r\n );\r\n\r\n details = before(details);\r\n\r\n const canonical = request(details);\r\n const sts = stringToSign(details, canonical);\r\n const sig = signature(details, sts);\r\n\r\n details.signed = {\r\n canonical,\r\n stringToSign,\r\n signature : sig,\r\n };\r\n\r\n // Add partial output to response for tests so each step can be validated\r\n /* istanbul ignore next */\r\n if(testing) {\r\n details.test = {\r\n canonical,\r\n sts,\r\n };\r\n }\r\n \r\n details = after(details);\r\n\r\n const out = {\r\n url : details.url.toString(),\r\n headers : details.headers,\r\n method : details.method,\r\n body : details.body,\r\n };\r\n\r\n /* istanbul ignore next */\r\n if(testing) {\r\n out.test = details.test;\r\n }\r\n\r\n return out;\r\n};\r\n\r\nexport default sign;\r\n","import { hash } from \"../lib/hash.js\";\r\n\r\nimport query from \"./query.js\";\r\nimport { values, signed } from \"./headers.js\";\r\nimport path from \"./path.js\";\r\n\r\nexport default (req) => {\r\n const { method, body, sortedHeaders } = req;\r\n\r\n // https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html\r\n return [\r\n method.toUpperCase(),\r\n \r\n // Canonical Path\r\n path(req),\r\n \r\n // Canonical Query\r\n query(req),\r\n \r\n // Canonical Headers\r\n values(sortedHeaders),\r\n\r\n // Extra linebreak\r\n \"\",\r\n\r\n // Signed Headers\r\n signed(sortedHeaders),\r\n\r\n // Hashed payload\r\n hash(typeof body === \"string\" ? body.trim() : body),\r\n ].join(\"\\n\");\r\n};\r\n","import { hmac } from \"./hash.js\";\r\n\r\n// https://docs.aws.amazon.com/general/latest/gr/sigv4-calculate-signature.html\r\nexport default ({ date, secretAccessKey, region, service }, sts) => {\r\n const kDate = hmac(date.short, `AWS4${secretAccessKey}`);\r\n const kRegion = hmac(region, kDate);\r\n const kService = hmac(service, kRegion);\r\n const kSignature = hmac(\"aws4_request\", kService);\r\n\r\n return hmac(sts, kSignature);\r\n};\r\n","import testing from \"consts:testing\";\r\n\r\nimport { signed } from \"./request/headers.js\";\r\nimport credential from \"./lib/credential.js\";\r\n\r\nimport sign from \"./sign.js\";\r\n\r\nconst authorization = (details) => {\r\n const {\r\n algorithm,\r\n sortedHeaders,\r\n signed : { signature },\r\n } = details;\r\n\r\n return [\r\n `${algorithm} Credential=${credential(details)}`,\r\n `SignedHeaders=${signed(sortedHeaders)}`,\r\n `Signature=${signature}`,\r\n ].join(\", \");\r\n};\r\n\r\n// NO-OP\r\nconst before = (details) => details;\r\n\r\nconst after = (details) => {\r\n const auth = authorization(details);\r\n\r\n details.headers[\"X-Amz-Date\"] = details.date.long;\r\n \r\n if(details.sessionToken) {\r\n details.headers[\"X-Amz-Security-Token\"] = details.sessionToken;\r\n }\r\n \r\n details.headers.Authorization = auth;\r\n\r\n // Add partial output to response for tests so each step can be validated\r\n /* istanbul ignore next */\r\n if(testing) {\r\n details.test.auth = auth;\r\n }\r\n\r\n return details;\r\n};\r\n\r\nconst signedHeaders = (source, config) => sign(source, config, { before, after });\r\n\r\nexport {\r\n signedHeaders,\r\n};\r\n","import { sorted } from \"./request/headers.js\";\r\nimport encode from \"./lib/encode.js\";\r\nimport credential from \"./lib/credential.js\";\r\n\r\nimport sign from \"./sign.js\";\r\n\r\nconst before = (details) => {\r\n const { url } = details;\r\n\r\n // Query param signatures always have a host header\r\n details.headers.host = url.host;\r\n\r\n // Need to update sortedHeaders after shoving in a host header\r\n details.sortedHeaders = sorted(details);\r\n\r\n const query = [\r\n [ \"X-Amz-Algorithm\", details.algorithm ],\r\n [ \"X-Amz-Credential\", credential(details) ],\r\n [ \"X-Amz-Date\", details.date.long ],\r\n\r\n details.sessionToken ?\r\n [ \"X-Amz-Security-Token\", details.sessionToken ] :\r\n false,\r\n\r\n [ \"X-Amz-SignedHeaders\", details.sortedHeaders.map(([ header ]) => header).join(\",\") ],\r\n ]\r\n .filter(Boolean)\r\n .map(([ key, value ]) => `${key}=${encode(value)}`)\r\n .join(\"&\");\r\n\r\n url.search = url.search.length ?\r\n `${url.search}&${query}` :\r\n query;\r\n \r\n return details;\r\n};\r\n\r\nconst after = (details) => {\r\n const { url, signed } = details;\r\n\r\n const sigparam = `X-Amz-Signature=${encode(signed.signature)}`;\r\n\r\n url.search = `${url.search}&${sigparam}`;\r\n\r\n details.url = url.toString();\r\n\r\n return details;\r\n};\r\n\r\nconst signedQuery = (source, config) => sign(source, config, { before, after });\r\n\r\nexport {\r\n signedQuery,\r\n};\r\n"],"names":["const","trim","val","toString","replace","signed","headers","map","ref","join","sorted","Object","keys","key","toLowerCase","sort","ref$1","keya","localeCompare","keyb","credential","req","accessKeyId","date","region","service","create","F","obj","subtype","prototype","C","C_lib","lib","Base","extend","overrides","this","mixIn","hasOwnProperty","init","$super","apply","arguments","instance","properties","propertyName","clone","WordArray","words","sigBytes","undefined","length","encoder","Hex","stringify","concat","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","i","thatByte","Math","ceil","call","slice","random","nBytes","rcache","r","m_w","m_z","mask","result","_r","push","C_enc","enc","hexChars","bite","parse","hexStr","hexStrLength","parseInt","substr","Latin1","latin1Chars","String","fromCharCode","latin1Str","latin1StrLength","charCodeAt","Utf8","decodeURIComponent","escape","e","Error","utf8Str","unescape","encodeURIComponent","BufferedBlockAlgorithm","reset","_data","_nDataBytes","_append","data","_process","doFlush","dataWords","dataSigBytes","blockSize","nBlocksReady","nWordsReady","max","_minBufferSize","nBytesReady","min","offset","_doProcessBlock","processedWords","splice","C_algo","Hasher","cfg","_doReset","update","messageUpdate","finalize","_doFinalize","_createHelper","hasher","message","_createHmacHelper","HMAC","algo","Crypto","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","innerHash","H","K","isPrime","n","sqrtN","sqrt","factor","getFractionalBits","nPrime","pow","W","SHA256Hasher","SHA256","_hash","M","a","b","c","d","f","g","h","gamma0x","gamma0","gamma1x","gamma1","maj","sigma0","t1","nBitsTotal","nBitsLeft","floor","HmacSHA256","hash","str","hmac","encode","x","toUpperCase","source","params","url","searchParams","forEach","value","multipleSlashesRegex","canonical","algorithm","long","requestRequired","configRequired","dateCleanRegex","parseDate","datetime","amzdate","Date","now","toISOString","short","split","sign","config","let","missing","filter","field","validate","details","assign","method","URL","sortedHeaders","pathname","query","Array","isArray","vals","body","request","before","sig","sts","kDate","secretAccessKey","kRegion","kService","kSignature","signature","stringToSign","after","auth","authorization","sessionToken","Authorization","host","Boolean","search","sigparam"],"mappings":";wMAAAA,IAAMC,WAAQC,GACV,OAAOA,EACFC,WACAF,OACAG,QAAQ,OAAQ,MAenBC,WAAUC,GACZ,OAAOA,EACFC,cAAKC,kBACLC,KAAK,MAGRC,WAAUF,mBAGZ,sBAHwB,IACZG,OAAOC,KAAKN,GAASC,cAAKM,SAAQ,CAAEA,EAAIC,cAAeR,EAAQO,OAEhEE,eAAMP,EAAUQ,4BAAaC,EAAKC,cAAcC,OC5BzDC,WAAcC,GAChB,oDAOA,OAAUC,MAA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WAMlD,OAJA9C,EAAIuD,OAAYvD,aAAcwD,EAE9B9B,EAAQ1B,IAAMA,EAAI3L,WAEXqN,4BDFY5B,EAAQsB,UAAWD,EAAKrB,EAAQsB,EAAQ,QAAEkB,QAAQU,4BCKpDlD,EAAQsB,UAAWD,EAAKrB,EAAQsB,EAAQ,QAAEkB,QAAQU"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3b9f600..9c80e54 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "aws-sig", - "version": "1.3.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index b8a3884..7ee5d82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aws-sig", - "version": "1.3.0", + "version": "2.0.0", "description": "AWS sigv4 signing, optimized for size", "author": "Pat Cavit ", "license": "MIT",