From 38683583907408e7451d33c004c0ee8826794e74 Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Tue, 17 Nov 2020 18:30:04 +0100 Subject: [PATCH] feat: random network key generator --- src/components/Settings.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/Settings.vue b/src/components/Settings.vue index 31676ac485a..6eb282de88c 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -33,6 +33,8 @@ v-model="zwave.networkKey" label="Network Key" :rules="[rules.validKey]" + append-outer-icon="wifi_protected_setup" + @click:append-outer="randomKey" > @@ -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()