Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apikeypair

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apikeypair

Tiny module to generate id and secret pairs

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

apikeypair

Tiny module to generate id and secret pairs. Output looks like this:

{
  "id": "2210aebae1791f7056ce095db2b7961b6854c1fb",
  "secret": "2f495a1dadfbb84c1e42d9c551a5ace53llcEBA1W7DvF8qXiZGr5dpWDomVp7EDKMZcFIdPpv8="
}

##Usage##

Install with:

npm install --save apikeypair

Then require and use like following:

var apikeypair = require('../index');

//Generate sync
console.log(apikeypair.genSync());

//Generate async
apikeypair.gen(function(keypair) {
    console.log(keypair);
});

//Calculate sync
console.log(apikeypair.calcSync('SOME-RANDOM-ID'));

//Calculate async
apikeypair.calc('SOME-RANDOM-ID', function(err, keypair) {
    if(err) throw err;
    console.log(keypair);
});

###Methods###

  • gen(callback) - generate random ID and Secret asynchronously
  • genSync() - generate random ID and Secret synchronously
  • calc(data, callback) - generate ID and Secret asynchronously using specific input (i.e. user id)
  • calcSync(data) - generate ID and Secret synchronously using specific input (i.e. user id)

Keywords

FAQs

Package last updated on 25 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc