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

moscognito

v1.0.3

Published

Mosca MQTT server with hooks for authorizing with AWS Cognito.

Downloads

24

Readme

         _____   ____    ____     _____   ____    __  __  ______  ______  _____      
 /'\_/`\/\  __`\/\  _`\ /\  _`\  /\  __`\/\  _`\ /\ \/\ \/\__  _\/\__  _\/\  __`\    
/\      \ \ \/\ \ \,\L\_\ \ \/\_\\ \ \/\ \ \ \L\_\ \ `\\ \/_/\ \/\/_/\ \/\ \ \/\ \   
\ \ \__\ \ \ \ \ \/_\__ \\ \ \/_/_\ \ \ \ \ \ \L_L\ \ , ` \ \ \ \   \ \ \ \ \ \ \ \  
 \ \ \_/\ \ \ \_\ \/\ \L\ \ \ \L\ \\ \ \_\ \ \ \/, \ \ \`\ \ \_\ \__ \ \ \ \ \ \_\ \ 
  \ \_\\ \_\ \_____\ `\____\ \____/ \ \_____\ \____/\ \_\ \_\/\_____\ \ \_\ \ \_____\
   \/_/ \/_/\/_____/\/_____/\/___/   \/_____/\/___/  \/_/\/_/\/_____/  \/_/  \/_____/
                                                                                     
=====================================================================================  

Moscognito Overview (https://github.com/Cedrusco/moscognito)

Modified Mosca MQTT server with AWS Cognito as both standalone and integrated Node.js class authorizing client connections and pub/sub.

Getting Started

Install dependencies by running npm install --production for production, or npm install if you want to develop live using Nodemon. These configurations use a testing certificate and key for TLS/HTTPS tunneling. These should be replaced with the correct certs for each environment.

Scripts

Building

npm run build

Lint

npm run lint

Publishing

npm run publish

Test

Without coverage

npm run test

With coverage (TODO: currently below 70%, hit threshold)

npm run test:coverage

Node.js Integration

You can configure different environments using an object structured with the following properties:

const { MoscognitoServer } = require('moscognito');

// Set up the configuration (see below for specifications)
const config = {
    authorization: { ... },
    broker: { ... }
};

// Instantiate and start the server
const server = new MoscognitoServer(config.broker, config.authorization);
server.start();
  • authorization: The configuration properties for authorizing a token authored by AWS Cognito.

    "authorization": {
        "region": "<region>",
        "tokenExpiration": 3600000,
        "tokenUse": "<access|id>",
        "userPoolId": "<region>_<client id>"
    }
  • broker: The Mosca configuration using the moscaSettings properties defined here.

Standalone

Start a test standalone server using Docker (this assumes you have Docker installed on your system).

Build the initial image:

npm run docker:build

Run the Moscognito server as a standalone with test credentials:

npm run docker:run -- -r <region> -e <expiry> -u <access|id> -i <pool id> -t <topics>
  • -r, --cognito-region: The AWS Cognito region
  • -e, --cognito-expiration: The AWS Cognito token expiration timeframe (default = 3600000)
  • -u, --cognito-usage: The AWS Cognito token usage. Acceptable values are "access" and "token"
  • -i, --cognito-id: The AWS Cognito user pool ID
  • -t, --topics: Topics the valid user is allowed to connect to as a comma-separated list. e.g. topic/1,topic/2.

TODO

  • Add backend configuration for standalone
  • Add certificate configuration for standalone
  • Increase code coverage
  • Add Authorization Code and Implicit flows to client

Authors / Contributors

  • Matt Johnson (src-system42)
  • Pat Petillo (PatPetillo)

Credits / Inspiration

  • Matteo Collina for Mosca (https://github.com/mcollina/mosca/blob/master/lib/client.js)
  • Eugenio Pace for Auth0 Mosca inspiration (https://github.com/eugeniop/auth0mosca)
  • Logo generated using http://patorjk.com/software/taag/#p=display&f=Larry%203D&t=MOSCOGNITO

Copyright

MIT - Copyright (c) 2018 Cedrus, LLC.