Push dev work to master #2

Merged
sixteenmillimeter merged 416 commits from dev into master 2018-07-19 15:29:02 +00:00
2 changed files with 28 additions and 0 deletions
Showing only changes of commit d3a7a97c78 - Show all commits

View File

@ -110,6 +110,30 @@ class Wifi {
//this._callback(null, { ssid : ssid, pwd : pwd.length }) //this._callback(null, { ssid : ssid, pwd : pwd.length })
_cb = () => {} _cb = () => {}
} }
/**
* (internal function) Create sanitized wpa_supplicant.conf stanza for
* configuring wifi without storing plaintext passwords
* @example
* network={
* ssid="YOUR_SSID"
* #psk="YOUR_PASSWORD"
* psk=6a24edf1592aec4465271b7dcd204601b6e78df3186ce1a62a31f40ae9630702
* }
*
* @param {string} ssid SSID of wifi network
* @param {string}
*/
_createPSK (ssid, pwd, callback) {
const cmd = `wpa_passphrase "${ssid}" "${pwd}" | grep "psk="`
let output
exec(cmd, (err, stdout, stderr) => {
if (err) {
return callback(err)
}
output = stdout.replace('#psk=', '').split('psk=')[1]
callback(null, output.trim())
})
}
/** /**
* Function which initializes the processes for adding a wifi access point authentication * Function which initializes the processes for adding a wifi access point authentication
* *

4
tests/wifi.js Normal file
View File

@ -0,0 +1,4 @@
'use strict'
const log = require('../lib/log')('wifi-tests')
const wifi = require('../lib/wifi')