Fix `JsonPropertyName` problem in `SessionIdentification` class;

Fix code style problems in `Socialvoid.Security.Otp` namespace.

Signed-off-by: Aliwoto <aminnimaj@gmail.com>
This commit is contained in:
Aliwoto 2021-10-01 10:10:13 +00:00
parent fa13a7e88d
commit a23ef86d83
No known key found for this signature in database
GPG Key ID: 646B4FE4205EC48C
5 changed files with 24 additions and 18 deletions

View File

@ -399,7 +399,6 @@ namespace Socialvoid.Client
{
var otp = new Totp(Encoding.UTF8.GetBytes(secret));
return KeyGeneration.GetSha1(otp.ComputeTotp() + PrivateHash);;
//return null;
}
#endregion

View File

@ -77,7 +77,7 @@ namespace Socialvoid.Security.Otp
}
}
//if we didn't end with a full byte
// in the case we didn't end with a full byte
if (arrayIndex != byteCount)
{
returnArray[arrayIndex] = curByte;
@ -120,7 +120,7 @@ namespace Socialvoid.Security.Otp
nextChar = (byte)((b << bitsRemaining) & 31);
}
//if we didn't end with a full char
// in the case we didn't end with a full char
if (arrayIndex != charCount)
{
returnArray[arrayIndex++] = ValueToChar(nextChar);

View File

@ -79,10 +79,12 @@ namespace Socialvoid.Security.Otp
/// <param name="key">Plaintext key data</param>
public InMemoryKey(byte[] key)
{
if(!(key != null))
throw new ArgumentNullException("key");
if(!(key.Length > 0))
throw new ArgumentException("The key must not be empty");
if (key == null || key.Length == 0)
{
throw new ArgumentException("Key cannot be empty or null",
nameof(key));
}
_keyLength = key.Length;
int paddedKeyLength = (int)Math.Ceiling((decimal)key.Length / (decimal)16) * 16;

View File

@ -1,3 +1,5 @@
using System.Text.Json.Serialization;
namespace Socialvoid.Security
{
/// <summary>
@ -26,17 +28,20 @@ namespace Socialvoid.Security
/// The ID of the session obtained when establishing a session.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("session_id")]
public string SessionID { get; internal set; }
/// <summary>
/// The Public Hash of the client used when establishing the session.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("client_public_hash")]
public string ClientPublicHash { get; internal set; }
/// <summary>
/// The session challenge answer revolving around the client's
/// private hash, the same client used to establish the session.
/// <code> since: v0.0.0 </code>
/// </summary>
[JsonPropertyName("challenge_answer")]
public string ChallengeAnswer { get; internal set; }
#endregion
//-------------------------------------------------