oauth-1.0a
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -81,2 +81,6 @@ if (typeof(module) !== 'undefined' && typeof(exports) !== 'undefined') { | ||
if(request.includeBodyHash) { | ||
oauth_data.oauth_body_hash = this.getBodyHash(request, token.secret) | ||
} | ||
oauth_data.oauth_signature = this.getSignature(request, token.secret, oauth_data); | ||
@@ -99,2 +103,12 @@ | ||
/** | ||
* Create a OAuth Body Hash | ||
* @param {Object} request data | ||
*/ | ||
OAuth.prototype.getBodyHash = function(request, token_secret) { | ||
var body = typeof request.data === 'string' ? request.data : JSON.stringify(request.data) | ||
return this.hash_function(body, this.getSigningKey(token_secret)) | ||
}; | ||
/** | ||
* Base String = Method + Base Url + ParameterString | ||
@@ -120,3 +134,8 @@ * @param {Object} request data | ||
OAuth.prototype.getParameterString = function(request, oauth_data) { | ||
var base_string_data = this.sortObject(this.percentEncodeData(this.mergeObject(oauth_data, this.mergeObject(request.data, this.deParamUrl(request.url))))); | ||
var base_string_data; | ||
if (oauth_data.oauth_body_hash) { | ||
base_string_data = this.sortObject(this.percentEncodeData(this.mergeObject(oauth_data, this.deParamUrl(request.url)))); | ||
} else { | ||
base_string_data = this.sortObject(this.percentEncodeData(this.mergeObject(oauth_data, this.mergeObject(request.data, this.deParamUrl(request.url))))); | ||
} | ||
@@ -123,0 +142,0 @@ var data_str = ''; |
{ | ||
"name": "oauth-1.0a", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "OAuth 1.0a Request Authorization for Node and Browser.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -276,2 +276,3 @@ oauth-1.0a ![semaphore][semaphore-img] | ||
* data: ``Object`` any custom data you want to send with, including extra oauth option ``oauth_*`` as oauth_callback, oauth_version... | ||
* includeBodyHash: ``Boolean`` default ``false`` set to true if you want ``oauth_body_hash`` signing | ||
@@ -278,0 +279,0 @@ ```js |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
57562
21
1221
352
0