Git Product home page Git Product logo

enzoic-ruby-client's Introduction

Enzoic Ruby Client Library

TOC

This README covers the following topics:

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("[email protected]", "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("[email protected]", "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("[email protected]")
puts(exposures.count.to_s + " exposures found for [email protected]")

# 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 [email protected] 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("[email protected]", true)
puts("First password for [email protected] 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.

enzoic-ruby-client's People

Stargazers

Mike Wilson avatar

Watchers

James Cloos avatar Mike Wilson avatar Enzoic (formerly PasswordPing) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.