Project

enzoic

0.0
Low commit activity in last 3 years
Ruby library for Enzoic API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.2.11, >= 2.2.11
~> 0.4, >= 0.4.6
~> 10.4, >= 10.4.2
~> 1.0, >= 1.0.4
~> 3.2, >= 3.2.4

Runtime

~> 1.15.5
~> 1.0.1
~> 2.0, >= 2.0.2
~> 1.0, >= 1.0.1
~> 3.1, >= 3.1.11
 Project Readme

Enzoic Ruby Client Library

TOC

This README covers the following topics:

  • Installation
  • Source
  • API Overview
  • The Enzoic constructor
  • Platform Requirements
  • RubyDocs

Installation

The compiled library is available as a Ruby Gem:

gem install enzoic

Source

You can build the project from the source in this repository.

API Overview

Here's the API in a nutshell.

require 'enzoic'

# Create a new Enzoic instance - this is our primary interface for making API calls
enzoic = Enzoic::Enzoic.new(apiKey: YOUR_API_KEY, secret: YOUR_API_SECRET)

# Check whether a password has been compromised
# for more information, see 
# https://docs.enzoic.com/enzoic-api-developer-documentation/api-reference/passwords-api
if enzoic.check_password("password-to-test")
    puts("Password is compromised")
else
    puts("Password is not compromised")
end

# Check whether a specific set of credentials are compromised
# for more information, see 
# https://docs.enzoic.com/enzoic-api-developer-documentation/api-reference/credentials-api/hashed-credentials-api 
if enzoic.check_credentials("test@enzoic.com", "password-to-test")
    puts("Credentials are compromised")
else
    puts("Credentials are not compromised")
end

# Check whether a specific set of credentials are compromised, using the optional 
# lastCheckData parameter.
# lastCheckDate is the timestamp for the last check you performed for this user.
# If the DateTime you provide for the last check is greater than the timestamp Enzoic has 
# for the last breach affecting this user, the check will not be performed.  
# This can be used to substantially increase performance.
if enzoic.check_credentials("test@enzoic.com", "password-to-test", DateTime.parse("2019-07-15T19:57:43.000Z"))
    puts("Credentials are compromised")
else
    puts("Credentials are not compromised")
end

# get all exposures for a given user
# for more information, see 
# https://docs.enzoic.com/enzoic-api-developer-documentation/api-reference/exposures-api/get-exposures-for-an-email-address
exposures = enzoic.get_exposures_for_user("test@enzoic.com")
puts(exposures.count.to_s + " exposures found for test@enzoic.com")

# now get the full details for the first exposure found
# for more information, see 
# https://docs.enzoic.com/enzoic-api-developer-documentation/api-reference/exposures-api/retrieve-details-for-an-exposure
details = enzoic.get_exposure_details(exposures.exposures[0])
puts("First exposure for test@enzoic.com was " + details.title)

# get all passwords for a given user - requires special approval, contact Enzoic sales
# for more information, see 
# https://docs.enzoic.com/enzoic-api-developer-documentation/api-reference/credentials-api/cleartext-credentials-api
user_passwords = enzoic.get_passwords_for_user("eicar_0@enzoic.com", true)
puts("First password for eicar_0@enzoic.com was " + user_passwords.passwords[0].password)

More information in reference format can be found below.

The Enzoic constructor

The standard constructor takes the API key and secret you were issued on Enzoic signup.

enzoic = Enzoic::Enzoic.new(apiKey: YOUR_API_KEY, secret: YOUR_API_SECRET)

If you were instructed to use an alternate API endpoint, you may call the overloaded constructor and pass the base URL you were provided.

enzoic = Enzoic::Enzoic.new(apiKey: YOUR_API_KEY, secret: YOUR_API_SECRET, baseURL: "https://api-alt.enzoic.com/v1")

Platform Requirements

OSX and Linux platforms are fully supported. Windows is not, since FFI support is needed for some of the cryptography libraries, which is problematic on Windows.

Ruby 2.0.0 and up are supported.

RubyDocs

The RubyDocs contain more complete references for the API functions.

They can be found here: http://www.rubydoc.info/gems/enzoic

License

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