diff --git a/src/components/PageComponents/Config/Device.tsx b/src/components/PageComponents/Config/Device.tsx index c0f3bfc4..ce2b5ce1 100644 --- a/src/components/PageComponents/Config/Device.tsx +++ b/src/components/PageComponents/Config/Device.tsx @@ -36,19 +36,6 @@ export const Device = (): JSX.Element => { formatEnumName: true, }, }, - { - type: "toggle", - name: "serialEnabled", - label: "Serial Output Enabled", - description: "Enable the device's serial console", - }, - { - type: "toggle", - name: "debugLogEnabled", - label: "Enabled Debug Log", - description: - "Output debugging information to the device's serial port (auto disables when serial client is connected)", - }, { type: "number", name: "buttonGpio", @@ -86,12 +73,6 @@ export const Device = (): JSX.Element => { label: "Double Tap as Button Press", description: "Treat double tap as button press", }, - { - type: "toggle", - name: "isManaged", - label: "Managed", - description: "Is this device managed by a mesh administator", - }, { type: "toggle", name: "disableTripleClick", diff --git a/src/components/PageComponents/Config/Security.tsx b/src/components/PageComponents/Config/Security.tsx index 2834574c..c9e1175c 100644 --- a/src/components/PageComponents/Config/Security.tsx +++ b/src/components/PageComponents/Config/Security.tsx @@ -3,20 +3,23 @@ import type { SecurityValidation } from "@app/validation/config/security.js"; import { useDevice } from "@core/stores/deviceStore.js"; import { Protobuf } from "@meshtastic/js"; import { fromByteArray, toByteArray } from "base64-js"; +import { Eye, EyeOff } from "lucide-react"; import { useState } from "react"; export const Security = (): JSX.Element => { const { config, nodes, hardware, setWorkingConfig } = useDevice(); - const [adminKey, setAdminKey] = useState( - fromByteArray(config.security?.adminKey ?? new Uint8Array(0)), - ); const [privateKey, setPrivateKey] = useState( fromByteArray(config.security?.privateKey ?? new Uint8Array(0)), ); + const [privateKeyVisible, setPrivateKeyVisible] = useState(false); const [publicKey, setPublicKey] = useState( fromByteArray(config.security?.publicKey ?? new Uint8Array(0)), ); + const [adminKey, setAdminKey] = useState( + fromByteArray(config.security?.adminKey ?? new Uint8Array(0)), + ); + const [adminKeyVisible, setAdminKeyVisible] = useState(false); const onSubmit = (data: SecurityValidation) => { setWorkingConfig( @@ -48,10 +51,22 @@ export const Security = (): JSX.Element => { description: "Settings for the Security configuration", fields: [ { - type: "text", + type: privateKeyVisible ? "text" : "password", name: "privateKey", label: "Private Key", description: "Used to create a shared key with a remote device", + disabledBy: [ + { + fieldName: "adminChannelEnabled", + invert: true, + }, + ], + properties: { + action: { + icon: privateKeyVisible ? EyeOff : Eye, + onClick: () => setPrivateKeyVisible(!privateKeyVisible), + }, + }, }, { type: "text", @@ -70,21 +85,28 @@ export const Security = (): JSX.Element => { { type: "toggle", name: "adminChannelEnabled", - label: "Admin Channel", + label: "Allow Legacy Admin", description: "Allow incoming device control over the insecure legacy admin channel", }, { type: "toggle", name: "isManaged", - label: "Is Managed", + label: "Managed", description: 'If true, device is considered to be "managed" by a mesh administrator via admin messages', }, { - type: "text", + type: adminKeyVisible ? "text" : "password", name: "adminKey", label: "Admin Key", + disabledBy: [{ fieldName: "adminChannelEnabled" }], + properties: { + action: { + icon: adminKeyVisible ? EyeOff : Eye, + onClick: () => setAdminKeyVisible(!adminKeyVisible), + }, + }, description: "The public key authorized to send admin messages to this node", }, @@ -97,19 +119,19 @@ export const Security = (): JSX.Element => { { type: "toggle", name: "bluetoothLoggingEnabled", - label: "Bluetooth Logging", + label: "Allow Bluetooth Logging", description: "Enables device (serial style logs) over Bluetooth", }, { type: "toggle", name: "debugLogApiEnabled", - label: "Debug Log API", + label: "Enable Debug Log API", description: "Output live debug logging over serial", }, { type: "toggle", name: "serialEnabled", - label: "Serial", + label: "Serial Output Enabled", description: "Serial Console over the Stream API", }, ],