Project

verifyo

0.0
The project is in a healthy, maintained state
Verify wallet addresses for KYC compliance without exposing user personal data. Check age verification, AML screening, and document verification status.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.0
~> 13.0
~> 3.0
~> 1.0
~> 6.0
~> 3.0
~> 0.9

Runtime

 Project Readme

Verifyo Ruby SDK

Gem Version License: MIT

Official Ruby SDK for the Verifyo Zero-Knowledge KYC API. Verify wallet addresses for KYC compliance without exposing user personal data.

Features

  • Zero-Knowledge Verification - Check KYC status without accessing personal data
  • 🔒 Type-Safe - Comprehensive error handling with specific exception types
  • Lightweight - Minimal dependencies, uses Faraday for HTTP
  • 📊 Rate Limit Monitoring - Built-in rate limit tracking and warnings
  • 🎯 Ruby Idioms - Follows Ruby conventions with ? methods and snake_case
  • 🚀 Rails Ready - Easy integration with Ruby on Rails applications

Installation

Add this line to your application's Gemfile:

gem 'verifyo'

And then execute:

bundle install

Or install it yourself:

gem install verifyo

Quick Start

require 'verifyo'

# Initialize the client
client = Verifyo::Client.new('vfy_sk_your_api_key')

# Check a wallet address
response = client.check_address('0x742d35...', network: 'ethereum')

if response.has_results?
  verification = response.first_result
  
  if verification.meets_basic_requirements?
    puts "✅ User is KYC verified"
    puts "KYC Level: #{verification.kyc_level}"
    puts "Country: #{verification.document_country}"
  end
end

Configuration

Direct Initialization

client = Verifyo::Client.new(
  'vfy_sk_your_api_key',
  base_url: 'https://api.verifyo.com',  # Optional
  timeout: 30,                          # Optional (seconds)
  debug: true                            # Optional
)

Global Configuration

# config/initializers/verifyo.rb (Rails)
Verifyo.configure do |config|
  config.api_key = ENV['VERIFYO_API_KEY']
  config.timeout = 30
  config.debug = Rails.env.development?
end

# Then use without API key
client = Verifyo::Client.new(nil)  # Uses global config

API Methods

check_address

Check KYC verification status for a wallet address:

# Check with network specification
response = client.check_address(
  '0x742d35...',
  network: 'ethereum'  # Optional
)

# Check without network (auto-detection)
response = client.check_address('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')

Response Structure

CheckResponse

The main response wrapper:

if response.has_results?
  puts "Found #{response.result_count} verification(s)"
  
  response.results.each do |result|
    # Process each verification
  end
end

# Check rate limits
if response.rate_limit_info
  rate_limit = response.rate_limit_info
  puts "API Usage: #{rate_limit.used}/#{rate_limit.limit}"
  
  if rate_limit.near_limit?
    puts "⚠️ Approaching rate limit!"
  end
end

VerificationResult

Individual verification details:

verification = response.first_result

# Basic properties
puts "Status: #{verification.kyc_status}"
puts "Level: #{verification.kyc_level}"
puts "Country: #{verification.document_country || 'Not provided'}"

# Age verification (Ruby style with ? methods)
puts "Over 18: #{verification.age_over_18?}"
puts "Over 21: #{verification.age_over_21?}"

# Convenience methods
if verification.verified?
  puts "User has completed KYC"
end

if verification.meets_basic_requirements?
  # User is verified, 18+, passes AML, and wallet is safe
  puts "User meets all basic compliance requirements"
end

if verification.suitable_for_age_restricted_services?
  # User is 21+ and not barred
  puts "Suitable for gambling/alcohol services"
end

Wallet Information

wallet = verification.wallet

puts "Address: #{wallet.address}"
puts "Ownership: #{wallet.ownership_status}"
puts "Sanctioned: #{wallet.sanctioned?}"
puts "High Risk: #{wallet.high_risk?}"

if wallet.safe_to_interact?
  puts "✅ Wallet is safe for transactions"
end

AML Screening

aml = verification.aml

puts "Sanctioned: #{aml.sanctioned?}"
puts "PEP: #{aml.pep?}"
puts "Criminal: #{aml.criminal?}"
puts "Adverse Media: #{aml.adverse_media?}"

if aml.passes_aml_screening?
  puts "✅ Passes all AML checks"
end

if aml.clean?
  puts "✅ No flags at all"
end

Error Handling

The SDK provides specific exception types for different error scenarios:

begin
  response = client.check_address(address)
  
rescue Verifyo::AuthenticationError => e
  # Invalid API key or authentication failure
  puts "Authentication failed: #{e.message}"
  
rescue Verifyo::RateLimitError => e
  # Rate limit exceeded
  puts "Rate limit exceeded. Usage: #{e.used}/#{e.limit}"
  puts "Tier: #{e.tier}"
  puts "Resets at: #{e.resets_at}" if e.resets_at
  
rescue Verifyo::ApiError => e
  # General API error
  puts "API error (HTTP #{e.status_code}): #{e.message}"
  
rescue Verifyo::NetworkError => e
  # Network connectivity issues
  puts "Network error: #{e.message}"
end

Examples

Exchange Integration

def can_user_trade?(wallet_address)
  response = @verifyo_client.check_address(wallet_address)
  
  return false unless response.has_results?
  
  verification = response.first_result
  
  # Check trading requirements
  verification.verified? &&
    verification.age_over_18? &&
    verification.aml.passes_aml_screening? &&
    verification.wallet.safe_to_interact?
    
rescue Verifyo::Error => e
  Rails.logger.error "Verifyo error: #{e.message}"
  false  # Fail-safe: deny access on error
end

Age-Restricted Services

def can_access_gambling?(wallet_address)
  response = @verifyo_client.check_address(wallet_address)
  
  return false unless response.has_results?
  
  verification = response.first_result
  
  # Most gambling services require 21+
  verification.verified? &&
    verification.age_over_21? &&
    !verification.aml.barred?
end

Batch Verification

def verify_multiple_wallets(addresses)
  results = {}
  
  addresses.each do |address|
    begin
      response = @verifyo_client.check_address(address)
      results[address] = {
        verified: response.has_verified_result?,
        level: response.first_result&.kyc_level || 0,
        country: response.first_result&.document_country
      }
      
    rescue Verifyo::RateLimitError
      # Handle rate limiting gracefully
      sleep 10
      retry
      
    rescue Verifyo::Error => e
      results[address] = { error: e.message }
    end
  end
  
  results
end

Rails Controller Integration

class VerificationController < ApplicationController
  before_action :initialize_verifyo_client
  
  def check
    response = @client.check_address(params[:address])
    
    if response.has_results?
      verification = response.first_result
      
      render json: {
        verified: verification.verified?,
        kyc_level: verification.kyc_level,
        meets_requirements: verification.meets_basic_requirements?,
        country: verification.document_country
      }
    else
      render json: { 
        verified: false,
        message: 'No KYC verification found' 
      }, status: :not_found
    end
    
  rescue Verifyo::AuthenticationError
    render json: { error: 'Invalid API credentials' }, status: :unauthorized
    
  rescue Verifyo::RateLimitError => e
    response.headers['X-RateLimit-Limit'] = e.limit.to_s
    response.headers['X-RateLimit-Remaining'] = e.remaining.to_s
    render json: { error: 'Rate limit exceeded' }, status: :too_many_requests
    
  rescue Verifyo::Error => e
    render json: { error: e.message }, status: :bad_request
  end
  
  private
  
  def initialize_verifyo_client
    @client = Verifyo::Client.new(Rails.application.credentials.verifyo_api_key)
  end
end

Background Job Processing

class KycVerificationJob < ApplicationJob
  queue_as :default
  
  def perform(wallet_address)
    client = Verifyo::Client.new(ENV['VERIFYO_API_KEY'])
    response = client.check_address(wallet_address)
    
    if response.has_results?
      verification = response.first_result
      
      # Update user record
      user = User.find_by(wallet_address: wallet_address)
      user.update!(
        kyc_verified: verification.verified?,
        kyc_level: verification.kyc_level,
        kyc_country: verification.document_country,
        age_verified_18: verification.age_over_18?,
        age_verified_21: verification.age_over_21?,
        aml_passed: verification.aml.passes_aml_screening?
      )
    end
    
  rescue Verifyo::Error => e
    Rails.logger.error "KYC verification failed for #{wallet_address}: #{e.message}"
    raise  # Retry the job
  end
end

Rails Generator (Coming Soon)

Generate an initializer:

rails generate verifyo:install

This will create config/initializers/verifyo.rb with configuration template.

Best Practices

  1. Use Environment Variables: Store API keys in environment variables
  2. Handle Rate Limits: Implement exponential backoff when hitting rate limits
  3. Fail-Safe: Always deny access when verification fails or errors occur
  4. Monitor Usage: Check rate_limit_info to avoid hitting limits
  5. Cache Results: Consider caching verification results to reduce API calls
  6. Log Errors: Log all exceptions for debugging and monitoring

Requirements

  • Ruby 2.7.0 or higher
  • Valid Verifyo API key (starting with vfy_sk_)

Support

License

The gem is available as open source under the terms of the MIT License.