Skip to content

Commit 77745f6

Browse files
committed
Minor refactor of class visibility
1 parent 315cb2e commit 77745f6

File tree

12 files changed

+30
-16
lines changed

12 files changed

+30
-16
lines changed

MatterDotNet/Constants.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,27 @@
1212

1313
namespace MatterDotNet
1414
{
15+
/// <summary>
16+
/// Assorted Matter Specification constant values
17+
/// </summary>
1518
public class Constants
1619
{
20+
/// <summary>
21+
/// Matter 1.0 Revision
22+
/// </summary>
1723
public const int MATTER_10_REVISION = 10;
24+
/// <summary>
25+
/// Matter 1.2 Revision
26+
/// </summary>
1827
public const int MATTER_12_REVISION = 11;
28+
/// <summary>
29+
/// Matter 1.3 Revision
30+
/// </summary>
1931
public const int MATTER_13_REVISION = 12;
32+
/// <summary>
33+
/// Matter 1.4 Revision
34+
/// </summary>
35+
public const int MATTER_14_REVISION = 13;
2036

2137
/// <summary>
2238
/// The current limit of 900 bytes was chosen to accommodate the maximum size of IPv6 frames, transport headers,

MatterDotNet/Protocol/Connection/IConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace MatterDotNet.Protocol.Connection
1717
{
18-
public interface IConnection : IDisposable
18+
internal interface IConnection : IDisposable
1919
{
2020
Task<Frame> Read();
2121
Task SendFrame(Exchange exchange, Frame frame, bool reliable);

MatterDotNet/Protocol/Connection/MRPConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
namespace MatterDotNet.Protocol.Connection
2323
{
24-
public class MRPConnection : IConnection
24+
internal class MRPConnection : IConnection
2525
{
2626
private static readonly TimeSpan MRP_STANDALONE_ACK_TIMEOUT = TimeSpan.FromMilliseconds(200);
2727
private const int MRP_BACKOFF_THRESHOLD = 1;

MatterDotNet/Protocol/Connection/Retransmission.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace MatterDotNet.Protocol.Connection
1717
{
18-
public record Retransmission (Exchange Exchange, uint Counter, PayloadWriter data)
18+
internal record Retransmission (Exchange Exchange, uint Counter, PayloadWriter data)
1919
{
2020
public SemaphoreSlim Ack { get; init; } = new SemaphoreSlim(0);
2121
public int SendCount { get; set; }

MatterDotNet/Protocol/Connection/TCPConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace MatterDotNet.Protocol.Connection
2121
{
22-
public class TCPConnection : IConnection
22+
internal class TCPConnection : IConnection
2323
{
2424
TcpClient client;
2525
NetworkStream stream;

MatterDotNet/Protocol/Cryptography/Crypto.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using MatterDotNet.Security;
1414
using System.Buffers.Binary;
1515
using System.Security.Cryptography;
16-
using System.Security.Cryptography.X509Certificates;
1716

1817
namespace MatterDotNet.Protocol.Cryptography
1918
{
@@ -57,12 +56,12 @@ public static ReadOnlySpan<byte> AEAD_GenerateEncrypt(byte[] key, Span<byte> pay
5756
/// <param name="additionalData"></param>
5857
/// <param name="nonce"></param>
5958
/// <returns></returns>
60-
public static bool AEAD_DecryptVerify(byte[] key, Span<byte> payload, ReadOnlySpan<byte> mic, ReadOnlySpan<byte> additionalData, ReadOnlySpan<byte> nonce)
59+
public static bool AEAD_DecryptVerify(byte[] key, Span<byte> payload, ReadOnlySpan<byte> additionalData, ReadOnlySpan<byte> nonce)
6160
{
6261
try
6362
{
6463
AesCcm aes = new AesCcm(key);
65-
aes.Decrypt(nonce, payload, mic, payload, additionalData);
64+
aes.Decrypt(nonce, payload.Slice(0, payload.Length - AEAD_MIC_LENGTH_BYTES), payload.Slice(payload.Length - AEAD_MIC_LENGTH_BYTES, AEAD_MIC_LENGTH_BYTES), payload.Slice(0, payload.Length - AEAD_MIC_LENGTH_BYTES), additionalData);
6665
return true;
6766
}
6867
catch (CryptographicException)

MatterDotNet/Protocol/InteractionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace MatterDotNet.Protocol
2121
{
22-
public class InteractionManager
22+
internal class InteractionManager
2323
{
2424
public static async Task<List<AttributeReportIB>> GetAttributes(SecureSession session, ushort endpoint, uint cluster, params uint[] attributes)
2525
{

MatterDotNet/Protocol/Payloads/Frame.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace MatterDotNet.Protocol.Payloads
2121
{
22-
public class Frame
22+
internal class Frame
2323
{
2424
internal const int MAX_SIZE = 1280;
2525
internal static readonly byte[] PRIVACY_INFO = Encoding.UTF8.GetBytes("PrivacyKey");
@@ -156,8 +156,7 @@ public Frame(Span<byte> payload)
156156
//TODO: For a CASE session, the Nonce Source Node ID SHALL be determined via the Secure Session Context associated with the Session Identifier.
157157

158158
if (Crypto.AEAD_DecryptVerify(session.Initiator ? session.R2IKey : session.I2RKey,
159-
slice.Slice(0, slice.Length - Crypto.AEAD_MIC_LENGTH_BYTES),
160-
slice.Slice(slice.Length - Crypto.AEAD_MIC_LENGTH_BYTES, Crypto.AEAD_MIC_LENGTH_BYTES),
159+
slice,
161160
payload.Slice(0, payload.Length - slice.Length),
162161
nonce))
163162
Message = new Version1Payload(slice.Slice(0, slice.Length - Crypto.AEAD_MIC_LENGTH_BYTES));

MatterDotNet/Protocol/Sessions/Exchange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace MatterDotNet.Protocol.Sessions
1717
{
18-
public class Exchange : IDisposable
18+
internal class Exchange : IDisposable
1919
{
2020
private const int MSG_COUNTER_WINDOW_SIZE = 32;
2121

MatterDotNet/Protocol/Sessions/SecureSession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class SecureSession : SessionContext
3131
public uint ActiveThreshold { get; init; }
3232
public bool PeerActive { get { return (DateTime.Now - LastActive).TotalMilliseconds < SessionManager.GetDefaultSessionParams().SessionActiveThreshold; } }
3333

34-
public SecureSession(IConnection connection, bool PASE, bool initiator, ushort localSessionID, ushort remoteSessionID, byte[] i2rKey, byte[] r2iKey, byte[] sharedSecret, uint localMessageCounter, MessageState remoteMessageCounter, ulong initiatorNodeId, ulong peerNodeId, uint sessionIdleInterval, uint sessionActiveInterval, uint sessionActiveThreshold) : base(connection, initiator, initiatorNodeId, peerNodeId, localSessionID, remoteSessionID, remoteMessageCounter)
34+
internal SecureSession(IConnection connection, bool PASE, bool initiator, ushort localSessionID, ushort remoteSessionID, byte[] i2rKey, byte[] r2iKey, byte[] sharedSecret, uint localMessageCounter, MessageState remoteMessageCounter, ulong initiatorNodeId, ulong peerNodeId, uint sessionIdleInterval, uint sessionActiveInterval, uint sessionActiveThreshold) : base(connection, initiator, initiatorNodeId, peerNodeId, localSessionID, remoteSessionID, remoteMessageCounter)
3535
{
3636
this.PASE = PASE;
3737
I2RKey = i2rKey;

0 commit comments

Comments
 (0)