Avengers 2.0.0

dotnet add package Avengers --version 2.0.0                
NuGet\Install-Package Avengers -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Avengers" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Avengers --version 2.0.0                
#r "nuget: Avengers, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Avengers as a Cake Addin
#addin nuget:?package=Avengers&version=2.0.0

// Install Avengers as a Cake Tool
#tool nuget:?package=Avengers&version=2.0.0                

Avengers

This library is used for transmit the data through the network channel securely between client and server with digital signature.In the server side i used IIS express as server and wrote restful services in .Net Web api and in client side i used angularjs service to http requests.currently it only supports GET and POST requests.

usage

in C#

For Token Generation
  token_gen.initialize();  // For Initializing the token generation library.
  token_gen.expiry_minutes = 30; // For setting lifespam of a token. 
  token_gen.addClaim("admin"); // For adding preveliges to the user in token. 
  token_gen.PRIMARY_MACHINE_KEY = ""; //These two machine keys for encryption of token and decryption this one must be 32 bytes length.
  token_gen.SECONDARY_MACHINE_KEY = ""; //Must be 16 bytes length.
  token_gen.addResponse("Status", "Success"); //adding additional response paramters to http response.
  token_gen.generate_token(); //To generate token based on above parameters.
Example
        [HttpPost]
        [Route("Token")]
        public IHttpActionResult Token()
        {
            token_gen.initialize();
            token_gen.expiry_minutes = 30;
            token_gen.addClaim("admin");
            token_gen.PRIMARY_MACHINE_KEY = "10101010101010101010101010101010";
            token_gen.SECONDARY_MACHINE_KEY = "1010101010101010";
            token_gen.addResponse("Status", "Success");

           return Ok(token_gen.generate_token());
        }
For Token Verifications
  List<string> obj = new List<string>();
            obj.Add("admin");// Only the added user can access this api. 
  string value = token_gen.Authorize(data); // returns the decrypted data
Example
        [HttpPost]
        [Route("Encrypt_Check")]
        public IHttpActionResult Encrypt_Check(dynamic data)
        {
            string value = token_gen.Authorize(data);
            return Ok(value);
        }

        [HttpGet]
        [Route("Encrypt_Check_get")]
        public IHttpActionResult Encrypt_Check_get(string data)
        {

            List<string> obj = new List<string>();
            obj.Add("admin");
            string value = token_gen.Authorize(data,obj);

            return Ok(value);
        }

in Angularjs

Description

Module Name : Network Controller Import Name : network_service

    var req = { Name: "Venkatesh Nelli", Type: "Admin" }; // JOSN Data
    
    ns.encrypt_post(URL, req, token, function (data) { // token which is generated in C# backend 
         console.log("From Response : " + data.data);
      },
      function (data) {
          console.log("Error Response : " + data.data);
    });

    ns.encrypt_get(URL, req, token, function (data) {
          console.log("From Response : " + data.data);
      },
      function (data) {
            console.log("Error Response : " + data.data);
      });

Example
(function () {

     var app = angular.module("myApp", ['Network']);

    app.controller("Home_Controller", ['$scope','network_service', home_ctrl]);

    function home_ctrl(scope, datacontext, ns) {


            var req = { Name: "Venkatesh Nelli", Type: "Admin" };

            ns.encrypt_post(URL, req, token, function (data) {
                console.log("From Response : " + data.data);
            },
                function (data) {
                    console.log("Error Response : " + data.data);
                });


            ns.encrypt_get(URL, req, token, function (data) {
                console.log("From Response : " + data.data);
            },
                function (data) {
                    console.log("Error Response : " + data.data);
                });

        }
        })();
        

Additional Info

Expiry Methods
token_gen.expiry_days = 30 // token  expire duration in days 
token_gen.expiry_seconds = 30 // token  expire duration in seconds
token_gen.expiry_minutes = 30 // token  expire duration in minutes
token_gen.expiry_hours = 30 // token  expire duration in hours
token_gen.expiry_month = 30 // token  expire duration in month
token_gen.expiry_year = 30 // token  expire duration in year
Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 989 11/14/2018
1.0.5 805 10/19/2018
1.0.4 794 10/16/2018
1.0.3 798 10/12/2018
1.0.2 861 10/10/2018
1.0.1 882 10/4/2018
1.0.0 859 10/4/2018

Avengers Reloaded 2.0 Version