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

sensor.live-things-registry

v1.0.5

Published

## Overview

Downloads

89

Readme

sensor.live-things-registry-javascript

Overview

This document will help your device connect to AWS IoT quickly. Mainly to speed up the process of certificate exchanging complied to AWS IoT authentication.

Prepare

Environment

  • Create "certs" directory in your develop path.

Packages

  • AWS IoT SDK for JavaScript https://github.com/aws/aws-iot-device-sdk-js

sensor.live

  • Enable SATR on sensor.live, you will get root_ca.cert.pem, ca.cert.pem and ca.private_key.pem.
  • Put the pem files into ./certs directory.

Installation

npm install sensor.live-things-registry

Examples

const aws_iot = require('aws-iot-device-sdk');
const thing_registry = require('sensor.live-things-registry');
const config = {
    aws_iot: {
        endpoint: 'your aws iot endpoint',
        port: '8883', // 8883 or 1883 is default supported with AWS IoT,
        debug: false
    }
}
thing_registry.setCertsPath('./certs'); // you can change the default certificates folder
if (!thing_registry.hasDeviceCertificate()) {
    thing_registry.generateDeviceCertificate({
        thing_name: '<YourDeviceUniqueName>'
    });
}
let thing_name = thing_registry.getThingName();
let keys_path = thing_registry.getKeysPath();
let client_id = `device-${thing_name}`
let thing_shadow = aws_iot.thingShadow({
    ...keys_path,
    host: config.aws_iot.endpoint,
    port: config.aws_iot.port,
    debug: config.aws_iot.debug,
    clientId: client_id
});

API Documentation

ThingRegistry.generateDeviceCertificate(options)

Default options:

options = {
    thing_name = null,
    country_name = 'TW',
    state_name = 'Taipei',
    locality_name = 'Nangang',
    organization_name = 'SoftChef',
    organization_unit_name = 'IT'
}

You can customize the thing name, please ensure the thing name is given uniquely.

The naming rule is based on AWS IoT requirement: Must contain only alphanumeric characters and/or the following: -_:

If your thing_name is null, alternatively, the thing name will generate from the device certificate.

ThingRegistry.getThingName()

Get the thing name. Your customized name or from the device certificate.

ThingRegistry.getKeysPath()

Return the keys path, properties follow AWS IoT connection options.

ThingRegistry.setCertsPath(path)

Change the default certificate files directory.

ThingRegistry.setCACertificateName(name)

Change the default CA certificate file name.

ThingRegistry.setCAPrivateKeyName(name)

Change the default CA private key file name.

ThingRegistry.setRootCACertificateName(name)

Change the default RootCA certificate file name.

ThingRegistry.setDeviceCsrName(name)

Change the default device certificate request file name.

ThingRegistry.setDeviceCertificateName(name)

Change the default device certificate file name.

ThingRegistry.setDevicePublicKeyName(name)

Change the default device public key file name.

ThingRegistry.setDevicePrivateKeyName(name)

Change the default device private key file name.

License

This SDK is distributed under the GNU GENERAL PUBLIC LICENSE Version 3, see LICENSE for more information.

Support

If you have technical questions about sensor.live-things-registry, contact sensor.live support [email protected].