Skip to content

Commit 5f9f437

Browse files
authored
Merge pull request #494 from Shane32/wpa2
Add support for WPA2 in PayloadGenerator
2 parents 56ace43 + f0a7865 commit 5f9f437

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

QRCoder/PayloadGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public enum Authentication
5353
{
5454
WEP,
5555
WPA,
56-
nopass
56+
nopass,
57+
WPA2
5758
}
5859
}
5960

QRCoderTests/PayloadGeneratorTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,19 @@ public void wifi_should_build_wpa()
317317
generator.ToString().ShouldBe($"WIFI:T:WPA;S:MyWiFiSSID;P:7heP4assw0rd;;");
318318
}
319319

320+
[Fact]
321+
[Category("PayloadGenerator/WiFi")]
322+
public void wifi_should_build_wpa2()
323+
{
324+
var ssid = "MyWiFiSSID";
325+
var password = "7heP4assw0rd";
326+
var authmode = PayloadGenerator.WiFi.Authentication.WPA2;
327+
var hideSSID = false;
328+
329+
var generator = new PayloadGenerator.WiFi(ssid, password, authmode, hideSSID);
330+
331+
generator.ToString().ShouldBe($"WIFI:T:WPA2;S:MyWiFiSSID;P:7heP4assw0rd;;");
332+
}
320333

321334
[Fact]
322335
[Category("PayloadGenerator/WiFi")]

0 commit comments

Comments
 (0)