SecureNative.SDK
1.0.4
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
<PackageReference Include="SecureNative.SDK" Version="1.0.4" />
paket add SecureNative.SDK --version 1.0.4
#r "nuget: SecureNative.SDK, 1.0.4"
// 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
- Go to Tools → Package Manager → Manage NuGet Packages for Solution...
- Click the Browse tab and search for
SecureNative.Sdk
- 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 | Versions 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. |
-
- Moq (>= 4.2.1312.1319)
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
First test version