1.0.3 • Published 5 years ago

mosquitto-passwd v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

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==