@capgo/capacitor-wifi 8.4.0 → 8.5.0-beta.pr20.12.1

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.
package/dist/docs.json CHANGED
@@ -71,7 +71,7 @@
71
71
  },
72
72
  {
73
73
  "name": "throws",
74
- "text": "Error if connection fails"
74
+ "text": "CapacitorException with `code` from {@link WifiConnectionErrorCode}"
75
75
  },
76
76
  {
77
77
  "name": "since",
@@ -79,10 +79,10 @@
79
79
  },
80
80
  {
81
81
  "name": "example",
82
- "text": "```typescript\nawait CapacitorWifi.connect({\n ssid: 'MyNetwork',\n password: 'mypassword',\n autoRouteTraffic: true // Android only: route app traffic through this network\n});\n```"
82
+ "text": "```typescript\ntry {\n await CapacitorWifi.connect({\n ssid: 'MyNetwork',\n password: 'mypassword',\n autoRouteTraffic: true, // Android only\n timeoutMs: 30000,\n });\n} catch (error: any) {\n switch (error.code) {\n case WifiConnectionErrorCode.WIFI_DISABLED:\n // Ask the user to enable Wi-Fi\n break;\n case WifiConnectionErrorCode.PERMISSION_DENIED:\n // Request the required permission\n break;\n default:\n // Generic connection error\n break;\n }\n}\n```"
83
83
  }
84
84
  ],
85
- "docs": "Connect to a Wi-Fi network.\nOn Android, this creates a temporary connection that doesn't route traffic through the network by default.\nSet autoRouteTraffic to true to bind app traffic to the connected network (useful for local/device-hosted APs).\nFor a persistent connection on Android, use addNetwork() instead.\nOn iOS, this creates a persistent connection.",
85
+ "docs": "Connect to a Wi-Fi network.\nOn Android, this creates a temporary connection that doesn't route traffic through the network by default.\nSet autoRouteTraffic to true to bind app traffic to the connected network (useful for local/device-hosted APs).\nFor a persistent connection on Android, use addNetwork() instead.\nOn iOS, this creates a persistent connection.\n\nResolves only after the device is confirmed associated with the requested SSID.\nOn failure, rejects with a Capacitor error that includes a stable `code`\nfrom {@link WifiConnectionErrorCode}. Prefer `error.code` over parsing `error.message`.\nSpecific codes are returned only when the native OS provides that reason;\notherwise the plugin returns `CONNECTION_FAILED`.",
86
86
  "complexTypes": [
87
87
  "ConnectOptions"
88
88
  ],
@@ -714,6 +714,22 @@
714
714
  "docs": "Whether to automatically route app traffic through the connected Wi-Fi network (Android only)\nWhen enabled, it binds the app process to the connected network using ConnectivityManager.bindProcessToNetwork()\nThis is useful for connecting to local/device-hosted APs (e.g., ESP32, IoT devices) that don't have internet access.",
715
715
  "complexTypes": [],
716
716
  "type": "boolean | undefined"
717
+ },
718
+ {
719
+ "name": "timeoutMs",
720
+ "tags": [
721
+ {
722
+ "text": "8.5.0",
723
+ "name": "since"
724
+ },
725
+ {
726
+ "text": "30000",
727
+ "name": "default"
728
+ }
729
+ ],
730
+ "docs": "Maximum time in milliseconds to wait for confirmation that the device is associated\nwith the requested SSID before rejecting with `CONNECTION_TIMEOUT`.\nMust be a positive number when provided.",
731
+ "complexTypes": [],
732
+ "type": "number | undefined"
717
733
  }
718
734
  ]
719
735
  },
@@ -32,17 +32,38 @@ export interface CapacitorWifiPlugin {
32
32
  * For a persistent connection on Android, use addNetwork() instead.
33
33
  * On iOS, this creates a persistent connection.
34
34
  *
35
+ * Resolves only after the device is confirmed associated with the requested SSID.
36
+ * On failure, rejects with a Capacitor error that includes a stable `code`
37
+ * from {@link WifiConnectionErrorCode}. Prefer `error.code` over parsing `error.message`.
38
+ * Specific codes are returned only when the native OS provides that reason;
39
+ * otherwise the plugin returns `CONNECTION_FAILED`.
40
+ *
35
41
  * @param options - Connection options
36
42
  * @returns Promise that resolves when connected
37
- * @throws Error if connection fails
43
+ * @throws CapacitorException with `code` from {@link WifiConnectionErrorCode}
38
44
  * @since 7.0.0
39
45
  * @example
40
46
  * ```typescript
41
- * await CapacitorWifi.connect({
42
- * ssid: 'MyNetwork',
43
- * password: 'mypassword',
44
- * autoRouteTraffic: true // Android only: route app traffic through this network
45
- * });
47
+ * try {
48
+ * await CapacitorWifi.connect({
49
+ * ssid: 'MyNetwork',
50
+ * password: 'mypassword',
51
+ * autoRouteTraffic: true, // Android only
52
+ * timeoutMs: 30000,
53
+ * });
54
+ * } catch (error: any) {
55
+ * switch (error.code) {
56
+ * case WifiConnectionErrorCode.WIFI_DISABLED:
57
+ * // Ask the user to enable Wi-Fi
58
+ * break;
59
+ * case WifiConnectionErrorCode.PERMISSION_DENIED:
60
+ * // Request the required permission
61
+ * break;
62
+ * default:
63
+ * // Generic connection error
64
+ * break;
65
+ * }
66
+ * }
46
67
  * ```
47
68
  */
48
69
  connect(options: ConnectOptions): Promise<void>;
@@ -368,6 +389,125 @@ export interface ConnectOptions {
368
389
  * @default false
369
390
  */
370
391
  autoRouteTraffic?: boolean;
392
+ /**
393
+ * Maximum time in milliseconds to wait for confirmation that the device is associated
394
+ * with the requested SSID before rejecting with `CONNECTION_TIMEOUT`.
395
+ * Must be a positive number when provided.
396
+ *
397
+ * @since 8.5.0
398
+ * @default 30000
399
+ */
400
+ timeoutMs?: number;
401
+ }
402
+ /**
403
+ * Stable error codes returned by {@link CapacitorWifiPlugin.connect} on failure.
404
+ * Specific codes are returned only when the native platform explicitly provides that reason.
405
+ * Otherwise the plugin returns {@link WifiConnectionErrorCode.CONNECTION_FAILED}.
406
+ *
407
+ * @since 8.5.0
408
+ */
409
+ export declare enum WifiConnectionErrorCode {
410
+ /**
411
+ * The SSID, password format, security configuration, timeout, or native request parameters are invalid.
412
+ *
413
+ * @since 8.5.0
414
+ */
415
+ INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
416
+ /**
417
+ * A required permission or authorization is missing or was denied.
418
+ *
419
+ * @since 8.5.0
420
+ */
421
+ PERMISSION_DENIED = "PERMISSION_DENIED",
422
+ /**
423
+ * Wi-Fi is disabled and the connection cannot be started.
424
+ *
425
+ * @since 8.5.0
426
+ */
427
+ WIFI_DISABLED = "WIFI_DISABLED",
428
+ /**
429
+ * The native API explicitly reports that the user rejected the connection request.
430
+ * Available on iOS; on Android only when the OS reports user rejection (API 36+).
431
+ *
432
+ * @since 8.5.0
433
+ */
434
+ USER_DENIED = "USER_DENIED",
435
+ /**
436
+ * The native API explicitly reports an authentication failure.
437
+ * Not reliably available on Android API 29–33.
438
+ *
439
+ * @since 8.5.0
440
+ */
441
+ AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
442
+ /**
443
+ * The native API explicitly reports that the requested access point was not found.
444
+ * Not reliably available on Android API 29–33.
445
+ *
446
+ * @since 8.5.0
447
+ */
448
+ NETWORK_NOT_FOUND = "NETWORK_NOT_FOUND",
449
+ /**
450
+ * The plugin timeout expired before the requested network was confirmed as connected.
451
+ *
452
+ * @since 8.5.0
453
+ */
454
+ CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT",
455
+ /**
456
+ * The connection failed, but the platform did not provide a reliable detailed reason.
457
+ *
458
+ * @since 8.5.0
459
+ */
460
+ CONNECTION_FAILED = "CONNECTION_FAILED",
461
+ /**
462
+ * Another Wi-Fi connection attempt is already active.
463
+ *
464
+ * @since 8.5.0
465
+ */
466
+ CONNECTION_IN_PROGRESS = "CONNECTION_IN_PROGRESS",
467
+ /**
468
+ * An unexpected plugin or native error occurred.
469
+ *
470
+ * @since 8.5.0
471
+ */
472
+ UNKNOWN = "UNKNOWN"
473
+ }
474
+ /**
475
+ * Optional platform-specific diagnostics attached to a rejected `connect()` call.
476
+ * Applications should depend only on the stable plugin `code`.
477
+ *
478
+ * @since 8.5.0
479
+ */
480
+ export interface WifiConnectionErrorData {
481
+ /**
482
+ * Platform that produced the error
483
+ *
484
+ * @since 8.5.0
485
+ */
486
+ platform: 'android' | 'ios';
487
+ /**
488
+ * Native error or reason code when available
489
+ *
490
+ * @since 8.5.0
491
+ */
492
+ nativeCode?: number | string;
493
+ /**
494
+ * Native error message when available (may be localized; do not parse for logic)
495
+ *
496
+ * @since 8.5.0
497
+ */
498
+ nativeMessage?: string;
499
+ /**
500
+ * Android API level of the device
501
+ *
502
+ * @since 8.5.0
503
+ */
504
+ androidApiLevel?: number;
505
+ /**
506
+ * Stage of the connection flow where the failure occurred
507
+ *
508
+ * @since 8.5.0
509
+ */
510
+ connectionStage?: 'validation' | 'permission' | 'request' | 'association' | 'authentication' | 'ipProvisioning' | 'verification';
371
511
  }
372
512
  /**
373
513
  * Options for disconnecting from a network
@@ -1,3 +1,76 @@
1
+ /**
2
+ * Stable error codes returned by {@link CapacitorWifiPlugin.connect} on failure.
3
+ * Specific codes are returned only when the native platform explicitly provides that reason.
4
+ * Otherwise the plugin returns {@link WifiConnectionErrorCode.CONNECTION_FAILED}.
5
+ *
6
+ * @since 8.5.0
7
+ */
8
+ export var WifiConnectionErrorCode;
9
+ (function (WifiConnectionErrorCode) {
10
+ /**
11
+ * The SSID, password format, security configuration, timeout, or native request parameters are invalid.
12
+ *
13
+ * @since 8.5.0
14
+ */
15
+ WifiConnectionErrorCode["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
16
+ /**
17
+ * A required permission or authorization is missing or was denied.
18
+ *
19
+ * @since 8.5.0
20
+ */
21
+ WifiConnectionErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
22
+ /**
23
+ * Wi-Fi is disabled and the connection cannot be started.
24
+ *
25
+ * @since 8.5.0
26
+ */
27
+ WifiConnectionErrorCode["WIFI_DISABLED"] = "WIFI_DISABLED";
28
+ /**
29
+ * The native API explicitly reports that the user rejected the connection request.
30
+ * Available on iOS; on Android only when the OS reports user rejection (API 36+).
31
+ *
32
+ * @since 8.5.0
33
+ */
34
+ WifiConnectionErrorCode["USER_DENIED"] = "USER_DENIED";
35
+ /**
36
+ * The native API explicitly reports an authentication failure.
37
+ * Not reliably available on Android API 29–33.
38
+ *
39
+ * @since 8.5.0
40
+ */
41
+ WifiConnectionErrorCode["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED";
42
+ /**
43
+ * The native API explicitly reports that the requested access point was not found.
44
+ * Not reliably available on Android API 29–33.
45
+ *
46
+ * @since 8.5.0
47
+ */
48
+ WifiConnectionErrorCode["NETWORK_NOT_FOUND"] = "NETWORK_NOT_FOUND";
49
+ /**
50
+ * The plugin timeout expired before the requested network was confirmed as connected.
51
+ *
52
+ * @since 8.5.0
53
+ */
54
+ WifiConnectionErrorCode["CONNECTION_TIMEOUT"] = "CONNECTION_TIMEOUT";
55
+ /**
56
+ * The connection failed, but the platform did not provide a reliable detailed reason.
57
+ *
58
+ * @since 8.5.0
59
+ */
60
+ WifiConnectionErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
61
+ /**
62
+ * Another Wi-Fi connection attempt is already active.
63
+ *
64
+ * @since 8.5.0
65
+ */
66
+ WifiConnectionErrorCode["CONNECTION_IN_PROGRESS"] = "CONNECTION_IN_PROGRESS";
67
+ /**
68
+ * An unexpected plugin or native error occurred.
69
+ *
70
+ * @since 8.5.0
71
+ */
72
+ WifiConnectionErrorCode["UNKNOWN"] = "UNKNOWN";
73
+ })(WifiConnectionErrorCode || (WifiConnectionErrorCode = {}));
1
74
  /**
2
75
  * Network security types
3
76
  *
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAolBA;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBA6EX;AA7ED,WAAY,mBAAmB;IAC7B;;;;OAIG;IACH,6DAAQ,CAAA;IAER;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,qEAAY,CAAA;IAEZ;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,mFAAmB,CAAA;IAEnB;;;;OAIG;IACH,mGAA2B,CAAA;IAE3B;;;;OAIG;IACH,uEAAa,CAAA;IAEb;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,qEAAY,CAAA;IAEZ;;;;OAIG;IACH,wEAAc,CAAA;AAChB,CAAC,EA7EW,mBAAmB,KAAnB,mBAAmB,QA6E9B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * WiFi plugin for managing device WiFi connectivity\n *\n * @since 7.0.0\n */\nexport interface CapacitorWifiPlugin {\n /**\n * Show a system dialog to add a Wi-Fi network to the device.\n * On Android SDK 30+, this opens the system Wi-Fi settings with the network pre-filled.\n * On iOS, this connects to the network directly.\n *\n * @param options - Network configuration options\n * @returns Promise that resolves when the network is added\n * @throws Error if adding the network fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.addNetwork({\n * ssid: 'MyNetwork',\n * password: 'mypassword',\n * isHiddenSsid: false,\n * securityType: NetworkSecurityType.WPA2_PSK\n * });\n * ```\n */\n addNetwork(options: AddNetworkOptions): Promise<void>;\n\n /**\n * Connect to a Wi-Fi network.\n * On Android, this creates a temporary connection that doesn't route traffic through the network by default.\n * Set autoRouteTraffic to true to bind app traffic to the connected network (useful for local/device-hosted APs).\n * For a persistent connection on Android, use addNetwork() instead.\n * On iOS, this creates a persistent connection.\n *\n * @param options - Connection options\n * @returns Promise that resolves when connected\n * @throws Error if connection fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.connect({\n * ssid: 'MyNetwork',\n * password: 'mypassword',\n * autoRouteTraffic: true // Android only: route app traffic through this network\n * });\n * ```\n */\n connect(options: ConnectOptions): Promise<void>;\n\n /**\n * Disconnect from the current Wi-Fi network.\n * On iOS, only disconnects from networks that were added via this plugin.\n *\n * @param options - Optional disconnect options\n * @returns Promise that resolves when disconnected\n * @throws Error if disconnection fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.disconnect();\n * ```\n */\n disconnect(options?: DisconnectOptions): Promise<void>;\n\n /**\n * Get a list of available Wi-Fi networks from the last scan.\n * Only available on Android.\n *\n * @returns Promise that resolves with the list of networks\n * @throws Error if getting networks fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { networks } = await CapacitorWifi.getAvailableNetworks();\n * networks.forEach(network => {\n * console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);\n * });\n * ```\n */\n getAvailableNetworks(): Promise<GetAvailableNetworksResult>;\n\n /**\n * Get the device's current IP address.\n * Available on both Android and iOS.\n *\n * @returns Promise that resolves with the IP address\n * @throws Error if getting IP address fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { ipAddress } = await CapacitorWifi.getIpAddress();\n * console.log('IP Address:', ipAddress);\n * ```\n */\n getIpAddress(): Promise<GetIpAddressResult>;\n\n /**\n * Get the received signal strength indicator (RSSI) of the current network in dBm.\n * Only available on Android.\n *\n * @returns Promise that resolves with the RSSI value\n * @throws Error if getting RSSI fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { rssi } = await CapacitorWifi.getRssi();\n * console.log('Signal strength:', rssi, 'dBm');\n * ```\n */\n getRssi(): Promise<GetRssiResult>;\n\n /**\n * Get the service set identifier (SSID) of the current network.\n * Available on both Android and iOS.\n *\n * @returns Promise that resolves with the SSID\n * @throws Error if getting SSID fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { ssid } = await CapacitorWifi.getSsid();\n * console.log('Connected to:', ssid);\n * ```\n */\n getSsid(): Promise<GetSsidResult>;\n\n /**\n * Get comprehensive information about the currently connected WiFi network.\n * This method provides detailed network information including SSID, BSSID, IP address,\n * frequency, link speed, and signal strength in a single call.\n * On iOS, some fields may not be available and will be undefined.\n *\n * @returns Promise that resolves with the WiFi information\n * @throws Error if getting WiFi info fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const info = await CapacitorWifi.getWifiInfo();\n * console.log('Network:', info.ssid);\n * console.log('BSSID:', info.bssid);\n * console.log('IP:', info.ip);\n * console.log('Frequency:', info.frequency, 'MHz');\n * console.log('Speed:', info.linkSpeed, 'Mbps');\n * console.log('Signal:', info.signalStrength);\n * ```\n */\n getWifiInfo(): Promise<WifiInfo>;\n\n /**\n * Check if Wi-Fi is enabled on the device.\n * Only available on Android.\n *\n * @returns Promise that resolves with the Wi-Fi enabled status\n * @throws Error if checking status fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { enabled } = await CapacitorWifi.isEnabled();\n * console.log('WiFi is', enabled ? 'enabled' : 'disabled');\n * ```\n */\n isEnabled(): Promise<IsEnabledResult>;\n\n /**\n * Start scanning for Wi-Fi networks.\n * Only available on Android.\n * Results are delivered via the 'networksScanned' event listener.\n * Note: May fail due to system throttling or hardware issues.\n *\n * @returns Promise that resolves when scan starts\n * @throws Error if scan fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.addListener('networksScanned', () => {\n * console.log('Scan completed');\n * });\n * await CapacitorWifi.startScan();\n * ```\n */\n startScan(): Promise<void>;\n\n /**\n * Check the current permission status for location access.\n * Location permission is required for Wi-Fi operations on both platforms.\n *\n * @returns Promise that resolves with the permission status\n * @throws Error if checking permissions fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const status = await CapacitorWifi.checkPermissions();\n * console.log('Location permission:', status.location);\n * ```\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request location permissions from the user.\n * Location permission is required for Wi-Fi operations on both platforms.\n *\n * @param options - Optional permission request options\n * @returns Promise that resolves with the updated permission status\n * @throws Error if requesting permissions fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const status = await CapacitorWifi.requestPermissions();\n * if (status.location === 'granted') {\n * console.log('Permission granted');\n * }\n * ```\n */\n requestPermissions(options?: RequestPermissionsOptions): Promise<PermissionStatus>;\n\n /**\n * Add a listener for the 'networksScanned' event.\n * Only available on Android.\n * This event is fired when Wi-Fi scan results are available.\n *\n * @param eventName - The event name ('networksScanned')\n * @param listenerFunc - The callback function to execute\n * @returns Promise that resolves with a listener handle\n * @since 7.0.0\n * @example\n * ```typescript\n * const listener = await CapacitorWifi.addListener('networksScanned', async () => {\n * const { networks } = await CapacitorWifi.getAvailableNetworks();\n * console.log('Found networks:', networks);\n * });\n * ```\n */\n addListener(eventName: 'networksScanned', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @returns Promise that resolves when all listeners are removed\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.removeAllListeners();\n * ```\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Check whether a network with the given SSID has already been saved/configured by this app.\n * On Android SDK 30+, this checks the app's Wi-Fi network suggestions.\n * On older Android (including SDK 29), this checks the system's configured networks list.\n * On iOS, this checks the hotspot configurations managed by this app.\n * Use this to decide whether to call addNetwork() (first time) or connect() (already saved).\n *\n * @param options - Options containing the SSID to check\n * @returns Promise that resolves with whether the network is saved\n * @throws Error if the check fails\n * @since 8.2.0\n * @example\n * ```typescript\n * const { isSaved } = await CapacitorWifi.isNetworkSaved({ ssid: 'MyNetwork' });\n * if (isSaved) {\n * await CapacitorWifi.connect({ ssid: 'MyNetwork', password: 'mypassword' });\n * } else {\n * await CapacitorWifi.addNetwork({ ssid: 'MyNetwork', password: 'mypassword' });\n * }\n * ```\n */\n isNetworkSaved(options: IsNetworkSavedOptions): Promise<IsNetworkSavedResult>;\n\n /**\n * Share Wi-Fi network credentials using platform-native sharing flows.\n *\n * On Android 10+, this uses Wi-Fi Easy Connect (DPP). When `dppUri` is provided, the system\n * provisions credentials to the target device. Otherwise, it opens the system UI to share the\n * current or specified network (optionally via QR code when `ssid` and `password` are provided).\n *\n * On iOS 26.2+, this uses the Wi-Fi Infrastructure framework with a paired AccessorySetupKit\n * accessory. The host app must pair the accessory first and pass its `bluetoothIdentifier` or\n * `accessoryIdentifier`. The app also needs the `com.apple.developer.wifi-infrastructure` entitlement.\n *\n * @param options - Sharing options\n * @returns Promise that resolves when the sharing flow starts or completes\n * @throws Error if sharing is unavailable or fails\n * @since 8.4.0\n * @example\n * ```typescript\n * // Android: provision credentials to an IoT device via DPP URI\n * await CapacitorWifi.shareNetwork({ dppUri: 'DPP:...' });\n *\n * // Android: show system UI to share the current network\n * await CapacitorWifi.shareNetwork();\n *\n * // iOS: share with a paired Bluetooth accessory\n * await CapacitorWifi.shareNetwork({\n * bluetoothIdentifier: accessory.bluetoothIdentifier,\n * requestAuthorization: true,\n * askToShare: true,\n * });\n * ```\n */\n shareNetwork(options?: ShareNetworkOptions): Promise<ShareNetworkResult>;\n\n /**\n * Get the native plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @throws Error if getting the version fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { version } = await CapacitorWifi.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n\n/**\n * Options for adding a network\n *\n * @since 7.0.0\n */\nexport interface AddNetworkOptions {\n /**\n * The SSID of the network to add\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The password for the network (optional for open networks)\n *\n * @since 7.0.0\n */\n password?: string;\n\n /**\n * Whether the network is hidden (Android only)\n *\n * @since 7.0.0\n * @default false\n */\n isHiddenSsid?: boolean;\n\n /**\n * The security type of the network (Android only)\n *\n * @since 7.0.0\n * @default NetworkSecurityType.WPA2_PSK\n */\n securityType?: NetworkSecurityType;\n}\n\n/**\n * Options for connecting to a network\n *\n * @since 7.0.0\n */\nexport interface ConnectOptions {\n /**\n * The SSID of the network to connect to\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The password for the network (optional for open networks)\n *\n * @since 7.0.0\n */\n password?: string;\n\n /**\n * Whether the network is hidden (Android only)\n *\n * @since 7.0.0\n * @default false\n */\n isHiddenSsid?: boolean;\n\n /**\n * Whether to automatically route app traffic through the connected Wi-Fi network (Android only)\n * When enabled, it binds the app process to the connected network using ConnectivityManager.bindProcessToNetwork()\n * This is useful for connecting to local/device-hosted APs (e.g., ESP32, IoT devices) that don't have internet access.\n *\n * @since 7.0.0\n * @default false\n */\n autoRouteTraffic?: boolean;\n}\n\n/**\n * Options for disconnecting from a network\n *\n * @since 7.0.0\n */\nexport interface DisconnectOptions {\n /**\n * The SSID of the network to disconnect from (optional)\n *\n * @since 7.0.0\n */\n ssid?: string;\n}\n\n/**\n * Result from getAvailableNetworks()\n *\n * @since 7.0.0\n */\nexport interface GetAvailableNetworksResult {\n /**\n * List of available networks\n *\n * @since 7.0.0\n */\n networks: Network[];\n}\n\n/**\n * Represents a Wi-Fi network\n *\n * @since 7.0.0\n */\nexport interface Network {\n /**\n * The SSID of the network\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The signal strength in dBm\n *\n * @since 7.0.0\n */\n rssi: number;\n\n /**\n * The security types supported by this network (Android SDK 33+ only)\n *\n * @since 7.0.0\n */\n securityTypes?: NetworkSecurityType[];\n}\n\n/**\n * Result from getIpAddress()\n *\n * @since 7.0.0\n */\nexport interface GetIpAddressResult {\n /**\n * The device's IP address\n *\n * @since 7.0.0\n */\n ipAddress: string;\n}\n\n/**\n * Result from getRssi()\n *\n * @since 7.0.0\n */\nexport interface GetRssiResult {\n /**\n * The signal strength in dBm\n *\n * @since 7.0.0\n */\n rssi: number;\n}\n\n/**\n * Result from getSsid()\n *\n * @since 7.0.0\n */\nexport interface GetSsidResult {\n /**\n * The SSID of the current network\n *\n * @since 7.0.0\n */\n ssid: string;\n}\n\n/**\n * Comprehensive WiFi information\n *\n * @since 7.0.0\n */\nexport interface WifiInfo {\n /**\n * The SSID (network name) of the current network\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The BSSID (MAC address) of the access point.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n bssid?: string;\n\n /**\n * The device's IP address on the network\n *\n * @since 7.0.0\n */\n ip: string;\n\n /**\n * The network frequency in MHz.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n frequency?: number;\n\n /**\n * The connection speed in Mbps.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n linkSpeed?: number;\n\n /**\n * The signal strength (0-100).\n * Calculated from RSSI on Android.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n signalStrength?: number;\n}\n\n/**\n * Result from isEnabled()\n *\n * @since 7.0.0\n */\nexport interface IsEnabledResult {\n /**\n * Whether Wi-Fi is enabled\n *\n * @since 7.0.0\n */\n enabled: boolean;\n}\n\n/**\n * Permission status\n *\n * @since 7.0.0\n */\nexport interface PermissionStatus {\n /**\n * Location permission state\n *\n * @since 7.0.0\n */\n location: PermissionState;\n}\n\n/**\n * Possible permission states\n *\n * @since 7.0.0\n */\nexport type PermissionState = 'granted' | 'denied' | 'prompt';\n\n/**\n * Options for requesting permissions\n *\n * @since 7.0.0\n */\nexport interface RequestPermissionsOptions {\n /**\n * Permissions to request\n *\n * @since 7.0.0\n */\n permissions?: 'location'[];\n}\n\n/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport enum NetworkSecurityType {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n OPEN = 0,\n\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n WEP = 1,\n\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n WPA2_PSK = 2,\n\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n EAP = 3,\n\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n SAE = 4,\n\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n WPA3_ENTERPRISE = 5,\n\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n WPA3_ENTERPRISE_192_BIT = 6,\n\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n PASSPOINT = 7,\n\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n OWE = 8,\n\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n WAPI_PSK = 9,\n\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n WAPI_CERT = 10,\n}\n\n/**\n * Options for checking whether a network is saved\n *\n * @since 8.2.0\n */\nexport interface IsNetworkSavedOptions {\n /**\n * The SSID of the network to check\n *\n * @since 8.2.0\n */\n ssid: string;\n}\n\n/**\n * Result from isNetworkSaved()\n *\n * @since 8.2.0\n */\nexport interface IsNetworkSavedResult {\n /**\n * Whether the network has already been saved/configured by this app\n *\n * @since 8.2.0\n */\n isSaved: boolean;\n}\n\n/**\n * Options for sharing Wi-Fi network credentials\n *\n * @since 8.4.0\n */\nexport interface ShareNetworkOptions {\n /**\n * Android: Wi-Fi Easy Connect (DPP) URI from the target device.\n * When provided, launches the system UI to provision Wi-Fi credentials to that device.\n *\n * @since 8.4.0\n */\n dppUri?: string;\n\n /**\n * Network SSID to share via QR code on Android.\n * When omitted, the system uses the currently connected network when possible.\n *\n * @since 8.4.0\n */\n ssid?: string;\n\n /**\n * Network password for QR code sharing on Android.\n * Required when sharing a specific WPA/WPA2/WPA3 network via QR code.\n * iOS does not allow reading saved Wi-Fi passwords from the system.\n *\n * @since 8.4.0\n */\n password?: string;\n\n /**\n * iOS 26.2+: Bluetooth identifier of a paired AccessorySetupKit accessory.\n * Required for Wi-Fi Infrastructure network sharing on iOS unless `accessoryIdentifier` is set.\n *\n * @since 8.4.0\n */\n bluetoothIdentifier?: string;\n\n /**\n * iOS 26.2+: Accessory UUID from AccessorySetupKit.\n * Alternative lookup key when `bluetoothIdentifier` is unavailable.\n *\n * @since 8.4.0\n */\n accessoryIdentifier?: string;\n\n /**\n * iOS 26.2+: Request initial Wi-Fi network sharing authorization for the accessory.\n *\n * @since 8.4.0\n * @default false\n */\n requestAuthorization?: boolean;\n\n /**\n * iOS 26.2+: Prompt the user to share the current Wi-Fi network with the accessory.\n *\n * @since 8.4.0\n * @default true\n */\n askToShare?: boolean;\n}\n\n/**\n * Authorization state returned by iOS Wi-Fi Infrastructure sharing\n *\n * @since 8.4.0\n */\nexport type WifiSharingAuthorizationState = 'authorized' | 'denied' | 'notDetermined' | 'unsupported';\n\n/**\n * Result state returned by iOS Wi-Fi Infrastructure askToShare()\n *\n * @since 8.4.0\n */\nexport type WifiSharingAskState = 'shared' | 'declined' | 'cancelled' | 'notNeeded' | 'unsupported';\n\n/**\n * Result from shareNetwork()\n *\n * @since 8.4.0\n */\nexport interface ShareNetworkResult {\n /**\n * Whether the platform sharing flow was started or completed.\n *\n * @since 8.4.0\n */\n started: boolean;\n\n /**\n * iOS: Authorization state after `requestAuthorization`, when requested.\n *\n * @since 8.4.0\n */\n authorizationState?: WifiSharingAuthorizationState;\n\n /**\n * iOS: Result of `askToShare` when requested.\n *\n * @since 8.4.0\n */\n askToShareState?: WifiSharingAskState;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA0aA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,uBAyEX;AAzED,WAAY,uBAAuB;IACjC;;;;OAIG;IACH,0EAA+C,CAAA;IAE/C;;;;OAIG;IACH,kEAAuC,CAAA;IAEvC;;;;OAIG;IACH,0DAA+B,CAAA;IAE/B;;;;;OAKG;IACH,sDAA2B,CAAA;IAE3B;;;;;OAKG;IACH,0EAA+C,CAAA;IAE/C;;;;;OAKG;IACH,kEAAuC,CAAA;IAEvC;;;;OAIG;IACH,oEAAyC,CAAA;IAEzC;;;;OAIG;IACH,kEAAuC,CAAA;IAEvC;;;;OAIG;IACH,4EAAiD,CAAA;IAEjD;;;;OAIG;IACH,8CAAmB,CAAA;AACrB,CAAC,EAzEW,uBAAuB,KAAvB,uBAAuB,QAyElC;AA6PD;;;;GAIG;AACH,MAAM,CAAN,IAAY,mBA6EX;AA7ED,WAAY,mBAAmB;IAC7B;;;;OAIG;IACH,6DAAQ,CAAA;IAER;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,qEAAY,CAAA;IAEZ;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,mFAAmB,CAAA;IAEnB;;;;OAIG;IACH,mGAA2B,CAAA;IAE3B;;;;OAIG;IACH,uEAAa,CAAA;IAEb;;;;OAIG;IACH,2DAAO,CAAA;IAEP;;;;OAIG;IACH,qEAAY,CAAA;IAEZ;;;;OAIG;IACH,wEAAc,CAAA;AAChB,CAAC,EA7EW,mBAAmB,KAAnB,mBAAmB,QA6E9B","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * WiFi plugin for managing device WiFi connectivity\n *\n * @since 7.0.0\n */\nexport interface CapacitorWifiPlugin {\n /**\n * Show a system dialog to add a Wi-Fi network to the device.\n * On Android SDK 30+, this opens the system Wi-Fi settings with the network pre-filled.\n * On iOS, this connects to the network directly.\n *\n * @param options - Network configuration options\n * @returns Promise that resolves when the network is added\n * @throws Error if adding the network fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.addNetwork({\n * ssid: 'MyNetwork',\n * password: 'mypassword',\n * isHiddenSsid: false,\n * securityType: NetworkSecurityType.WPA2_PSK\n * });\n * ```\n */\n addNetwork(options: AddNetworkOptions): Promise<void>;\n\n /**\n * Connect to a Wi-Fi network.\n * On Android, this creates a temporary connection that doesn't route traffic through the network by default.\n * Set autoRouteTraffic to true to bind app traffic to the connected network (useful for local/device-hosted APs).\n * For a persistent connection on Android, use addNetwork() instead.\n * On iOS, this creates a persistent connection.\n *\n * Resolves only after the device is confirmed associated with the requested SSID.\n * On failure, rejects with a Capacitor error that includes a stable `code`\n * from {@link WifiConnectionErrorCode}. Prefer `error.code` over parsing `error.message`.\n * Specific codes are returned only when the native OS provides that reason;\n * otherwise the plugin returns `CONNECTION_FAILED`.\n *\n * @param options - Connection options\n * @returns Promise that resolves when connected\n * @throws CapacitorException with `code` from {@link WifiConnectionErrorCode}\n * @since 7.0.0\n * @example\n * ```typescript\n * try {\n * await CapacitorWifi.connect({\n * ssid: 'MyNetwork',\n * password: 'mypassword',\n * autoRouteTraffic: true, // Android only\n * timeoutMs: 30000,\n * });\n * } catch (error: any) {\n * switch (error.code) {\n * case WifiConnectionErrorCode.WIFI_DISABLED:\n * // Ask the user to enable Wi-Fi\n * break;\n * case WifiConnectionErrorCode.PERMISSION_DENIED:\n * // Request the required permission\n * break;\n * default:\n * // Generic connection error\n * break;\n * }\n * }\n * ```\n */\n connect(options: ConnectOptions): Promise<void>;\n\n /**\n * Disconnect from the current Wi-Fi network.\n * On iOS, only disconnects from networks that were added via this plugin.\n *\n * @param options - Optional disconnect options\n * @returns Promise that resolves when disconnected\n * @throws Error if disconnection fails\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.disconnect();\n * ```\n */\n disconnect(options?: DisconnectOptions): Promise<void>;\n\n /**\n * Get a list of available Wi-Fi networks from the last scan.\n * Only available on Android.\n *\n * @returns Promise that resolves with the list of networks\n * @throws Error if getting networks fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { networks } = await CapacitorWifi.getAvailableNetworks();\n * networks.forEach(network => {\n * console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);\n * });\n * ```\n */\n getAvailableNetworks(): Promise<GetAvailableNetworksResult>;\n\n /**\n * Get the device's current IP address.\n * Available on both Android and iOS.\n *\n * @returns Promise that resolves with the IP address\n * @throws Error if getting IP address fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { ipAddress } = await CapacitorWifi.getIpAddress();\n * console.log('IP Address:', ipAddress);\n * ```\n */\n getIpAddress(): Promise<GetIpAddressResult>;\n\n /**\n * Get the received signal strength indicator (RSSI) of the current network in dBm.\n * Only available on Android.\n *\n * @returns Promise that resolves with the RSSI value\n * @throws Error if getting RSSI fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { rssi } = await CapacitorWifi.getRssi();\n * console.log('Signal strength:', rssi, 'dBm');\n * ```\n */\n getRssi(): Promise<GetRssiResult>;\n\n /**\n * Get the service set identifier (SSID) of the current network.\n * Available on both Android and iOS.\n *\n * @returns Promise that resolves with the SSID\n * @throws Error if getting SSID fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { ssid } = await CapacitorWifi.getSsid();\n * console.log('Connected to:', ssid);\n * ```\n */\n getSsid(): Promise<GetSsidResult>;\n\n /**\n * Get comprehensive information about the currently connected WiFi network.\n * This method provides detailed network information including SSID, BSSID, IP address,\n * frequency, link speed, and signal strength in a single call.\n * On iOS, some fields may not be available and will be undefined.\n *\n * @returns Promise that resolves with the WiFi information\n * @throws Error if getting WiFi info fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const info = await CapacitorWifi.getWifiInfo();\n * console.log('Network:', info.ssid);\n * console.log('BSSID:', info.bssid);\n * console.log('IP:', info.ip);\n * console.log('Frequency:', info.frequency, 'MHz');\n * console.log('Speed:', info.linkSpeed, 'Mbps');\n * console.log('Signal:', info.signalStrength);\n * ```\n */\n getWifiInfo(): Promise<WifiInfo>;\n\n /**\n * Check if Wi-Fi is enabled on the device.\n * Only available on Android.\n *\n * @returns Promise that resolves with the Wi-Fi enabled status\n * @throws Error if checking status fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * const { enabled } = await CapacitorWifi.isEnabled();\n * console.log('WiFi is', enabled ? 'enabled' : 'disabled');\n * ```\n */\n isEnabled(): Promise<IsEnabledResult>;\n\n /**\n * Start scanning for Wi-Fi networks.\n * Only available on Android.\n * Results are delivered via the 'networksScanned' event listener.\n * Note: May fail due to system throttling or hardware issues.\n *\n * @returns Promise that resolves when scan starts\n * @throws Error if scan fails or on unsupported platform\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.addListener('networksScanned', () => {\n * console.log('Scan completed');\n * });\n * await CapacitorWifi.startScan();\n * ```\n */\n startScan(): Promise<void>;\n\n /**\n * Check the current permission status for location access.\n * Location permission is required for Wi-Fi operations on both platforms.\n *\n * @returns Promise that resolves with the permission status\n * @throws Error if checking permissions fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const status = await CapacitorWifi.checkPermissions();\n * console.log('Location permission:', status.location);\n * ```\n */\n checkPermissions(): Promise<PermissionStatus>;\n\n /**\n * Request location permissions from the user.\n * Location permission is required for Wi-Fi operations on both platforms.\n *\n * @param options - Optional permission request options\n * @returns Promise that resolves with the updated permission status\n * @throws Error if requesting permissions fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const status = await CapacitorWifi.requestPermissions();\n * if (status.location === 'granted') {\n * console.log('Permission granted');\n * }\n * ```\n */\n requestPermissions(options?: RequestPermissionsOptions): Promise<PermissionStatus>;\n\n /**\n * Add a listener for the 'networksScanned' event.\n * Only available on Android.\n * This event is fired when Wi-Fi scan results are available.\n *\n * @param eventName - The event name ('networksScanned')\n * @param listenerFunc - The callback function to execute\n * @returns Promise that resolves with a listener handle\n * @since 7.0.0\n * @example\n * ```typescript\n * const listener = await CapacitorWifi.addListener('networksScanned', async () => {\n * const { networks } = await CapacitorWifi.getAvailableNetworks();\n * console.log('Found networks:', networks);\n * });\n * ```\n */\n addListener(eventName: 'networksScanned', listenerFunc: () => void): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @returns Promise that resolves when all listeners are removed\n * @since 7.0.0\n * @example\n * ```typescript\n * await CapacitorWifi.removeAllListeners();\n * ```\n */\n removeAllListeners(): Promise<void>;\n\n /**\n * Check whether a network with the given SSID has already been saved/configured by this app.\n * On Android SDK 30+, this checks the app's Wi-Fi network suggestions.\n * On older Android (including SDK 29), this checks the system's configured networks list.\n * On iOS, this checks the hotspot configurations managed by this app.\n * Use this to decide whether to call addNetwork() (first time) or connect() (already saved).\n *\n * @param options - Options containing the SSID to check\n * @returns Promise that resolves with whether the network is saved\n * @throws Error if the check fails\n * @since 8.2.0\n * @example\n * ```typescript\n * const { isSaved } = await CapacitorWifi.isNetworkSaved({ ssid: 'MyNetwork' });\n * if (isSaved) {\n * await CapacitorWifi.connect({ ssid: 'MyNetwork', password: 'mypassword' });\n * } else {\n * await CapacitorWifi.addNetwork({ ssid: 'MyNetwork', password: 'mypassword' });\n * }\n * ```\n */\n isNetworkSaved(options: IsNetworkSavedOptions): Promise<IsNetworkSavedResult>;\n\n /**\n * Share Wi-Fi network credentials using platform-native sharing flows.\n *\n * On Android 10+, this uses Wi-Fi Easy Connect (DPP). When `dppUri` is provided, the system\n * provisions credentials to the target device. Otherwise, it opens the system UI to share the\n * current or specified network (optionally via QR code when `ssid` and `password` are provided).\n *\n * On iOS 26.2+, this uses the Wi-Fi Infrastructure framework with a paired AccessorySetupKit\n * accessory. The host app must pair the accessory first and pass its `bluetoothIdentifier` or\n * `accessoryIdentifier`. The app also needs the `com.apple.developer.wifi-infrastructure` entitlement.\n *\n * @param options - Sharing options\n * @returns Promise that resolves when the sharing flow starts or completes\n * @throws Error if sharing is unavailable or fails\n * @since 8.4.0\n * @example\n * ```typescript\n * // Android: provision credentials to an IoT device via DPP URI\n * await CapacitorWifi.shareNetwork({ dppUri: 'DPP:...' });\n *\n * // Android: show system UI to share the current network\n * await CapacitorWifi.shareNetwork();\n *\n * // iOS: share with a paired Bluetooth accessory\n * await CapacitorWifi.shareNetwork({\n * bluetoothIdentifier: accessory.bluetoothIdentifier,\n * requestAuthorization: true,\n * askToShare: true,\n * });\n * ```\n */\n shareNetwork(options?: ShareNetworkOptions): Promise<ShareNetworkResult>;\n\n /**\n * Get the native plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @throws Error if getting the version fails\n * @since 7.0.0\n * @example\n * ```typescript\n * const { version } = await CapacitorWifi.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n\n/**\n * Options for adding a network\n *\n * @since 7.0.0\n */\nexport interface AddNetworkOptions {\n /**\n * The SSID of the network to add\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The password for the network (optional for open networks)\n *\n * @since 7.0.0\n */\n password?: string;\n\n /**\n * Whether the network is hidden (Android only)\n *\n * @since 7.0.0\n * @default false\n */\n isHiddenSsid?: boolean;\n\n /**\n * The security type of the network (Android only)\n *\n * @since 7.0.0\n * @default NetworkSecurityType.WPA2_PSK\n */\n securityType?: NetworkSecurityType;\n}\n\n/**\n * Options for connecting to a network\n *\n * @since 7.0.0\n */\nexport interface ConnectOptions {\n /**\n * The SSID of the network to connect to\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The password for the network (optional for open networks)\n *\n * @since 7.0.0\n */\n password?: string;\n\n /**\n * Whether the network is hidden (Android only)\n *\n * @since 7.0.0\n * @default false\n */\n isHiddenSsid?: boolean;\n\n /**\n * Whether to automatically route app traffic through the connected Wi-Fi network (Android only)\n * When enabled, it binds the app process to the connected network using ConnectivityManager.bindProcessToNetwork()\n * This is useful for connecting to local/device-hosted APs (e.g., ESP32, IoT devices) that don't have internet access.\n *\n * @since 7.0.0\n * @default false\n */\n autoRouteTraffic?: boolean;\n\n /**\n * Maximum time in milliseconds to wait for confirmation that the device is associated\n * with the requested SSID before rejecting with `CONNECTION_TIMEOUT`.\n * Must be a positive number when provided.\n *\n * @since 8.5.0\n * @default 30000\n */\n timeoutMs?: number;\n}\n\n/**\n * Stable error codes returned by {@link CapacitorWifiPlugin.connect} on failure.\n * Specific codes are returned only when the native platform explicitly provides that reason.\n * Otherwise the plugin returns {@link WifiConnectionErrorCode.CONNECTION_FAILED}.\n *\n * @since 8.5.0\n */\nexport enum WifiConnectionErrorCode {\n /**\n * The SSID, password format, security configuration, timeout, or native request parameters are invalid.\n *\n * @since 8.5.0\n */\n INVALID_CONFIGURATION = 'INVALID_CONFIGURATION',\n\n /**\n * A required permission or authorization is missing or was denied.\n *\n * @since 8.5.0\n */\n PERMISSION_DENIED = 'PERMISSION_DENIED',\n\n /**\n * Wi-Fi is disabled and the connection cannot be started.\n *\n * @since 8.5.0\n */\n WIFI_DISABLED = 'WIFI_DISABLED',\n\n /**\n * The native API explicitly reports that the user rejected the connection request.\n * Available on iOS; on Android only when the OS reports user rejection (API 36+).\n *\n * @since 8.5.0\n */\n USER_DENIED = 'USER_DENIED',\n\n /**\n * The native API explicitly reports an authentication failure.\n * Not reliably available on Android API 29–33.\n *\n * @since 8.5.0\n */\n AUTHENTICATION_FAILED = 'AUTHENTICATION_FAILED',\n\n /**\n * The native API explicitly reports that the requested access point was not found.\n * Not reliably available on Android API 29–33.\n *\n * @since 8.5.0\n */\n NETWORK_NOT_FOUND = 'NETWORK_NOT_FOUND',\n\n /**\n * The plugin timeout expired before the requested network was confirmed as connected.\n *\n * @since 8.5.0\n */\n CONNECTION_TIMEOUT = 'CONNECTION_TIMEOUT',\n\n /**\n * The connection failed, but the platform did not provide a reliable detailed reason.\n *\n * @since 8.5.0\n */\n CONNECTION_FAILED = 'CONNECTION_FAILED',\n\n /**\n * Another Wi-Fi connection attempt is already active.\n *\n * @since 8.5.0\n */\n CONNECTION_IN_PROGRESS = 'CONNECTION_IN_PROGRESS',\n\n /**\n * An unexpected plugin or native error occurred.\n *\n * @since 8.5.0\n */\n UNKNOWN = 'UNKNOWN',\n}\n\n/**\n * Optional platform-specific diagnostics attached to a rejected `connect()` call.\n * Applications should depend only on the stable plugin `code`.\n *\n * @since 8.5.0\n */\nexport interface WifiConnectionErrorData {\n /**\n * Platform that produced the error\n *\n * @since 8.5.0\n */\n platform: 'android' | 'ios';\n\n /**\n * Native error or reason code when available\n *\n * @since 8.5.0\n */\n nativeCode?: number | string;\n\n /**\n * Native error message when available (may be localized; do not parse for logic)\n *\n * @since 8.5.0\n */\n nativeMessage?: string;\n\n /**\n * Android API level of the device\n *\n * @since 8.5.0\n */\n androidApiLevel?: number;\n\n /**\n * Stage of the connection flow where the failure occurred\n *\n * @since 8.5.0\n */\n connectionStage?:\n | 'validation'\n | 'permission'\n | 'request'\n | 'association'\n | 'authentication'\n | 'ipProvisioning'\n | 'verification';\n}\n\n/**\n * Options for disconnecting from a network\n *\n * @since 7.0.0\n */\nexport interface DisconnectOptions {\n /**\n * The SSID of the network to disconnect from (optional)\n *\n * @since 7.0.0\n */\n ssid?: string;\n}\n\n/**\n * Result from getAvailableNetworks()\n *\n * @since 7.0.0\n */\nexport interface GetAvailableNetworksResult {\n /**\n * List of available networks\n *\n * @since 7.0.0\n */\n networks: Network[];\n}\n\n/**\n * Represents a Wi-Fi network\n *\n * @since 7.0.0\n */\nexport interface Network {\n /**\n * The SSID of the network\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The signal strength in dBm\n *\n * @since 7.0.0\n */\n rssi: number;\n\n /**\n * The security types supported by this network (Android SDK 33+ only)\n *\n * @since 7.0.0\n */\n securityTypes?: NetworkSecurityType[];\n}\n\n/**\n * Result from getIpAddress()\n *\n * @since 7.0.0\n */\nexport interface GetIpAddressResult {\n /**\n * The device's IP address\n *\n * @since 7.0.0\n */\n ipAddress: string;\n}\n\n/**\n * Result from getRssi()\n *\n * @since 7.0.0\n */\nexport interface GetRssiResult {\n /**\n * The signal strength in dBm\n *\n * @since 7.0.0\n */\n rssi: number;\n}\n\n/**\n * Result from getSsid()\n *\n * @since 7.0.0\n */\nexport interface GetSsidResult {\n /**\n * The SSID of the current network\n *\n * @since 7.0.0\n */\n ssid: string;\n}\n\n/**\n * Comprehensive WiFi information\n *\n * @since 7.0.0\n */\nexport interface WifiInfo {\n /**\n * The SSID (network name) of the current network\n *\n * @since 7.0.0\n */\n ssid: string;\n\n /**\n * The BSSID (MAC address) of the access point.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n bssid?: string;\n\n /**\n * The device's IP address on the network\n *\n * @since 7.0.0\n */\n ip: string;\n\n /**\n * The network frequency in MHz.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n frequency?: number;\n\n /**\n * The connection speed in Mbps.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n linkSpeed?: number;\n\n /**\n * The signal strength (0-100).\n * Calculated from RSSI on Android.\n * Not available on iOS.\n *\n * @since 7.0.0\n */\n signalStrength?: number;\n}\n\n/**\n * Result from isEnabled()\n *\n * @since 7.0.0\n */\nexport interface IsEnabledResult {\n /**\n * Whether Wi-Fi is enabled\n *\n * @since 7.0.0\n */\n enabled: boolean;\n}\n\n/**\n * Permission status\n *\n * @since 7.0.0\n */\nexport interface PermissionStatus {\n /**\n * Location permission state\n *\n * @since 7.0.0\n */\n location: PermissionState;\n}\n\n/**\n * Possible permission states\n *\n * @since 7.0.0\n */\nexport type PermissionState = 'granted' | 'denied' | 'prompt';\n\n/**\n * Options for requesting permissions\n *\n * @since 7.0.0\n */\nexport interface RequestPermissionsOptions {\n /**\n * Permissions to request\n *\n * @since 7.0.0\n */\n permissions?: 'location'[];\n}\n\n/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport enum NetworkSecurityType {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n OPEN = 0,\n\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n WEP = 1,\n\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n WPA2_PSK = 2,\n\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n EAP = 3,\n\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n SAE = 4,\n\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n WPA3_ENTERPRISE = 5,\n\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n WPA3_ENTERPRISE_192_BIT = 6,\n\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n PASSPOINT = 7,\n\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n OWE = 8,\n\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n WAPI_PSK = 9,\n\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n WAPI_CERT = 10,\n}\n\n/**\n * Options for checking whether a network is saved\n *\n * @since 8.2.0\n */\nexport interface IsNetworkSavedOptions {\n /**\n * The SSID of the network to check\n *\n * @since 8.2.0\n */\n ssid: string;\n}\n\n/**\n * Result from isNetworkSaved()\n *\n * @since 8.2.0\n */\nexport interface IsNetworkSavedResult {\n /**\n * Whether the network has already been saved/configured by this app\n *\n * @since 8.2.0\n */\n isSaved: boolean;\n}\n\n/**\n * Options for sharing Wi-Fi network credentials\n *\n * @since 8.4.0\n */\nexport interface ShareNetworkOptions {\n /**\n * Android: Wi-Fi Easy Connect (DPP) URI from the target device.\n * When provided, launches the system UI to provision Wi-Fi credentials to that device.\n *\n * @since 8.4.0\n */\n dppUri?: string;\n\n /**\n * Network SSID to share via QR code on Android.\n * When omitted, the system uses the currently connected network when possible.\n *\n * @since 8.4.0\n */\n ssid?: string;\n\n /**\n * Network password for QR code sharing on Android.\n * Required when sharing a specific WPA/WPA2/WPA3 network via QR code.\n * iOS does not allow reading saved Wi-Fi passwords from the system.\n *\n * @since 8.4.0\n */\n password?: string;\n\n /**\n * iOS 26.2+: Bluetooth identifier of a paired AccessorySetupKit accessory.\n * Required for Wi-Fi Infrastructure network sharing on iOS unless `accessoryIdentifier` is set.\n *\n * @since 8.4.0\n */\n bluetoothIdentifier?: string;\n\n /**\n * iOS 26.2+: Accessory UUID from AccessorySetupKit.\n * Alternative lookup key when `bluetoothIdentifier` is unavailable.\n *\n * @since 8.4.0\n */\n accessoryIdentifier?: string;\n\n /**\n * iOS 26.2+: Request initial Wi-Fi network sharing authorization for the accessory.\n *\n * @since 8.4.0\n * @default false\n */\n requestAuthorization?: boolean;\n\n /**\n * iOS 26.2+: Prompt the user to share the current Wi-Fi network with the accessory.\n *\n * @since 8.4.0\n * @default true\n */\n askToShare?: boolean;\n}\n\n/**\n * Authorization state returned by iOS Wi-Fi Infrastructure sharing\n *\n * @since 8.4.0\n */\nexport type WifiSharingAuthorizationState = 'authorized' | 'denied' | 'notDetermined' | 'unsupported';\n\n/**\n * Result state returned by iOS Wi-Fi Infrastructure askToShare()\n *\n * @since 8.4.0\n */\nexport type WifiSharingAskState = 'shared' | 'declined' | 'cancelled' | 'notNeeded' | 'unsupported';\n\n/**\n * Result from shareNetwork()\n *\n * @since 8.4.0\n */\nexport interface ShareNetworkResult {\n /**\n * Whether the platform sharing flow was started or completed.\n *\n * @since 8.4.0\n */\n started: boolean;\n\n /**\n * iOS: Authorization state after `requestAuthorization`, when requested.\n *\n * @since 8.4.0\n */\n authorizationState?: WifiSharingAuthorizationState;\n\n /**\n * iOS: Result of `askToShare` when requested.\n *\n * @since 8.4.0\n */\n askToShareState?: WifiSharingAskState;\n}\n"]}
@@ -2,6 +2,79 @@
2
2
 
3
3
  var core = require('@capacitor/core');
4
4
 
5
+ /**
6
+ * Stable error codes returned by {@link CapacitorWifiPlugin.connect} on failure.
7
+ * Specific codes are returned only when the native platform explicitly provides that reason.
8
+ * Otherwise the plugin returns {@link WifiConnectionErrorCode.CONNECTION_FAILED}.
9
+ *
10
+ * @since 8.5.0
11
+ */
12
+ exports.WifiConnectionErrorCode = void 0;
13
+ (function (WifiConnectionErrorCode) {
14
+ /**
15
+ * The SSID, password format, security configuration, timeout, or native request parameters are invalid.
16
+ *
17
+ * @since 8.5.0
18
+ */
19
+ WifiConnectionErrorCode["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
20
+ /**
21
+ * A required permission or authorization is missing or was denied.
22
+ *
23
+ * @since 8.5.0
24
+ */
25
+ WifiConnectionErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
26
+ /**
27
+ * Wi-Fi is disabled and the connection cannot be started.
28
+ *
29
+ * @since 8.5.0
30
+ */
31
+ WifiConnectionErrorCode["WIFI_DISABLED"] = "WIFI_DISABLED";
32
+ /**
33
+ * The native API explicitly reports that the user rejected the connection request.
34
+ * Available on iOS; on Android only when the OS reports user rejection (API 36+).
35
+ *
36
+ * @since 8.5.0
37
+ */
38
+ WifiConnectionErrorCode["USER_DENIED"] = "USER_DENIED";
39
+ /**
40
+ * The native API explicitly reports an authentication failure.
41
+ * Not reliably available on Android API 29–33.
42
+ *
43
+ * @since 8.5.0
44
+ */
45
+ WifiConnectionErrorCode["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED";
46
+ /**
47
+ * The native API explicitly reports that the requested access point was not found.
48
+ * Not reliably available on Android API 29–33.
49
+ *
50
+ * @since 8.5.0
51
+ */
52
+ WifiConnectionErrorCode["NETWORK_NOT_FOUND"] = "NETWORK_NOT_FOUND";
53
+ /**
54
+ * The plugin timeout expired before the requested network was confirmed as connected.
55
+ *
56
+ * @since 8.5.0
57
+ */
58
+ WifiConnectionErrorCode["CONNECTION_TIMEOUT"] = "CONNECTION_TIMEOUT";
59
+ /**
60
+ * The connection failed, but the platform did not provide a reliable detailed reason.
61
+ *
62
+ * @since 8.5.0
63
+ */
64
+ WifiConnectionErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
65
+ /**
66
+ * Another Wi-Fi connection attempt is already active.
67
+ *
68
+ * @since 8.5.0
69
+ */
70
+ WifiConnectionErrorCode["CONNECTION_IN_PROGRESS"] = "CONNECTION_IN_PROGRESS";
71
+ /**
72
+ * An unexpected plugin or native error occurred.
73
+ *
74
+ * @since 8.5.0
75
+ */
76
+ WifiConnectionErrorCode["UNKNOWN"] = "UNKNOWN";
77
+ })(exports.WifiConnectionErrorCode || (exports.WifiConnectionErrorCode = {}));
5
78
  /**
6
79
  * Network security types
7
80
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport var NetworkSecurityType;\n(function (NetworkSecurityType) {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OPEN\"] = 0] = \"OPEN\";\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WEP\"] = 1] = \"WEP\";\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA2_PSK\"] = 2] = \"WPA2_PSK\";\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"EAP\"] = 3] = \"EAP\";\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"SAE\"] = 4] = \"SAE\";\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE\"] = 5] = \"WPA3_ENTERPRISE\";\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE_192_BIT\"] = 6] = \"WPA3_ENTERPRISE_192_BIT\";\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"PASSPOINT\"] = 7] = \"PASSPOINT\";\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OWE\"] = 8] = \"OWE\";\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_PSK\"] = 9] = \"WAPI_PSK\";\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_CERT\"] = 10] = \"WAPI_CERT\";\n})(NetworkSecurityType || (NetworkSecurityType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst CapacitorWifi = registerPlugin('CapacitorWifi', {\n web: () => import('./web').then((m) => new m.CapacitorWifiWeb()),\n});\nexport * from './definitions';\nexport { CapacitorWifi };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorWifiWeb extends WebPlugin {\n async addNetwork(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async connect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async disconnect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getAvailableNetworks() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getIpAddress() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getRssi() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getSsid() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getWifiInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n async startScan() {\n throw this.unimplemented('Not implemented on web.');\n }\n async checkPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async requestPermissions(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async isNetworkSaved(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async shareNetwork(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getPluginVersion() {\n return { version: '1.0.0' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["NetworkSecurityType","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,mBAAmB,EAAE;AAChC;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AACjE;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU;AACzE;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK;AAC/D;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,iBAAiB;AACvF;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,GAAG,yBAAyB;AACvG;AACA;AACA;AACA;AACA;AACA,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW;AAC3E;AACA;AACA;AAC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C3D,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,kBAAkB,CAAC,QAAQ,EAAE;AACvC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;AACnC,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * Stable error codes returned by {@link CapacitorWifiPlugin.connect} on failure.\n * Specific codes are returned only when the native platform explicitly provides that reason.\n * Otherwise the plugin returns {@link WifiConnectionErrorCode.CONNECTION_FAILED}.\n *\n * @since 8.5.0\n */\nexport var WifiConnectionErrorCode;\n(function (WifiConnectionErrorCode) {\n /**\n * The SSID, password format, security configuration, timeout, or native request parameters are invalid.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"INVALID_CONFIGURATION\"] = \"INVALID_CONFIGURATION\";\n /**\n * A required permission or authorization is missing or was denied.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"PERMISSION_DENIED\"] = \"PERMISSION_DENIED\";\n /**\n * Wi-Fi is disabled and the connection cannot be started.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"WIFI_DISABLED\"] = \"WIFI_DISABLED\";\n /**\n * The native API explicitly reports that the user rejected the connection request.\n * Available on iOS; on Android only when the OS reports user rejection (API 36+).\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"USER_DENIED\"] = \"USER_DENIED\";\n /**\n * The native API explicitly reports an authentication failure.\n * Not reliably available on Android API 29–33.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"AUTHENTICATION_FAILED\"] = \"AUTHENTICATION_FAILED\";\n /**\n * The native API explicitly reports that the requested access point was not found.\n * Not reliably available on Android API 29–33.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"NETWORK_NOT_FOUND\"] = \"NETWORK_NOT_FOUND\";\n /**\n * The plugin timeout expired before the requested network was confirmed as connected.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"CONNECTION_TIMEOUT\"] = \"CONNECTION_TIMEOUT\";\n /**\n * The connection failed, but the platform did not provide a reliable detailed reason.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"CONNECTION_FAILED\"] = \"CONNECTION_FAILED\";\n /**\n * Another Wi-Fi connection attempt is already active.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"CONNECTION_IN_PROGRESS\"] = \"CONNECTION_IN_PROGRESS\";\n /**\n * An unexpected plugin or native error occurred.\n *\n * @since 8.5.0\n */\n WifiConnectionErrorCode[\"UNKNOWN\"] = \"UNKNOWN\";\n})(WifiConnectionErrorCode || (WifiConnectionErrorCode = {}));\n/**\n * Network security types\n *\n * @since 7.0.0\n */\nexport var NetworkSecurityType;\n(function (NetworkSecurityType) {\n /**\n * Open network with no security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OPEN\"] = 0] = \"OPEN\";\n /**\n * WEP security\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WEP\"] = 1] = \"WEP\";\n /**\n * WPA/WPA2 Personal (PSK)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA2_PSK\"] = 2] = \"WPA2_PSK\";\n /**\n * WPA/WPA2/WPA3 Enterprise (EAP)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"EAP\"] = 3] = \"EAP\";\n /**\n * WPA3 Personal (SAE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"SAE\"] = 4] = \"SAE\";\n /**\n * WPA3 Enterprise\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE\"] = 5] = \"WPA3_ENTERPRISE\";\n /**\n * WPA3 Enterprise 192-bit mode\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WPA3_ENTERPRISE_192_BIT\"] = 6] = \"WPA3_ENTERPRISE_192_BIT\";\n /**\n * Passpoint network\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"PASSPOINT\"] = 7] = \"PASSPOINT\";\n /**\n * Enhanced Open (OWE)\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"OWE\"] = 8] = \"OWE\";\n /**\n * WAPI PSK\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_PSK\"] = 9] = \"WAPI_PSK\";\n /**\n * WAPI Certificate\n *\n * @since 7.0.0\n */\n NetworkSecurityType[NetworkSecurityType[\"WAPI_CERT\"] = 10] = \"WAPI_CERT\";\n})(NetworkSecurityType || (NetworkSecurityType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst CapacitorWifi = registerPlugin('CapacitorWifi', {\n web: () => import('./web').then((m) => new m.CapacitorWifiWeb()),\n});\nexport * from './definitions';\nexport { CapacitorWifi };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorWifiWeb extends WebPlugin {\n async addNetwork(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async connect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async disconnect(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getAvailableNetworks() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getIpAddress() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getRssi() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getSsid() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getWifiInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isEnabled() {\n throw this.unimplemented('Not implemented on web.');\n }\n async startScan() {\n throw this.unimplemented('Not implemented on web.');\n }\n async checkPermissions() {\n throw this.unimplemented('Not implemented on web.');\n }\n async requestPermissions(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async isNetworkSaved(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async shareNetwork(_options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getPluginVersion() {\n return { version: '1.0.0' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["WifiConnectionErrorCode","NetworkSecurityType","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACWA;AACX,CAAC,UAAU,uBAAuB,EAAE;AACpC;AACA;AACA;AACA;AACA;AACA,IAAI,uBAAuB,CAAC,uBAAuB,CAAC,GAAG,uBAAuB;AAC9E;AACA;AACA;AACA;AACA;AACA,IAAI,uBAAuB,CAAC,mBAAmB,CAAC,GAAG,mBAAmB;AACtE;AACA;AACA;AACA;AAC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Aa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE;AACnC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -1,6 +1,79 @@
1
1
  var capacitorCapgoWifi = (function (exports, core) {
2
2
  'use strict';
3
3
 
4
+ /**
5
+ * Stable error codes returned by {@link CapacitorWifiPlugin.connect} on failure.
6
+ * Specific codes are returned only when the native platform explicitly provides that reason.
7
+ * Otherwise the plugin returns {@link WifiConnectionErrorCode.CONNECTION_FAILED}.
8
+ *
9
+ * @since 8.5.0
10
+ */
11
+ exports.WifiConnectionErrorCode = void 0;
12
+ (function (WifiConnectionErrorCode) {
13
+ /**
14
+ * The SSID, password format, security configuration, timeout, or native request parameters are invalid.
15
+ *
16
+ * @since 8.5.0
17
+ */
18
+ WifiConnectionErrorCode["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
19
+ /**
20
+ * A required permission or authorization is missing or was denied.
21
+ *
22
+ * @since 8.5.0
23
+ */
24
+ WifiConnectionErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
25
+ /**
26
+ * Wi-Fi is disabled and the connection cannot be started.
27
+ *
28
+ * @since 8.5.0
29
+ */
30
+ WifiConnectionErrorCode["WIFI_DISABLED"] = "WIFI_DISABLED";
31
+ /**
32
+ * The native API explicitly reports that the user rejected the connection request.
33
+ * Available on iOS; on Android only when the OS reports user rejection (API 36+).
34
+ *
35
+ * @since 8.5.0
36
+ */
37
+ WifiConnectionErrorCode["USER_DENIED"] = "USER_DENIED";
38
+ /**
39
+ * The native API explicitly reports an authentication failure.
40
+ * Not reliably available on Android API 29–33.
41
+ *
42
+ * @since 8.5.0
43
+ */
44
+ WifiConnectionErrorCode["AUTHENTICATION_FAILED"] = "AUTHENTICATION_FAILED";
45
+ /**
46
+ * The native API explicitly reports that the requested access point was not found.
47
+ * Not reliably available on Android API 29–33.
48
+ *
49
+ * @since 8.5.0
50
+ */
51
+ WifiConnectionErrorCode["NETWORK_NOT_FOUND"] = "NETWORK_NOT_FOUND";
52
+ /**
53
+ * The plugin timeout expired before the requested network was confirmed as connected.
54
+ *
55
+ * @since 8.5.0
56
+ */
57
+ WifiConnectionErrorCode["CONNECTION_TIMEOUT"] = "CONNECTION_TIMEOUT";
58
+ /**
59
+ * The connection failed, but the platform did not provide a reliable detailed reason.
60
+ *
61
+ * @since 8.5.0
62
+ */
63
+ WifiConnectionErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
64
+ /**
65
+ * Another Wi-Fi connection attempt is already active.
66
+ *
67
+ * @since 8.5.0
68
+ */
69
+ WifiConnectionErrorCode["CONNECTION_IN_PROGRESS"] = "CONNECTION_IN_PROGRESS";
70
+ /**
71
+ * An unexpected plugin or native error occurred.
72
+ *
73
+ * @since 8.5.0
74
+ */
75
+ WifiConnectionErrorCode["UNKNOWN"] = "UNKNOWN";
76
+ })(exports.WifiConnectionErrorCode || (exports.WifiConnectionErrorCode = {}));
4
77
  /**
5
78
  * Network security types
6
79
  *