Skip to content

Commit 905f12a

Browse files
committed
Change Javadocs to C# XML documentation
1 parent b170ec9 commit 905f12a

38 files changed

+1055
-1211
lines changed

libsignal-protocol-dotnet-tests/UnitTest1.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

libsignal-protocol-dotnet/IdentityKey.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Copyright (C) 2016 smndtrl, langboost
33
*
44
* This program is free software: you can redistribute it and/or modify
@@ -15,20 +15,16 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
using libsignal.ecc;
1918
using System;
19+
using libsignal.ecc;
2020

2121
namespace libsignal
2222
{
23-
/**
24-
* A class for representing an identity key.
25-
*
26-
* @author Moxie Marlinspike
27-
*/
28-
23+
/// <summary>
24+
/// A class for representing an identity key.
25+
/// </summary>
2926
public class IdentityKey
3027
{
31-
3228
private ECPublicKey publicKey;
3329

3430
public IdentityKey(ECPublicKey publicKey)
@@ -64,7 +60,6 @@ public override bool Equals(Object other)
6460
return publicKey.Equals(((IdentityKey)other).getPublicKey());
6561
}
6662

67-
6863
public override int GetHashCode()
6964
{
7065
return publicKey.GetHashCode();

libsignal-protocol-dotnet/IdentityKeyPair.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-

2-
using Google.Protobuf;
31
/**
42
* Copyright (C) 2016 smndtrl, langboost
53
*
@@ -16,19 +14,18 @@
1614
* You should have received a copy of the GNU General Public License
1715
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1816
*/
17+
18+
using Google.Protobuf;
1919
using libsignal.ecc;
2020
using libsignal.state;
2121

2222
namespace libsignal
2323
{
24-
/**
25-
* Holder for public and private identity key pair.
26-
*
27-
* @author
28-
*/
24+
/// <summary>
25+
/// Holder for public and private identity key pair.
26+
/// </summary>
2927
public class IdentityKeyPair
3028
{
31-
3229
private readonly IdentityKey publicKey;
3330
private readonly ECPrivateKey privateKey;
3431

libsignal-protocol-dotnet/SessionBuilder.cs

Lines changed: 50 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Copyright (C) 2016 smndtrl, langboost
33
*
44
* This program is free software: you can redistribute it and/or modify
@@ -15,51 +15,48 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18+
using System.Diagnostics;
1819
using libsignal.ecc;
1920
using libsignal.exceptions;
2021
using libsignal.protocol;
2122
using libsignal.ratchet;
2223
using libsignal.state;
23-
using libsignal.util;
2424
using Strilanc.Value;
25-
using System;
26-
using System.Diagnostics;
2725

2826
namespace libsignal
2927
{
30-
/**
31-
* SessionBuilder is responsible for setting up encrypted sessions.
32-
* Once a session has been established, {@link org.whispersystems.libsignal.SessionCipher}
33-
* can be used to encrypt/decrypt messages in that session.
34-
* <p>
35-
* Sessions are built from one of three different possible vectors:
36-
* <ol>
37-
* <li>A {@link org.whispersystems.libsignal.state.PreKeyBundle} retrieved from a server.</li>
38-
* <li>A {@link PreKeySignalMessage} received from a client.</li>
39-
* </ol>
40-
*
41-
* Sessions are constructed per recipientId + deviceId tuple. Remote logical users are identified
42-
* by their recipientId, and each logical recipientId can have multiple physical devices.
43-
*
44-
* @author Moxie Marlinspike
45-
*/
28+
/// <summary>
29+
/// SessionBuilder is responsible for setting up encrypted sessions.
30+
/// Once a session has been established, <see cref="SessionCipher"/> can be used to encrypt/decrypt messages in that
31+
/// session.
32+
///
33+
/// Sessions are built from one of three different possible vectors:
34+
/// <list type="number">
35+
/// <item><description>A <see cref="PreKeyBundle"/> retrieved from a server.</description></item>
36+
/// <item><description>A <see cref="PreKeySignalMessage"/> received from a client.</description></item>
37+
/// </list>
38+
///
39+
/// Sessions are constructed per recipientId + deviceId tuple. Remote logical users are identified by their
40+
/// recipientId, and each logical recipientId can have multiple physical devices.
41+
/// </summary>
4642
public class SessionBuilder
4743
{
48-
4944
private readonly SessionStore sessionStore;
5045
private readonly PreKeyStore preKeyStore;
5146
private readonly SignedPreKeyStore signedPreKeyStore;
5247
private readonly IdentityKeyStore identityKeyStore;
5348
private readonly SignalProtocolAddress remoteAddress;
5449

55-
/**
56-
* Constructs a SessionBuilder.
57-
*
58-
* @param sessionStore The {@link org.whispersystems.libsignal.state.SessionStore} to store the constructed session in.
59-
* @param preKeyStore The {@link org.whispersystems.libsignal.state.PreKeyStore} where the client's local {@link org.whispersystems.libsignal.state.PreKeyRecord}s are stored.
60-
* @param identityKeyStore The {@link org.whispersystems.libsignal.state.IdentityKeyStore} containing the client's identity key information.
61-
* @param remoteAddress The address of the remote user to build a session with.
62-
*/
50+
/// <summary>
51+
/// Constructs a SessionBuilder.
52+
/// </summary>
53+
/// <param name="sessionStore">The <see cref="SessionStore"/> to store the constructed session in.</param>
54+
/// <param name="preKeyStore">The <see cref="PreKeyStore"/> where the client's local <see cref="PreKeyRecord"/>s
55+
/// are stored.</param>
56+
/// <param name="signedPreKeyStore"></param>
57+
/// <param name="identityKeyStore">The <see cref="IdentityKeyStore"/> containing the client's identity key
58+
/// information.</param>
59+
/// <param name="remoteAddress">The address of the remote user to build a session with.</param>
6360
public SessionBuilder(SessionStore sessionStore,
6461
PreKeyStore preKeyStore,
6562
SignedPreKeyStore signedPreKeyStore,
@@ -73,32 +70,29 @@ public SessionBuilder(SessionStore sessionStore,
7370
this.remoteAddress = remoteAddress;
7471
}
7572

76-
/**
77-
* Constructs a SessionBuilder
78-
* @param store The {@link SignalProtocolStore} to store all state information in.
79-
* @param remoteAddress The address of the remote user to build a session with.
80-
*/
73+
/// <summary>
74+
/// Constructs a SessionBuilder
75+
/// </summary>
76+
/// <param name="store">The <see cref="SignalProtocolStore"/> to store all state information in.</param>
77+
/// <param name="remoteAddress">The address of the remote user to build a session with.</param>
8178
public SessionBuilder(SignalProtocolStore store, SignalProtocolAddress remoteAddress)
8279
: this(store, store, store, store, remoteAddress)
8380
{
8481
}
8582

86-
/**
87-
* Build a new session from a received {@link PreKeySignalMessage}.
88-
*
89-
* After a session is constructed in this way, the embedded {@link SignalMessage}
90-
* can be decrypted.
91-
*
92-
* @param message The received {@link PreKeySignalMessage}.
93-
* @throws org.whispersystems.libsignal.InvalidKeyIdException when there is no local
94-
* {@link org.whispersystems.libsignal.state.PreKeyRecord}
95-
* that corresponds to the PreKey ID in
96-
* the message.
97-
* @throws org.whispersystems.libsignal.InvalidKeyException when the message is formatted incorrectly.
98-
* @throws org.whispersystems.libsignal.UntrustedIdentityException when the {@link IdentityKey} of the sender is untrusted.
99-
*/
100-
/*package*/
101-
internal May<uint> process(SessionRecord sessionRecord, PreKeySignalMessage message)
83+
/// <summary>
84+
/// Build a new session from a received <see cref="PreKeySignalMessage"/>
85+
///
86+
/// After a session is constructed in this way, the embedded <see cref="SignalMessage"/> can be decrypted.
87+
/// </summary>
88+
/// <param name="sessionRecord"></param>
89+
/// <param name="message">The received <see cref="PreKeySignalMessage"/>.</param>
90+
/// <returns></returns>
91+
/// <exception cref="InvalidKeyIdException">when there is no local <see cref="PreKeyRecord"/> that corresponds
92+
/// to the PreKey ID in the message.</exception>
93+
/// <exception cref="InvalidKeyException">when the message is formatted incorrectly.</exception>
94+
/// <exception cref="UntrustedIdentityException">when the <see cref="IdentityKey"/> of the sender is untrusted.</exception>
95+
internal May<uint> process(SessionRecord sessionRecord, PreKeySignalMessage message)
10296
{
10397
uint messageVersion = message.getMessageVersion();
10498
IdentityKey theirIdentityKey = message.getIdentityKey();
@@ -160,17 +154,12 @@ private May<uint> processV3(SessionRecord sessionRecord, PreKeySignalMessage mes
160154
}
161155
}
162156

163-
/**
164-
* Build a new session from a {@link org.whispersystems.libsignal.state.PreKeyBundle} retrieved from
165-
* a server.
166-
*
167-
* @param preKey A PreKey for the destination recipient, retrieved from a server.
168-
* @throws InvalidKeyException when the {@link org.whispersystems.libsignal.state.PreKeyBundle} is
169-
* badly formatted.
170-
* @throws org.whispersystems.libsignal.UntrustedIdentityException when the sender's
171-
* {@link IdentityKey} is not
172-
* trusted.
173-
*/
157+
/// <summary>
158+
/// Build a new session from a <see cref="PreKeyBundle"/> retrieved from a server.
159+
/// </summary>
160+
/// <param name="preKey">A PreKey for the destination recipient, retrieved from a server.</param>
161+
/// <exception cref="InvalidKeyException">when the <see cref="PreKeyBundle"/> is badly formatted.</exception>
162+
/// <exception cref="UntrustedIdentityException">when the sender's <see cref="IdentityKey"/> is not trusted.</exception>
174163
public void process(PreKeyBundle preKey)
175164
{
176165
lock (SessionCipher.SESSION_LOCK)

0 commit comments

Comments
 (0)