Push dev work to master #2
|
@ -110,6 +110,30 @@ class Wifi {
|
|||
//this._callback(null, { ssid : ssid, pwd : pwd.length })
|
||||
_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
|
||||
*
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
'use strict'
|
||||
|
||||
const log = require('../lib/log')('wifi-tests')
|
||||
const wifi = require('../lib/wifi')
|
Loading…
Reference in New Issue