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

securelogin

v0.4.1

Published

A tiny module used to verify SecureLogin tokens

Downloads

14

Readme

Node SecureLogin

Travis Release Downloads License

A tiny module used to verify SecureLogin tokens.

Installation

npm install securelogin --save

Usage

const SecureLogin = require('securelogin');

const sltoken = 'https%3A%2F%2Fmy.app%252Chttps%3A%2F%2Fmy.app%2Fsecurelogin%252C%252C1496586322%2C2YNnncbnq7won%2B13AzJJqeBRREA9CTjYq%2FDwuGQAGy8LaQGnuH6OE10oLxV4kgJJhflnqdu0qY8bBC08v969Cg%3D%3D%252C%2Fbf0P0dBdDcQlak07UZpR4YnzPc2qw40jCSz1NAuw%2Bs%3D%2Ckdbjcc08YBKWdCY56lQJIi92wcGOW%2BKcMvbSgHN6WbU%3D%252C1uP20QU%2BWYvFf1KAxn3Re0ZYd2pm5vLdQhgkXTCjl44%3D%2Chomakov%40gmail.com';

SecureLogin.verify(decodeURIComponent(sltoken), {
    origins: 'https://my.app/',
    ignoreExpiration: true
});

/**
 * { email: '[email protected]',
 *   message:
 *    { _raw: 'https://my.app,https://my.app/securelogin,,1496586322',
 *      provider: 'https://my.app',
 *      client: 'https://my.app/securelogin',
 *      scope: { _raw: '' },
 *      expiration: '1496586322' },
 *   signatures:
 *    { signature: '2YNnncbnq7won+13AzJJqeBRREA9CTjYq/DwuGQAGy8LaQGnuH6OE10oLxV4kgJJhflnqdu0qY8bBC08v969Cg==',
 *      hmac: '/bf0P0dBdDcQlak07UZpR4YnzPc2qw40jCSz1NAuw+s=' },
 *   authkeys:
 *    { public: 'kdbjcc08YBKWdCY56lQJIi92wcGOW+KcMvbSgHN6WbU=',
 *      secret: '1uP20QU+WYvFf1KAxn3Re0ZYd2pm5vLdQhgkXTCjl44=' } }
 */

API Reference

parse(sltoken)

  • sltoken - A SecureLogin token

Parses a SecureLogin token and returns an object with the token's contents.

Example return data:

{
    email: '[email protected]',
    message: {
        _raw: 'http://localhost:3001,http://localhost:3001,,4651339663',
        provider: 'http://localhost:3001',
        client: 'http://localhost:3001',
        scope: { _raw: '' },
        expiration: '4651339663'
    },
    signatures: {
        signature: 'gjs+D1dTCf8FFHWmQizu7Nlt9uVm4jRhEG3J96gzktGKj5IkQcOb+qkJyTEBt9LY99pqqNrtKwxXNrlRyvocAA==',
        hmac: 'UNKOGVd/odZL071ic8sGijtAuBF6Jc262nSAI4O+El4='
    },
    authkeys: {
        public: 'FPS/onjSa0ojlSzp9zXEiot5MgZcMwXR0sAIdgJMxaE=',
        secret: 'bruQ61utUBPay5QJ6Rity4S6AW+sma4NTt+7udhMveM='
    }
}

verify(sltoken[, options])

  • sltoken - A SecureLogin token
  • options - (optional) An object containing zero or more options
    • origins - A string or array of strings containing acceptable client/provider domain(s)
    • ignoreProvider - Ignore provider domain name
    • ignoreClient - Ignore client domain name
    • ignoreExpiration - Ignore the token expiration date

Verifies a SecureLogin token and, if successful, returns the parsed object (see parse method above). If unsuccessful, returns an object with the errors property, an array of errors that occurred while parsing the token.