@domicile-desktop/system-network 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,204 @@
1
+ // iwd's Wi-Fi device over the system bus: its networks and connection, kept
2
+ // current, and the requests that change them. See docs/SHELL-SYSTEM-ACCESS.md.
3
+ import { Err, None, Ok, Some } from "@cprussin/option-result";
4
+ import { Bus, SystemErrorKind } from "@domicile-desktop/sdk/system";
5
+ import { z } from "zod";
6
+ import { followBus } from "./follow";
7
+ import { strengthOfDbm } from "./signal-strength";
8
+ import { variant } from "./variant";
9
+ import { WifiBackend } from "./wifi-state";
10
+ const SERVICE = "net.connman.iwd";
11
+ const DEVICE = `${SERVICE}.Device`;
12
+ const STATION = `${SERVICE}.Station`;
13
+ const NETWORK = `${SERVICE}.Network`;
14
+ const DIAGNOSTIC = `${SERVICE}.StationDiagnostic`;
15
+ /** The interfaces whose property changes alter a {@link Wifi}. */
16
+ const WATCHED = [DEVICE, STATION, NETWORK];
17
+ /**
18
+ * Calls `onWifi` with the first station device now and after each change, and
19
+ * returns a function that stops watching. `None` is a machine without one.
20
+ *
21
+ * An `Err` is a D-Bus failure, such as iwd not running. The watch keeps
22
+ * listening after one, so a later change reads again.
23
+ */
24
+ export const watchIwdWifi = (domicile, onWifi) => followBus(domicile, { bus: Bus.System, sender: SERVICE }, async () => ({ matters, value: await read(domicile) }), onWifi);
25
+ /** Turn the device on or off. */
26
+ export const setIwdWifiEnabled = async (domicile, wifi, enabled) => done(await domicile.dbus.call({
27
+ ...request(wifi.device, "org.freedesktop.DBus.Properties", "Set"),
28
+ body: [DEVICE, "Powered", { signature: "b", value: enabled }],
29
+ signature: "ssv",
30
+ }));
31
+ /** Ask for a scan. Networks it finds arrive as changes. */
32
+ export const scanIwdWifi = async (domicile, wifi) => done(await domicile.dbus.call(request(wifi.device, STATION, "Scan")));
33
+ /**
34
+ * Join `network`. A known or open network joins over D-Bus. A new secured one
35
+ * joins through `iwctl`, which answers iwd's request for the passphrase: iwd
36
+ * asks an agent for it, and a page cannot serve one.
37
+ */
38
+ export const connectIwdWifi = async (domicile, wifi, network, passphrase) => {
39
+ if (network.profile !== undefined || !network.secured) {
40
+ return done(await domicile.dbus.call(request(network.path, NETWORK, "Connect")));
41
+ }
42
+ else if (passphrase === undefined) {
43
+ throw new Error(`joining ${network.ssid} needs a passphrase`);
44
+ }
45
+ else {
46
+ const ran = await domicile.processes.run([
47
+ "iwctl",
48
+ "--passphrase",
49
+ passphrase,
50
+ "station",
51
+ wifi.interface,
52
+ "connect",
53
+ network.ssid,
54
+ ]);
55
+ return ran.andThen(({ code, stderr, stdout }) => code === 0
56
+ ? Ok("done")
57
+ : Err({
58
+ kind: SystemErrorKind.Other,
59
+ message: `${stdout}${stderr}`.trim(),
60
+ }));
61
+ }
62
+ };
63
+ /** Leave the current network, until asked to join one. */
64
+ export const disconnectIwdWifi = async (domicile, wifi) => done(await domicile.dbus.call(request(wifi.device, STATION, "Disconnect")));
65
+ const request = (path, iface, member) => ({
66
+ bus: Bus.System,
67
+ destination: SERVICE,
68
+ interface: iface,
69
+ member,
70
+ path,
71
+ });
72
+ const done = (reply) => reply.map(() => "done");
73
+ /** Whether `signal` can change Wi-Fi: an object coming or going, or a property. */
74
+ const matters = (signal) => {
75
+ switch (signal.member) {
76
+ case "InterfacesAdded":
77
+ case "InterfacesRemoved": {
78
+ return true;
79
+ }
80
+ case "PropertiesChanged": {
81
+ const [iface] = propertiesChangedSchema.parse(signal.body);
82
+ return WATCHED.includes(iface);
83
+ }
84
+ default: {
85
+ return false;
86
+ }
87
+ }
88
+ };
89
+ const read = async (domicile) => (await domicile.dbus.call({
90
+ bus: Bus.System,
91
+ destination: SERVICE,
92
+ interface: "org.freedesktop.DBus.ObjectManager",
93
+ member: "GetManagedObjects",
94
+ path: "/",
95
+ })).andThenAsync(async ({ body }) => {
96
+ const objects = managedObjectsSchema.parse(body)[0];
97
+ const station = Object.entries(objects).flatMap(([path, held]) => {
98
+ const device = held[DEVICE];
99
+ return device?.Mode === "station" ? [{ device, held, path }] : [];
100
+ })[0];
101
+ return station === undefined
102
+ ? Ok(None())
103
+ : (await wifiOf(domicile, objects, station.path, station.device, station.held)).map((wifi) => Some(wifi));
104
+ });
105
+ const wifiOf = async (domicile, objects, path, device, held) => {
106
+ const off = {
107
+ backend: WifiBackend.Iwd,
108
+ connection: undefined,
109
+ device: path,
110
+ enabled: device.Powered,
111
+ hardwareAddress: device.Address,
112
+ interface: device.Name,
113
+ networks: [],
114
+ scanning: false,
115
+ };
116
+ const station = held[STATION];
117
+ return station === undefined
118
+ ? Ok(off)
119
+ : (await stationOf(domicile, objects, path, station, held[DIAGNOSTIC])).map((found) => ({ ...off, ...found }));
120
+ };
121
+ const stationOf = async (domicile, objects, path, station, diagnostic) => (await domicile.dbus.call(request(path, STATION, "GetOrderedNetworks"))).andThenAsync(async ({ body }) => {
122
+ const networks = orderedNetworksSchema
123
+ .parse(body)[0]
124
+ .map(([network, signal]) => networkOf(objects, network, signal));
125
+ const connected = networks.find(({ connected: on }) => on);
126
+ const connection = connected === undefined
127
+ ? Ok(None())
128
+ : (await diagnosticsOf(domicile, path, diagnostic)).map((found) => Some({
129
+ ...found,
130
+ ip: undefined,
131
+ ssid: connected.ssid,
132
+ strength: connected.strength,
133
+ }));
134
+ return connection.map((current) => ({
135
+ connection: current.match({
136
+ None: () => undefined,
137
+ Some: (found) => found,
138
+ }),
139
+ networks,
140
+ scanning: station.Scanning,
141
+ }));
142
+ });
143
+ const networkOf = (objects, path, signal) => {
144
+ const network = objects[path]?.[NETWORK];
145
+ if (network === undefined) {
146
+ throw new Error(`iwd ordered a network it does not have: ${path}`);
147
+ }
148
+ else {
149
+ return {
150
+ connected: network.Connected,
151
+ path,
152
+ profile: network.KnownNetwork,
153
+ secured: network.Type !== "open",
154
+ ssid: network.Name,
155
+ strength: strengthOfDbm(signal / 100),
156
+ };
157
+ }
158
+ };
159
+ /** The link's frequency and bitrate, when iwd offers diagnostics. */
160
+ const diagnosticsOf = async (domicile, path, diagnostic) => diagnostic === undefined
161
+ ? Ok({ bitrate: undefined, frequency: undefined })
162
+ : (await domicile.dbus.call(request(path, DIAGNOSTIC, "GetDiagnostics"))).map(({ body }) => {
163
+ const [found] = diagnosticsSchema.parse(body);
164
+ return { bitrate: found.RxBitrate / 10, frequency: found.Frequency };
165
+ });
166
+ const stationSchema = z.object({ Scanning: variant(z.boolean()) });
167
+ const managedObjectsSchema = z.tuple([
168
+ z.record(z.string(), z.object({
169
+ [DEVICE]: z
170
+ .object({
171
+ Address: variant(z.string()),
172
+ Mode: variant(z.string()),
173
+ Name: variant(z.string()),
174
+ Powered: variant(z.boolean()),
175
+ })
176
+ .optional(),
177
+ [DIAGNOSTIC]: z.object({}).optional(),
178
+ [NETWORK]: z
179
+ .object({
180
+ Connected: variant(z.boolean()),
181
+ KnownNetwork: variant(z.string()).optional(),
182
+ Name: variant(z.string()),
183
+ Type: variant(z.string()),
184
+ })
185
+ .optional(),
186
+ [STATION]: stationSchema.optional(),
187
+ })),
188
+ ]);
189
+ /** Each network's path and signal, in 100 * dBm. */
190
+ const orderedNetworksSchema = z.tuple([
191
+ z.array(z.tuple([z.string(), z.number()])),
192
+ ]);
193
+ /** `RxBitrate` is in 100 kbit/s. */
194
+ const diagnosticsSchema = z.tuple([
195
+ z.object({
196
+ Frequency: variant(z.number()),
197
+ RxBitrate: variant(z.number()),
198
+ }),
199
+ ]);
200
+ const propertiesChangedSchema = z.tuple([
201
+ z.string(),
202
+ z.record(z.string(), z.unknown()),
203
+ z.array(z.string()),
204
+ ]);
package/dist/iwd.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import type { Result } from "@cprussin/option-result";
2
+ import type { SystemError } from "@domicile-desktop/sdk/system";
3
+ import type { Network, NetworkDesktop } from "./network-state";
4
+ /**
5
+ * Calls `onNetwork` with iwd's network now and after each change, and returns
6
+ * a function that stops watching.
7
+ *
8
+ * iwd knows only Wi-Fi: connectivity is always `Unknown`, and the link is the
9
+ * connected Wi-Fi network or `None`. An `Err` is a D-Bus failure, such as iwd
10
+ * not running. The watch keeps listening after one, so a later change reads
11
+ * again.
12
+ */
13
+ export declare const watchIwd: (domicile: NetworkDesktop, onNetwork: (network: Result<Network, SystemError>) => void) => (() => void);
package/dist/iwd.js ADDED
@@ -0,0 +1,144 @@
1
+ // iwd over the system bus: the connected Wi-Fi network and its signal, kept
2
+ // current. See docs/SHELL-SYSTEM-ACCESS.md.
3
+ import { Err, Ok } from "@cprussin/option-result";
4
+ import { Bus } from "@domicile-desktop/sdk/system";
5
+ import { z } from "zod";
6
+ import { followBus } from "./follow";
7
+ import { Connectivity, Link } from "./network-state";
8
+ import { strengthOfDbm } from "./signal-strength";
9
+ import { variant } from "./variant";
10
+ const SERVICE = "net.connman.iwd";
11
+ const STATION = "net.connman.iwd.Station";
12
+ const NETWORK = "net.connman.iwd.Network";
13
+ /**
14
+ * Station properties whose changes alter the network. A scan ending
15
+ * (`Scanning`) refreshes the signal.
16
+ */
17
+ const WATCHED = ["ConnectedNetwork", "Scanning", "State"];
18
+ /**
19
+ * Calls `onNetwork` with iwd's network now and after each change, and returns
20
+ * a function that stops watching.
21
+ *
22
+ * iwd knows only Wi-Fi: connectivity is always `Unknown`, and the link is the
23
+ * connected Wi-Fi network or `None`. An `Err` is a D-Bus failure, such as iwd
24
+ * not running. The watch keeps listening after one, so a later change reads
25
+ * again.
26
+ */
27
+ export const watchIwd = (domicile, onNetwork) => followBus(domicile, { bus: Bus.System, sender: SERVICE }, async () => ({ matters, value: await read(domicile) }), onNetwork);
28
+ /**
29
+ * Whether `signal` can change the network: an object coming or going, or a
30
+ * watched station property.
31
+ */
32
+ const matters = (signal) => {
33
+ switch (signal.member) {
34
+ case "InterfacesAdded":
35
+ case "InterfacesRemoved": {
36
+ return true;
37
+ }
38
+ case "PropertiesChanged": {
39
+ const [iface, changed] = propertiesChangedSchema.parse(signal.body);
40
+ return iface === STATION && WATCHED.some((name) => name in changed);
41
+ }
42
+ default: {
43
+ return false;
44
+ }
45
+ }
46
+ };
47
+ const read = async (domicile) => {
48
+ const objects = await domicile.dbus.call({
49
+ bus: Bus.System,
50
+ destination: SERVICE,
51
+ interface: "org.freedesktop.DBus.ObjectManager",
52
+ member: "GetManagedObjects",
53
+ path: "/",
54
+ });
55
+ return objects.match({
56
+ Err: (error) => Promise.resolve(Err(error)),
57
+ Ok: async ({ body }) => (await linkOf(domicile, managedObjectsSchema.parse(body)[0])).map((link) => ({ connectivity: Connectivity.Unknown, link })),
58
+ });
59
+ };
60
+ /** The first connected station's network, or `None`. */
61
+ const linkOf = async (domicile, objects) => {
62
+ const station = Object.entries(objects).flatMap(([path, held]) => held[STATION] !== undefined && isOnline(held[STATION].State)
63
+ ? [{ network: connectedNetwork(path, held[STATION]), path }]
64
+ : [])[0];
65
+ if (station === undefined) {
66
+ return Ok(Link.None());
67
+ }
68
+ else {
69
+ const ordered = await domicile.dbus.call({
70
+ bus: Bus.System,
71
+ destination: SERVICE,
72
+ interface: STATION,
73
+ member: "GetOrderedNetworks",
74
+ path: station.path,
75
+ });
76
+ return ordered.map(({ body }) => Link.Wifi(nameOf(objects, station.network), strengthOfDbm(signalOf(orderedNetworksSchema.parse(body)[0], station.network) / 100)));
77
+ }
78
+ };
79
+ /** Whether a station in `state` is on its network. */
80
+ const isOnline = (state) => {
81
+ switch (state) {
82
+ case "connected":
83
+ case "roaming": {
84
+ return true;
85
+ }
86
+ case "connecting":
87
+ case "disconnecting":
88
+ case "disconnected": {
89
+ return false;
90
+ }
91
+ }
92
+ };
93
+ const connectedNetwork = (path, station) => {
94
+ if (station.ConnectedNetwork === undefined) {
95
+ throw new Error(`iwd's station ${path} is online with no network`);
96
+ }
97
+ else {
98
+ return station.ConnectedNetwork;
99
+ }
100
+ };
101
+ const nameOf = (objects, network) => {
102
+ const held = objects[network]?.[NETWORK];
103
+ if (held === undefined) {
104
+ throw new Error(`iwd has no network at ${network}`);
105
+ }
106
+ else {
107
+ return held.Name;
108
+ }
109
+ };
110
+ /** `network`'s signal, in 100 * dBm, from `GetOrderedNetworks`. */
111
+ const signalOf = (ordered, network) => {
112
+ const found = ordered.find(([path]) => path === network);
113
+ if (found === undefined) {
114
+ throw new Error(`iwd did not order its connected network ${network}`);
115
+ }
116
+ else {
117
+ return found[1];
118
+ }
119
+ };
120
+ const stationStateSchema = z.enum([
121
+ "connected",
122
+ "connecting",
123
+ "disconnected",
124
+ "disconnecting",
125
+ "roaming",
126
+ ]);
127
+ const stationSchema = z.object({
128
+ ConnectedNetwork: variant(z.string()).optional(),
129
+ State: variant(stationStateSchema),
130
+ });
131
+ const managedObjectsSchema = z.tuple([
132
+ z.record(z.string(), z.object({
133
+ [NETWORK]: z.object({ Name: variant(z.string()) }).optional(),
134
+ [STATION]: stationSchema.optional(),
135
+ })),
136
+ ]);
137
+ const orderedNetworksSchema = z.tuple([
138
+ z.array(z.tuple([z.string(), z.number()])),
139
+ ]);
140
+ const propertiesChangedSchema = z.tuple([
141
+ z.string(),
142
+ z.record(z.string(), z.unknown()),
143
+ z.array(z.string()),
144
+ ]);
@@ -0,0 +1,47 @@
1
+ import type { Dbus } from "@domicile-desktop/sdk/desktop/dbus";
2
+ /** Whether the host reaches the internet. */
3
+ export declare enum Connectivity {
4
+ Unknown = 0,
5
+ None = 1,
6
+ /** Behind a captive portal. */
7
+ Portal = 2,
8
+ /** On a network, without the internet. */
9
+ Limited = 3,
10
+ Full = 4
11
+ }
12
+ export declare enum LinkKind {
13
+ None = 0,
14
+ Wired = 1,
15
+ Wifi = 2,
16
+ Other = 3
17
+ }
18
+ /** The primary connection. `name` is the connection's name in NetworkManager. */
19
+ export declare const Link: {
20
+ None: () => {
21
+ kind: LinkKind.None;
22
+ };
23
+ /** A VPN, a bridge, a modem and the rest. */
24
+ Other: (name: string) => {
25
+ kind: LinkKind.Other;
26
+ name: string;
27
+ };
28
+ /** `strength` is 0 through 1. */
29
+ Wifi: (ssid: string, strength: number) => {
30
+ kind: LinkKind.Wifi;
31
+ ssid: string;
32
+ strength: number;
33
+ };
34
+ Wired: (name: string) => {
35
+ kind: LinkKind.Wired;
36
+ name: string;
37
+ };
38
+ };
39
+ export type Link = ReturnType<(typeof Link)[keyof typeof Link]>;
40
+ export type Network = {
41
+ connectivity: Connectivity;
42
+ link: Link;
43
+ };
44
+ /** The calls this library makes. */
45
+ export type NetworkDesktop = {
46
+ readonly dbus: Pick<Dbus, "call" | "match">;
47
+ };
@@ -0,0 +1,33 @@
1
+ // The network as every backend reports it: connectivity and the primary
2
+ // connection. See docs/SHELL-SYSTEM-ACCESS.md.
3
+ /** Whether the host reaches the internet. */
4
+ export var Connectivity;
5
+ (function (Connectivity) {
6
+ Connectivity[Connectivity["Unknown"] = 0] = "Unknown";
7
+ Connectivity[Connectivity["None"] = 1] = "None";
8
+ /** Behind a captive portal. */
9
+ Connectivity[Connectivity["Portal"] = 2] = "Portal";
10
+ /** On a network, without the internet. */
11
+ Connectivity[Connectivity["Limited"] = 3] = "Limited";
12
+ Connectivity[Connectivity["Full"] = 4] = "Full";
13
+ })(Connectivity || (Connectivity = {}));
14
+ export var LinkKind;
15
+ (function (LinkKind) {
16
+ LinkKind[LinkKind["None"] = 0] = "None";
17
+ LinkKind[LinkKind["Wired"] = 1] = "Wired";
18
+ LinkKind[LinkKind["Wifi"] = 2] = "Wifi";
19
+ LinkKind[LinkKind["Other"] = 3] = "Other";
20
+ })(LinkKind || (LinkKind = {}));
21
+ /** The primary connection. `name` is the connection's name in NetworkManager. */
22
+ export const Link = {
23
+ None: () => ({ kind: LinkKind.None }),
24
+ /** A VPN, a bridge, a modem and the rest. */
25
+ Other: (name) => ({ kind: LinkKind.Other, name }),
26
+ /** `strength` is 0 through 1. */
27
+ Wifi: (ssid, strength) => ({
28
+ kind: LinkKind.Wifi,
29
+ ssid,
30
+ strength,
31
+ }),
32
+ Wired: (name) => ({ kind: LinkKind.Wired, name }),
33
+ };
@@ -0,0 +1,15 @@
1
+ import type { Result } from "@cprussin/option-result";
2
+ import type { SystemError } from "@domicile-desktop/sdk/system";
3
+ import type { Network, NetworkDesktop } from "./network-state";
4
+ export type { Network, NetworkDesktop } from "./network-state";
5
+ export { Connectivity, Link, LinkKind } from "./network-state";
6
+ /**
7
+ * Calls `onNetwork` with the network now and after each change, and returns a
8
+ * function that stops watching.
9
+ *
10
+ * Watches the first of NetworkManager, iwd and wpa_supplicant that is on the
11
+ * system bus when called, or NetworkManager when none is; see each backend's
12
+ * watch. An `Err` is a D-Bus failure, such as none of them running. When the
13
+ * bus cannot say which runs, the watch reports that `Err` and ends.
14
+ */
15
+ export declare const watchNetwork: (domicile: NetworkDesktop, onNetwork: (network: Result<Network, SystemError>) => void) => (() => void);
@@ -0,0 +1,64 @@
1
+ // The network from whichever network service runs: NetworkManager, iwd or
2
+ // wpa_supplicant. The package's entry point: it also forwards the network
3
+ // types, which live in `network-state` so the backends can import them
4
+ // without a cycle. See docs/SHELL-SYSTEM-ACCESS.md.
5
+ import { Err, Ok } from "@cprussin/option-result";
6
+ import { hasOwner } from "./has-owner";
7
+ import { watchIwd } from "./iwd";
8
+ import { watchNetworkManager } from "./networkmanager";
9
+ import { watchWpaSupplicant } from "./wpa-supplicant";
10
+ export { Connectivity, Link, LinkKind } from "./network-state";
11
+ /** Each backend's bus name, in the order they are tried. */
12
+ const BACKENDS = [
13
+ ["org.freedesktop.NetworkManager", watchNetworkManager],
14
+ ["net.connman.iwd", watchIwd],
15
+ ["fi.w1.wpa_supplicant1", watchWpaSupplicant],
16
+ ];
17
+ /**
18
+ * Calls `onNetwork` with the network now and after each change, and returns a
19
+ * function that stops watching.
20
+ *
21
+ * Watches the first of NetworkManager, iwd and wpa_supplicant that is on the
22
+ * system bus when called, or NetworkManager when none is; see each backend's
23
+ * watch. An `Err` is a D-Bus failure, such as none of them running. When the
24
+ * bus cannot say which runs, the watch reports that `Err` and ends.
25
+ */
26
+ export const watchNetwork = (domicile, onNetwork) => {
27
+ const watch = { stop: undefined, stopped: false };
28
+ detect(domicile, BACKENDS)
29
+ .then((found) => {
30
+ if (!watch.stopped) {
31
+ found.match({
32
+ Err: (error) => {
33
+ onNetwork(Err(error));
34
+ },
35
+ Ok: (backend) => {
36
+ watch.stop = backend(domicile, onNetwork);
37
+ },
38
+ });
39
+ }
40
+ })
41
+ .catch((error) => {
42
+ // biome-ignore lint/suspicious/noConsole: surfacing a background failure
43
+ console.error("Failed to find a network service", error);
44
+ });
45
+ return () => {
46
+ watch.stopped = true;
47
+ watch.stop?.();
48
+ };
49
+ };
50
+ /** The first backend whose service has an owner on the bus. */
51
+ const detect = async (domicile, backends) => {
52
+ const [first, ...rest] = backends;
53
+ if (first === undefined) {
54
+ return Ok(watchNetworkManager);
55
+ }
56
+ else {
57
+ const [name, backend] = first;
58
+ const owned = await hasOwner(domicile, name);
59
+ return owned.match({
60
+ Err: (error) => Promise.resolve(Err(error)),
61
+ Ok: (has) => has ? Promise.resolve(Ok(backend)) : detect(domicile, rest),
62
+ });
63
+ }
64
+ };
@@ -0,0 +1,27 @@
1
+ import type { Option } from "@cprussin/option-result";
2
+ import { Result } from "@cprussin/option-result";
3
+ import type { SystemError } from "@domicile-desktop/sdk/system";
4
+ import type { NetworkDesktop } from "./network-state";
5
+ import type { Wifi, WifiDevice, WifiNetwork } from "./wifi-state";
6
+ /** A read's outcome: Wi-Fi, if there is a device, or the first failure. */
7
+ type Found = Result<Option<Wifi>, SystemError>;
8
+ /**
9
+ * Calls `onWifi` with the first Wi-Fi device now and after each change, and
10
+ * returns a function that stops watching. `None` is a machine without one.
11
+ *
12
+ * An `Err` is a D-Bus failure, such as NetworkManager not running. The watch
13
+ * keeps listening after one, so a later change reads again.
14
+ */
15
+ export declare const watchNetworkManagerWifi: (domicile: NetworkDesktop, onWifi: (wifi: Found) => void) => (() => void);
16
+ /** Turn the Wi-Fi radio on or off. */
17
+ export declare const setNetworkManagerWifiEnabled: (domicile: NetworkDesktop, _wifi: WifiDevice, enabled: boolean) => Promise<Result<"done", SystemError>>;
18
+ /** Ask for a scan. Networks it finds arrive as changes. */
19
+ export declare const scanNetworkManagerWifi: (domicile: NetworkDesktop, wifi: WifiDevice) => Promise<Result<"done", SystemError>>;
20
+ /**
21
+ * Join `network`: through its saved profile if it has one, or with a new
22
+ * profile, which needs `passphrase` when the network is secured.
23
+ */
24
+ export declare const connectNetworkManagerWifi: (domicile: NetworkDesktop, wifi: WifiDevice, network: WifiNetwork, passphrase: string | undefined) => Promise<Result<"done", SystemError>>;
25
+ /** Leave the current network, until asked to join one. */
26
+ export declare const disconnectNetworkManagerWifi: (domicile: NetworkDesktop, wifi: WifiDevice) => Promise<Result<"done", SystemError>>;
27
+ export {};