HMAC Generator API - Ruby Gem
HMAC Generator creates Hash-based Message Authentication Codes for data integrity and authentication. Supports SHA-256, SHA-384, SHA-512, SHA-1, and MD5 algorithms.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_hmac'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_hmac
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_hmac'
# Initialize the client
client = APIVerve::Hmac::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
message: "Hello World",
secret: "my-secret-key",
algorithm: "sha256",
encoding: "hex"
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ message: "Hello World", secret: "my-secret-key", algorithm: "sha256", encoding: "hex" })
puts response["data"]
rescue APIVerve::Hmac::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Hmac::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Hmac::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"hmac": "2cd7c25025198d4458002ceb064ad37ccfbbe46650876d693f5e080bd954e449",
"algorithm": "sha256",
"encoding": "hex"
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/hmac?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.