Skip to content

devgalop/lrn.securelib

Repository files navigation

SecureLib

Github top language Github language count Repository size License Github issues Github forks Github stars

🚧 SecureLib 🚀 Under construction... 🚧


About   |   Features   |   Technologies   |   Requirements   |   Starting


🎯 About SecureLib

The Securelib is a simple C# library, developed with .Net 8 but fully compatible with .Net 6+, that provides you with the following features:

✨ Features

✔️ Aes Encryption/Decryption
✔️ RSA Encryption/Decryption
✔️ JWT Authentication tokens
✔️ TOTP Code

🚀 Technologies

The following tools were used in this project:

✅ Requirements

Before starting 🏁, you need to have Git, DotNet 8 SDK and Docker installed.

🏁 Starting

# Clone this project
$ git clone https://github.com/devgalop/lrn.securelib

# Access
$ cd {ROOT_FOLDER}

#Create own solution
dotnet new sln -n lrn.devgalop.securelib

# Assign projects to solution
dotnet sln add ./lrn.devgalop.securelib.Core/lrn.devgalop.securelib.Core.csproj
dotnet sln add ./lrn.devgalop.securelib.Infrastructure/lrn.devgalop.securelib.Infrastructure.csproj
dotnet sln add ./lrn.devgalop.securelib.Webapi/lrn.devgalop.securelib.Webapi.csproj
dotnet sln add ./lrn.devgalop.securelib.Tests/lrn.devgalop.securelib.Tests.csproj

# Install dependencies
$ dotnet restore ./lrn.devgalop.securelib.WebApi/lrn.devgalop.securelib.WebApi.csproj

# Build docker image
$ docker build -t securelib:development .

# Run docker-compose
$ docker-compose -f ./Docker/docker-compose-development.yml up -d

# The server will initialize in the <http://localhost:5200>

❓ How to use it?

If you need to use any of the libraries in the project, follow the steps below:

  1. Select the folder(s) you want to use and import them into your code.
  2. Each library has an 'Extensions' folder where you can find all the necessary configurations for using the library. Call the method(s) you need in the Program.cs file.
  # Use Core Services
  builder.Services.AddCustomServices();
  
  # Use JWT Authentication tokens
  builder.Services.AddJwtSecurity();

  # Use Aes Encryption/Decryption methods
  builder.Services.AddAesEncryption();

  # Use Rsa Encryption/Decryption methods
  builder.Services.AddRSAEncryption();

  # Use TOTP codes
  # IMPORTANT: TOTP uses the AesEncryption library for encrypting its codes.
  builder.Services.AddTOTP();

  #IMPORTANT: If you need to use JWT tokens, configure the middleware as follows
  app.UseMiddleware<JwtAuthenticationMiddelware>();
  1. Every library uses environment variables. Add them to your project for correct library execution.For development enviroment you can use the launchSettings.json file.

Back to top

About

Basic C# library to add security in API. This code allows to you add JWT token library, TOTP code and differents Encryption-Decryption methods.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors