Password Strength API - Ruby Gem

Password Strength checks how strong a password is. It returns a strength label and score, a breakdown of the character types used, weak-pattern detection, theoretical entropy in bits, and recommendations to improve it.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_passwordstrength'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_passwordstrength

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_passwordstrength'

# Initialize the client
client = APIVerve::Passwordstrength::Client.new(api_key: "YOUR_API_KEY")

# Make a request
response = client.execute({ password: "Password123" })

# Print the response
puts response

Error Handling

begin
  response = client.execute({ password: "Password123" })
  puts response["data"]
rescue APIVerve::Passwordstrength::ValidationError => e
  puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Passwordstrength::APIError => e
  puts "API error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Debug Mode

# Enable debug logging
client = APIVerve::Passwordstrength::Client.new(
  api_key: "YOUR_API_KEY",
  debug: true
)

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "strength": "weak",
    "score": 1,
    "passwordInfo": {
      "length": 11,
      "hasSpecialCharacters": false,
      "hasNumbers": true,
      "hasLowercase": true,
      "hasUppercase": true,
      "hasSpaces": false,
      "hasSequentialChars": true,
      "hasRepeatedChars": false
    },
    "recommendations": [
      "Use at least 12 characters",
      "Add special characters",
      "Avoid sequential characters (e.g. abc, 123)"
    ],
    "entropyBits": 65.5
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.