or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-4/

OAuth Development Credential Checker

Build a credential verification utility for OAuth 1.0 development environments. The utility should help developers validate their OAuth credentials by generating signatures using the PLAINTEXT method, which is suitable for local development over HTTPS.

Requirements

Create a module that verifies OAuth credentials by:

  1. Generating PLAINTEXT signatures from consumer and token secrets
  2. Verifying that a provided signature matches the expected signature for given credentials
  3. Handling empty token secrets (common during the request token phase)

Implementation

@generates

API

/**
 * Generates a PLAINTEXT OAuth signature for the given credentials
 * @param {string} consumerSecret - The OAuth consumer secret
 * @param {string} tokenSecret - The OAuth token secret (use empty string if not available)
 * @returns {string} The PLAINTEXT signature
 */
function generateSignature(consumerSecret, tokenSecret) {
  // IMPLEMENTATION HERE
}

/**
 * Verifies if the provided signature matches the expected signature for given credentials
 * @param {string} providedSignature - The signature to verify
 * @param {string} consumerSecret - The OAuth consumer secret
 * @param {string} tokenSecret - The OAuth token secret
 * @returns {boolean} True if signatures match, false otherwise
 */
function verifyCredentials(providedSignature, consumerSecret, tokenSecret) {
  // IMPLEMENTATION HERE
}

module.exports = {
  generateSignature,
  verifyCredentials
};

Test Cases

  • Given consumer secret "my_consumer_key" and token secret "my_token_secret", generateSignature returns a properly encoded signature @test
  • Given consumer secret with special characters "key!@#" and empty token secret "", generateSignature returns correctly encoded signature @test
  • verifyCredentials returns true when the provided signature matches credentials @test
  • verifyCredentials returns false when the provided signature does not match credentials @test

Dependencies { .dependencies }

oauth-sign { .dependency }

Provides OAuth 1.0 signature generation capabilities including PLAINTEXT method.