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:
parent
fa13a7e88d
commit
a23ef86d83
|
@ -399,7 +399,6 @@ namespace Socialvoid.Client
|
|||
{
|
||||
var otp = new Totp(Encoding.UTF8.GetBytes(secret));
|
||||
return KeyGeneration.GetSha1(otp.ComputeTotp() + PrivateHash);;
|
||||
//return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
//-------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue