docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility for normalizing OAuth parameters that handles various edge cases commonly encountered in OAuth 1.0 implementations.
{a: 'value', b: ''}, normalizeParams returns a correctly formatted string with the empty value preserved @test{key: ['value1', 'value2']}, normalizeParams returns all values in sorted order @test{'c@': 'value'}, normalizeParams correctly encodes the parameter name @test/**
* Normalizes OAuth parameters by handling edge cases like empty values,
* duplicate keys, and special characters. Returns a normalized parameter
* string suitable for OAuth signature generation.
*
* @param {Object} params - The parameters to normalize (can include empty values, duplicate keys, special chars)
* @returns {string} The normalized parameter string
*/
function normalizeParams(params) {
// IMPLEMENTATION HERE
}
/**
* Creates an OAuth signature using HMAC-SHA1, handling missing secrets gracefully.
* If consumer_secret or token_secret are undefined/null, treats them as empty strings.
*
* @param {string} httpMethod - The HTTP method (e.g., 'GET', 'POST')
* @param {string} baseUrl - The base URL
* @param {Object} params - The OAuth parameters
* @param {string} consumerSecret - Consumer secret (can be empty/missing)
* @param {string} tokenSecret - Token secret (can be empty/missing)
* @returns {string} The OAuth signature
*/
function createSignature(httpMethod, baseUrl, params, consumerSecret, tokenSecret) {
// IMPLEMENTATION HERE
}
module.exports = {
normalizeParams,
createSignature,
};Provides OAuth 1.0 signature generation with edge case handling support.