Skip to content

Commit d43cbc9

Browse files
author
Kolappan Nathan
committed
v3.20
1 parent 8916d44 commit d43cbc9

File tree

6 files changed

+31
-41
lines changed

6 files changed

+31
-41
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [3.2.0] - 2019-05-09
8+
### Added
9+
- Documentation for encryption helper
10+
11+
### Changed
12+
- Renamed CSV Logger
13+
- Optimised code in helpersLib
14+
715
## [3.1.0] - 2019-05-08
816
### Changed
917
- Added sub classes to helper

src/WebApiBolierplate/Business.Lib/Core/Base.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ public class Base
1010

1111
public DBAdapter dBAdapter;
1212
public Helpers helper;
13-
public Logger logger;
13+
public CsvLogger csvLogger;
1414

1515
#endregion [Declarations]
1616

1717
public Base()
1818
{
19-
logger = new Logger(Config.Logger.DateFormat, Config.Logger.FileName);
19+
csvLogger = new CsvLogger(Config.Logger.DateFormat, Config.Logger.FileName);
2020
helper = new Helpers();
2121

2222
// uncomment this line when there is a valid connection string

src/WebApiBolierplate/Business.Lib/HelperLib.cs

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,29 @@ public class HelperLib : Base
88
{
99
#region [Security]
1010

11-
public string HashBCrypt(string plainText)
12-
{
13-
return helper.Hash.HashBCrypt(plainText);
14-
}
15-
16-
public bool VerifyBCrypt(string plainText, string hash)
17-
{
18-
return helper.Hash.VerifyBCrypt(plainText, hash);
19-
}
20-
21-
public string EncryptString(string clearText)
22-
{
23-
return helper.Encryption.EncryptString(clearText);
24-
}
25-
26-
public string DecryptString(string cipherText)
27-
{
28-
return helper.Encryption.DecryptString(cipherText);
29-
}
11+
public string HashBCrypt(string plainText) => helper.Hash.HashBCrypt(plainText);
12+
13+
public bool VerifyBCrypt(string plainText, string hash) => helper.Hash.VerifyBCrypt(plainText, hash);
14+
15+
public string EncryptString(string clearText) => helper.Encryption.EncryptString(clearText);
16+
17+
public string DecryptString(string cipherText) => helper.Encryption.DecryptString(cipherText);
3018

3119
#endregion [Security]
3220

3321
#region [Utilities]
3422

35-
public int GenRandomNumber(int min, int max)
36-
{
37-
return helper.Rando.GenRandomNumber(min, max);
38-
}
23+
public int GenRandomNumber(int min, int max) => helper.Rando.GenRandomNumber(min, max);
3924

40-
public string GenRandomChar(int length)
41-
{
42-
return helper.Rando.GenRandomChar(length, CharSet.AlphaNumeric);
43-
}
25+
public string GenRandomChar(int length) => helper.Rando.GenRandomChar(length, CharSet.AlphaNumeric);
4426

4527
#endregion [Utilities]
4628

4729
#region [Compression]
4830

49-
public string CompressToGzipString(string plaintText)
50-
{
51-
return helper.GZip.CompressToString(plaintText, Encoding.UTF8);
52-
}
31+
public string CompressToGzipString(string plaintText) => helper.GZip.CompressToString(plaintText, Encoding.UTF8);
5332

54-
public string DecompressGzipString(string compressedString)
55-
{
56-
return helper.GZip.DecompressString(compressedString, Encoding.UTF8);
57-
}
33+
public string DecompressGzipString(string compressedString) => helper.GZip.DecompressString(compressedString, Encoding.UTF8);
5834

5935
#endregion [Compression]
6036
}

src/WebApiBolierplate/Business.Lib/UserLib.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public int ValidateLogin(LoginDTO login)
4343
}
4444
catch (Exception ex)
4545
{
46-
logger.Error(ex);
46+
csvLogger.Error(ex);
4747
return -1;
4848
}
4949
}
@@ -64,7 +64,7 @@ public User GetUser(string userName)
6464
}
6565
catch (Exception ex)
6666
{
67-
logger.Error(ex);
67+
csvLogger.Error(ex);
6868
return null;
6969
}
7070
}

src/WebApiBolierplate/Core.Lib/Logger.cs renamed to src/WebApiBolierplate/Core.Lib/CsvLogger.cs

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

33
namespace Core.Lib
44
{
5-
public class Logger
5+
public class CsvLogger
66
{
77
#region [Declarations]
88

@@ -17,7 +17,7 @@ public class Logger
1717
/// <param name="fileName">Name of the log file. Without extension</param>
1818
/// <param name="relativePath">Relative path from Base directory.</param>
1919
/// <param name="replacementValue">Value to replace comma (,) with. Uses semicolon by default.</param>
20-
public Logger(string dateFormat, string fileName, string relativePath = "", char replacementValue = ';')
20+
public CsvLogger(string dateFormat, string fileName, string relativePath = "", char replacementValue = ';')
2121
{
2222
csvLogger = new nk.logger.csv.Logger(dateFormat, fileName, relativePath, replacementValue);
2323
}

src/WebApiBolierplate/Core.Lib/Security/EncryptionHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ private void BuildAesEncryptor()
2929
aesEncryptor.IV = pdb.GetBytes(16);
3030
}
3131

32+
/// <summary>
33+
/// Encrypts the given string and return ciphertext
34+
/// </summary>
3235
public string EncryptString(string clearText)
3336
{
3437
BuildAesEncryptor();
@@ -44,6 +47,9 @@ public string EncryptString(string clearText)
4447
}
4548
}
4649

50+
/// <summary>
51+
/// Decrypts the given string and returns plain text
52+
/// </summary>
4753
public string DecryptString(string cipherText)
4854
{
4955
BuildAesEncryptor();

0 commit comments

Comments
 (0)