Skip to content

NPM module that creates mosquitto_passwd file entries using only node.js

License

Notifications You must be signed in to change notification settings

rozpuszczalny/node-mosquitto-passwd

Repository files navigation

Build Status Coverage Status npm version

mosquitto-passwd

Create mosquitto_passwd entries using only Node.JS.

Usage

const mosquittoPasswd = require('mosquitto-passwd')

// Username, password, salt (optional, by default will generate 12 bytes salt)
mosquittoPasswd('123', '123', Buffer.from('fcQNw5IJfhWEEEM4', 'base64')).then(entry => {
    console.log(entry) // 123:$6$fcQNw5IJfhWEEEM4$0rxaqu90qMJ0FLRlxCWPZiDFfemkc2UOpCHjUEKZ32C6AcKe9x5QKEFPuZwrW9jqoOmdOfP/3FKvbY48AFpSlA==
})

// Or use with await
console.log(await mosquittoPasswd(
    '123', 
    '123', 
    Buffer.from('fcQNw5IJfhWEEEM4', 'base64')
)) // 123:$6$fcQNw5IJfhWEEEM4$0rxaqu90qMJ0FLRlxCWPZiDFfemkc2UOpCHjUEKZ32C6AcKe9x5QKEFPuZwrW9jqoOmdOfP/3FKvbY48AFpSlA==

About

NPM module that creates mosquitto_passwd file entries using only node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published