Skip to main content

JavaScript Quick Start


Get an API Key and Secret


If you haven’t already, sign up for a free trial.

Include the Enzoic Library


Use npm to install the Enzoic package in your project:

npm install @enzoic/enzoic

Try Out Our Example Code


We’ve made calling the API dead simple. This sample code snippet shows you examples of calling the four supported APIs:

var Enzoic = require('enzoic');

// Create a new Enzoic instance - this is our primary interface for making API calls
var enzoic = new Enzoic(YOUR_API_KEY, YOUR_API_SECRET);

// Check whether a password has been compromised
enzoic.checkPassword('password-to-test', function (error, passwordCompromised) {
    if (error) {
        console.log('Error calling API: ' + error);
    }
    else if (passwordCompromised === true) {
        console.log('Password is compromised');
    }
    else {
        console.log('Password is not compromised');
    }
});

// Check whether a specific set of credentials are compromised
enzoic.checkCredentials('test@enzoic.com', 'password-to-test', function (error, credsCompromised) {
    if (error) {
        console.log('Error calling API: ' + error);
    }
    else if (credsCompromised === true) {
        console.log('Credentials are compromised');
    }
    else {
        console.log('Credentials are not compromised');
    }
});

// get all exposures for the given user
enzoic.getExposuresForUser('test@enzoic.com', function(error, result) {
    if (error) {
        console.log('Error calling API: ' + error);
    }
    else {
        console.log(exposures.count + ' exposures found for test@enzoic.com');

        // now get the full details for the first exposure returned in the list
        enzoic.getExposureDetails(result.exposures[0], function(error, exposureDetails) {
            if (error) {
                console.log('Error calling API: ' + error);
            }
            else {
                console.log('First exposure for test@enzoic.com was ' + exposureDetails.title);
            }
        });
    }
});

Learn More


That should get you started. Check out the Github project page for more details.