* Build the stringToSign and authenticate the chunk * @param {Buffer} dataToSend - chunk sent from _transform or null * if last chunk without data * @param {function} done - callback to _transform * @return {function} executes callback with err if applicable
(dataToSend, done)
| 145 | * @return {function} executes callback with err if applicable |
| 146 | */ |
| 147 | _authenticate(dataToSend, done) { |
| 148 | // use prior sig to construct new string to sign |
| 149 | const stringToSign = constructChunkStringToSign(this.timestamp, |
| 150 | this.credentialScope, this.lastSignature, dataToSend); |
| 151 | this.log.trace('constructed chunk string to sign', |
| 152 | { stringToSign }); |
| 153 | // once used prior sig to construct string to sign, reassign |
| 154 | // lastSignature to current signature |
| 155 | this.lastSignature = this.currentSignature; |
| 156 | const vaultParams = { |
| 157 | log: this.log, |
| 158 | data: { |
| 159 | accessKey: this.accessKey, |
| 160 | signatureFromRequest: this.currentSignature, |
| 161 | region: this.region, |
| 162 | scopeDate: this.scopeDate, |
| 163 | stringToSign, |
| 164 | timestamp: this.timestamp, |
| 165 | credentialScope: this.credentialScope, |
| 166 | }, |
| 167 | }; |
| 168 | return vault.authenticateV4Request(vaultParams, null, {}, err => { |
| 169 | if (err) { |
| 170 | this.log.trace('err from vault on streaming v4 auth', |
| 171 | { error: err, paramsSentToVault: vaultParams.data }); |
| 172 | return done(err); |
| 173 | } |
| 174 | return done(); |
| 175 | }); |
| 176 | } |
| 177 | |
| 178 | |
| 179 | /** |
no test coverage detected