npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

api-key-validator

v0.1.6

Published

A package to easily validate api keys email, sms, push and web push service providers

Downloads

10

Readme

API Key Validator   image of lock

Codeship Status for VennHQ/api-key-validator

Validate api keys for major email, sms, or push notification providers quickly and easily. Catch the problem early.

Installation

npm install api-key-validator

Validate (serviceName, keys, callback)

|serviceName | keys | |------------|---------------------------------------| | "mailgun" | {api_key, domain} | | "mandrill" | {api_key} | | "postmark" | {server_key} | | "sendgrid" | {api_user, api_key} | | "nexmo" | {api_key, api_secret} | | "plivo" | {auth_id, auth_token} | | "sinch" | {application_key, application_secret} | | "twilio" | {account_sid, auth_token} | | "onesignal"| {app_id, api_key} | | "parse" | {app_id, api_key} | | "pushbots" | {app_id} | | "zeropush" | {server_token} |

Example

var apiKeyValidator = require('api-key-validator');

var keys = {
    api_user: "cx34554cvd234sdfsd34fsdf123123",
    api_key: "2342334534fbdf29sdfsbfbdfsd4"
}

apiKeyValidator.validate("sendgrid", keys, function(err, result){
    console.log(err, result);
});

Development

Want to add a service not currently supported? Feel free to add it yourself and send a pull request!

Install Dependencies

npm install

Run Examples

node example.js

Run Tests

mocha

Adding a New Service Provider

  1. Write Failing Tests
  2. If new service type, create a new test file of the form test/service_type.js.
  3. Copy test/test_template.js into the newly created file or the file corresponding to the service type of the new provider.
  4. Follow instructions in the template file to create tests for the new service
  5. Create the New Service Provider
  6. Install the service provider's npm package as a dependency, or hit their rest API through npm request package
  7. Create a new file of the form lib/models/services/service_type /provider_name.js
  8. Decide how you want to test if the provided keys are valid. Refer to the service's api documentation to call a function or hit an end point that will authenticate or result in an error.
  9. Return a callback making sure that error is null and result is populated if the keys are verified and error is populated and result is null if they are not.
  10. Edit lib/index.js
  11. Require the newly created service provider
var ServiceName = require('./providers/service_type/service_name');
  1. Add the newly created service provider to apiKeyValidator
  if (service == "service_name") Service_name.validate(keys);