SecureNative.SDK 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package SecureNative.SDK --version 1.0.4                
NuGet\Install-Package SecureNative.SDK -Version 1.0.4                
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="SecureNative.SDK" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SecureNative.SDK --version 1.0.4                
#r "nuget: SecureNative.SDK, 1.0.4"                
#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 SecureNative.SDK as a Cake Addin
#addin nuget:?package=SecureNative.SDK&version=1.0.4

// Install SecureNative.SDK as a Cake Tool
#tool nuget:?package=SecureNative.SDK&version=1.0.4                

C# SDK for SecureNative

SecureNative is rethinking-security-as-a-service, disrupting the cyber security space and the way enterprises consume and implement security solutions.

#SDK

This C# sdk is very light

Quickstart

Install the SecureNative.Sdk nuget.

//Command line: nuget install SecureNative.Sdk

//Packet Manager Console

install-package SecureNative.Sdk

//Visual Studio

  1. Go to Tools → Package Manager → Manage NuGet Packages for Solution...
  2. Click the Browse tab and search for SecureNative.Sdk
  3. Click the SecureNative.Sdk package in the search results, select version and what projects to apply it to on the right side, and click Install

Initialize the SDK

Go to the settings page of your SecureNative account and find your API KEY

Initialize using API KEY

var apiKey = "API_KEY";
var sn = new SecureNative.SDK.SecureNative(apiKey, new SecureNative.SDK.Models.SecureNativeOptions());

You can pass empty SecureNativeOptions object or you can set the following:

api url - target url the events will be sent (https://api.securenative.com/collector/api/v1). interval - minimum interval between sending events (1000ms). max events - maximum events that will be sent (1000). timeout - (1500 ms).

var apiKey = "API_KEY";
var sn = new SecureNative.SDK.SecureNative(apiKey, new SecureNative.SDK.Models.SecureNativeOptions(){
           ApiUrl = "https://other.domain.com",
          Interval = 1000,
          MaxEvents = 1000,
          Timeout = 1500,
          AutoSend = true
       });

You can build event merely from HttpContext:

var ev = SecureNative.SDK.VerifyWebhook.BuildEventFromContxt(HttpContext.Current, null);
// you can either send null as ievent or half completed ievent object  

Tracking events

Once the SDK has been initialized, tracking requests are sent through the SDK instance.

var apiKey = "API_KEY";
var sn = new SecureNative.SDK.SecureNative(apiKey, new SecureNative.SDK.Models.SecureNativeOptions()
{
    ApiUrl = "https://api.securenative.com/collector/api/v1",
    Interval = 1000,
    MaxEvents = 1000,
    Timeout = 1500,
    AutoSend = true
});
sn.Track(new SecureNative.SDK.Models.EventOptions()
{
    EventType = EventTypes.LOG_IN.ToDescriptionString(),
    IP = "162.247.74.201",
    User = new SecureNative.SDK.Models.User()
    {
        Id = "1",
        Email = "1@example.com",
        Name = "example"
    }
});

Verification events

Example

var apiKey = "API_KEY";
var sn = new SecureNative.SDK.SecureNative(apiKey, new SecureNative.SDK.Models.SecureNativeOptions()
{
    ApiUrl = "https://api.securenative.com/collector/api/v1",
    Interval = 1000,
    MaxEvents = 1000,
    Timeout = 1500,
    AutoSend = true
});

var verified = sn.Verify(new SecureNative.SDK.Models.EventOptions()
{
    EventType = EventTypes.LOG_IN.ToDescriptionString(),
    IP = "162.247.74.201",
    User = new SecureNative.SDK.Models.User()
    {
        Id = "1",
        Email = "1@example.com",
        Name = "example"
    }
});

Webhook entry filter

Apply our filter to verify the request is from us:


var apiKey = "1234";
var sn = new SecureNative.SDK.SecureNative(apiKey, new SecureNative.SDK.Models.SecureNativeOptions());
bool isOk = SecureNative.SDK.VerifyWebhook.IsRequestFromSecureNative(HttpContext.Current, apiKey);
//if isOK is true, continue. Otherwise, consider ruturning http code 401. 




Product Compatible and additional computed target framework versions.
.NET Framework net35 is compatible.  net40 was computed.  net403 was computed.  net45 was computed.  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
1.1.0 564 11/11/2019
1.0.5 493 8/26/2019
1.0.4 474 8/26/2019
1.0.3 493 8/21/2019
1.0.2 497 8/4/2019
1.0.1 523 7/30/2019
1.0.0 507 7/25/2019

First test version