src/main/signing.js
function getStringToSign(canonicalRequest, requestDate, region) {
  if (!isString(canonicalRequest)) {
    throw new TypeError('canonicalRequest should be of type "string"')
  }
  if (!isObject(requestDate)) {
    throw new TypeError('requestDate should be of type "object"')
  }
  if (!isString(region)) {
    throw new TypeError('region should be of type "string"')
  }
  var hash = Crypto.createHash('sha256').update(canonicalRequest).digest('hex')
  var scope = getScope(region, requestDate)
  var stringToSign = []
  stringToSign.push(signV4Algorithm)
  stringToSign.push(makeDateLong(requestDate))
  stringToSign.push(scope)
  stringToSign.push(hash)
  return stringToSign.join('\n')
}
function getStringToSign(canonicalRequest, requestDate, region) {
  if (!isString(canonicalRequest)) {
    throw new TypeError('canonicalRequest should be of type "string"')
  }
  if (!isObject(requestDate)) {
    throw new TypeError('requestDate should be of type "object"')
  }
  if (!isString(region)) {
    throw new TypeError('region should be of type "string"')
  }
  var hash = Crypto.createHash('sha256').update(canonicalRequest).digest('hex')
  var scope = getScope(region, requestDate)
  var stringToSign = []
  stringToSign.push(signV4Algorithm)
  stringToSign.push(makeDateLong(requestDate))
  stringToSign.push(scope)
  stringToSign.push(hash)
  return stringToSign.join('\n')
}
function getStringToSign ( canonicalRequest , requestDate , region ) { if ( ! isString ( canonicalRequest ) ) { throw new TypeError ( 'canonicalRequest should be of type "string"' ) } if ( ! isObject ( requestDate ) ) { throw new TypeError ( 'requestDate should be of type "object"' ) } if ( ! isString ( region ) ) { throw new TypeError ( 'region should be of type "string"' ) } var hash = Crypto . createHash ( 'sha256' ) . update ( canonicalRequest ) . digest ( 'hex' ) var scope = getScope ( region , requestDate ) var stringToSign = [ ] stringToSign . push ( signV4Algorithm ) stringToSign . push ( makeDateLong ( requestDate ) ) stringToSign . push ( scope ) stringToSign . push ( hash ) return stringToSign . join ( '\n' ) }
returns the string that needs to be signed
returns the string that needs to be signed