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

node-red-contrib-credentials

v0.2.3

Published

Provides a credentials node to store one or more private values; preventing export to flows or version control.

Downloads

14,230

Readme

node-red-contrib-credentials

Provides a credentials node to store one or more values privately; preventing inadvertent export to flows or to version control commits. Node-RED stores your node information in flows.json and any values setup as credentials into an encrypted separate flows_cred.json file. Values designated as credentials are also omitted when using the clipboard to keep your information private. Use this node to configure any property values you wish to keep private.

When sharing your flows, the values are omitted but property definitions are retained to help users understand what values need to be filled out. A runtime warning is issued for any un-configured values.

Examples

Basic Example

Here we will supply the msg object with two properties; username and password.

Node-RED Basic Example

The settings panel for the credentials node enables storing one or more values. The private field has two modes "string" and "hidden". Both store information the same but "hidden" has the added benefit of hiding any observer's view of the value. After storage, changing the field from "hidden" to "string" prevents the user interface from revealing the contents. Note: the value is stored using Node-RED's credentials API using the 'text' option; it is decoded in both runtime and editor mode. The value can be viewed using the debugger or when doing editor side DOM inspection. The "hidden" mode is only used to protect values from plain view.

Regardless of hidden/string mode, the values are stored encrypted outside of the flows.json file.

WordPress Login Example

The following example shows how we can use the credentials node to supply login information into a WordPress powered website to check for updates. This flow has the credentials node and the nbrowser node installed. Here we see the credentials node configured to store the login information in the msg.username and msg.password properties. The nbrowser node then uses the properties to type login credentials into WordPress' admin web page to access the dashboard. Lastly, the html node is used to parse out the .update-count span element from the web page before sending it to the debug window.

Node-RED WordPress Login

The exported flow appears below. Opening the credentials node will show the username and password fields with blank (omitted) values that need to be supplied by the user. Simply change the URL in the injector and supply your credentials to your own WordPress site to run the flow.

[
    {
        "id": "cf934781.dbe858",
        "type": "inject",
        "z": "bd6efcab.b2b6b",
        "name": "http://domain.tld/wp-admin/",
        "topic": "",
        "payload": "http://domain.tld/wp-admin/",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 160,
        "y": 40,
        "wires": [
            [
                "73df4bbf.8e1da4"
            ]
        ]
    },
    {
        "id": "73df4bbf.8e1da4",
        "type": "credentials",
        "z": "bd6efcab.b2b6b",
        "name": "",
        "props": [
            {
                "value": "username",
                "type": "msg"
            },
            {
                "value": "password",
                "type": "msg"
            }
        ],
        "x": 150,
        "y": 140,
        "wires": [
            [
                "77b7ae1a.0469c"
            ]
        ]
    },
    {
        "id": "77b7ae1a.0469c",
        "type": "nbrowser",
        "z": "bd6efcab.b2b6b",
        "name": "",
        "methods": [
            {
                "name": "gotoURL",
                "func": "goto",
                "params": [
                    {
                        "type": "msg",
                        "value": "payload",
                        "typeDefault": "str"
                    }
                ]
            },
            {
                "name": "type",
                "func": "type",
                "params": [
                    {
                        "type": "str",
                        "value": "#user_login",
                        "typeDefault": "str"
                    },
                    {
                        "type": "msg",
                        "value": "username",
                        "typeDefault": "str"
                    }
                ]
            },
            {
                "name": "type",
                "func": "type",
                "params": [
                    {
                        "type": "str",
                        "value": "#user_pass",
                        "typeDefault": "str"
                    },
                    {
                        "type": "msg",
                        "value": "password",
                        "typeDefault": "str"
                    }
                ]
            },
            {
                "name": "click",
                "func": "click",
                "params": [
                    {
                        "type": "str",
                        "value": "#wp-submit",
                        "typeDefault": "str"
                    }
                ]
            },
            {
                "name": "wait",
                "func": "wait",
                "params": [
                    {
                        "type": "str",
                        "value": "#welcome-panel",
                        "typeDefault": "str"
                    }
                ]
            }
        ],
        "prop": "nbrowser",
        "propout": "payload",
        "object": "msg",
        "objectout": "msg",
        "close": false,
        "show": true,
        "outputs": 1,
        "x": 240,
        "y": 200,
        "wires": [
            [
                "933a7cc7.46675"
            ]
        ]
    },
    {
        "id": "2aa478c9.2dbe98",
        "type": "debug",
        "z": "bd6efcab.b2b6b",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 410,
        "y": 100,
        "wires": []
    },
    {
        "id": "933a7cc7.46675",
        "type": "html",
        "z": "bd6efcab.b2b6b",
        "name": "",
        "tag": ".update-count",
        "ret": "html",
        "as": "single",
        "x": 340,
        "y": 260,
        "wires": [
            [
                "2aa478c9.2dbe98"
            ]
        ]
    }
]

Installation

Run the following command in your Node-RED user directory (typically ~/.node-red):

npm install node-red-contrib-credentials

The credentials node will appear in the palette under the storage group.