Skip to content

Alert and disable start scan when primary channel does not use default key#1706

Merged
garthvh merged 1 commit into
001-local-mesh-discoveryfrom
copilot/alert-on-non-default-key
Apr 30, 2026
Merged

Alert and disable start scan when primary channel does not use default key#1706
garthvh merged 1 commit into
001-local-mesh-discoveryfrom
copilot/alert-on-non-default-key

Conversation

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

What changed?

Added validation in DiscoveryScanView that checks whether the connected node's primary channel uses the default PSK (0x01). When it doesn't:

  • An inline orange warning label is shown in the idle state
  • The "Start Scan" button is disabled
  • An alert is presented on view appear explaining the requirement
private var primaryChannelUsesDefaultKey: Bool {
    guard let channels = connectedNode?.myInfo?.channels else { return true }
    guard let primaryChannel = channels.first(where: { $0.role == 1 }) else { return true }
    let defaultKey = Data([0x01])
    return primaryChannel.psk == nil || primaryChannel.psk == defaultKey || primaryChannel.psk?.isEmpty == true
}

Why did it change?

Discovery scanning requires the default key on the primary channel to function correctly. Without this guard, users could initiate scans that would fail silently or produce incorrect results.

How is this tested?

Manual verification with nodes configured with both default and non-default primary channel keys. Confirmed the button disables, warning displays, and alert presents only when PSK ≠ default.

Screenshots/Videos (when applicable)

Checklist

  • My code adheres to the project's coding and style guidelines.
  • I have conducted a self-review of my code.
  • I have commented my code, particularly in complex areas.
  • I have verified whether these changes require an update to existing documentation or if new documentation is needed, and created an issue in the docs repo if applicable.
  • I have tested the change to ensure that it works as intended.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@garthvh garthvh marked this pull request as ready for review April 30, 2026 04:46
@garthvh garthvh merged commit be11f87 into 001-local-mesh-discovery Apr 30, 2026
1 check was pending
@garthvh garthvh deleted the copilot/alert-on-non-default-key branch May 5, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants