Avengers 2.0.0

I'm very lazy to write description

Install-Package Avengers -Version 2.0.0
dotnet add package Avengers --version 2.0.0
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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

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

Release Notes

Avengers Reloaded 2.0 Version

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.0 203 11/14/2018
1.0.5 170 10/19/2018
1.0.4 171 10/16/2018
1.0.3 168 10/12/2018
1.0.2 184 10/10/2018
1.0.1 209 10/4/2018
1.0.0 189 10/4/2018