Skip to content

Commit

Permalink
feat: random network key generator
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Nov 17, 2020
1 parent 78c5fbe commit 3868358
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
v-model="zwave.networkKey"
label="Network Key"
:rules="[rules.validKey]"
append-outer-icon="wifi_protected_setup"
@click:append-outer="randomKey"
></v-text-field>
</v-flex>
<v-flex xs12 sm6>
Expand Down Expand Up @@ -540,6 +542,18 @@ export default {
}
},
methods: {
randomKey () {
var key = ''
while (key.length < 32) {
const x = Math.round(Math.random() * 255)
.toString(16)
.toUpperCase()
key += x.length === 2 ? x : '0' + x
}
this.zwave.networkKey = key
},
readFile (file, callback) {
const reader = new FileReader()
Expand Down

0 comments on commit 3868358

Please sign in to comment.