DKIM Validator API - Ruby Gem

DKIM Validator checks the DomainKeys Identified Mail (DKIM) DNS records for a domain to verify that they are present and correctly formatted.

Installation

Add this line to your application's Gemfile:

gem 'apiverve_dkimvalidator'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install apiverve_dkimvalidator

Getting Started

Get your API key at APIVerve

Basic Usage

require 'apiverve_dkimvalidator'

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

# Make a request
response = client.execute({ domain: "google.com" })

# Print the response
puts response

Error Handling

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

Debug Mode

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

Example Response

{
  "status": "ok",
  "error": null,
  "data": {
    "selector": "20230601",
    "host": "google.com",
    "dkim_host": "20230601._domainkey.google.com",
    "cname_target": null,
    "has_dkim_record": true,
    "dkim_record": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4zd3nfUoLHWFbfoPZzAb8bvjsFIIFsNypweLuPe4M+vAP1YxObFxRnpvLYz7Z+bORKLber5aGmgFF9iaufsH1z0+aw8Qex7uDaafzWoJOM/6lAS5iI0JggZiUkqNpRQLL7H6E7HcvOMC61nJcO4r0PwLDZKwEaCs8gUHiqRn/SS3wqEZX29v/VOUVcI4BjaOz",
    "dkim_records_count": 1,
    "version": "DKIM1",
    "key_type": "rsa",
    "key_bits": 1416,
    "is_test_mode": false,
    "issues_found": [
      {
        "code": "WEAK_PUBLIC_KEY_BITS",
        "type": "warning",
        "message": "Public key uses weak 1416 bits"
      }
    ],
    "valid": true,
    "risk_score": 25,
    "risk_level": "medium"
  }
}

Documentation

For more information, visit the API Documentation.

Support

License

This gem is available under the MIT License.