Skip to content

Commit 2b89964

Browse files
committed
Breaking Change: Controller constructor now returns keys if newly generated
1 parent d4412b2 commit 2b89964

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

HomeKitDotNet/Controller.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,26 @@ public class Controller : IDisposable
2727
{
2828
private byte[] LTPK;
2929
private byte[] LTSK;
30-
private byte[] DeviceID;
30+
private byte[] deviceID;
3131
private List<HomeKitEndPoint> endpoints = new List<HomeKitEndPoint>();
3232

33-
public Controller()
33+
public Controller(out byte[] publicKey, out byte[] privateKey)
3434
{
3535
byte[] seed = RandomNumberGenerator.GetBytes(32);
3636
Ed25519.KeyPairFromSeed(out LTPK, out LTSK, seed);
37-
DeviceID = RandomNumberGenerator.GetBytes(16);
37+
deviceID = RandomNumberGenerator.GetBytes(16);
38+
publicKey = LTPK;
39+
privateKey = LTSK;
3840
}
3941
public Controller(byte[] privateKey, byte[] publicKey, byte[] deviceID)
4042
{
4143
LTPK = publicKey;
4244
LTSK = privateKey;
43-
DeviceID = deviceID;
45+
this.deviceID = deviceID;
4446
}
4547

48+
public byte[] DeviceID { get { return deviceID; } }
49+
4650
public async Task<HomeKitEndPoint> Connect(IPEndPoint destination, byte[] accessoryID, byte[] accessoryLTPK)
4751
{
4852
X25519 session = new X25519();

0 commit comments

Comments
 (0)