Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

onurkanbakirci/KPS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KPS.Core

A .NET client library for Turkey's Population and Citizenship Affairs (KPS) v2 services. This library provides easy access to KPS services using WS-Trust authentication and HMAC-SHA1 signed SOAP requests.

What is this library?

KPS.Core is a .NET implementation of the KPS that allows you to query Turkey's official population and citizenship database. It handles the complex authentication flow with WS-Trust (STS) and SOAP message signing automatically.

Installation

dotnet add package KPS.Core

Usage

Basic Example (Minimal - Only Required Parameters)

using KPS.Core;
using KPS.Core.Models.Request;

// Create client using builder pattern (only username and password required)
var client = new KpsClientBuilder()
    .WithUsername("YOUR_USERNAME")
    .WithPassword("YOUR_PASSWORD")
    .Build();

// Create citizen verification request using object initializer
var request = new CitizenVerificationRequest
{
    TCNo = "12345678901",
    FirstName = "JOHN",
    LastName = "DOE",
    BirthYear = "1990",
    BirthMonth = "01",
    BirthDay = "01"
};

// Or use constructor for a more concise approach
// var request = new CitizenVerificationRequest(
//     tcNo: "12345678901",
//     firstName: "JOHN",
//     lastName: "DOE",
//     birthYear: "1990",
//     birthMonth: "01",
//     birthDay: "01"
// );

// Verify citizen identity
var result = await client.VerifyCitizenAsync(request);

if (result.Status)
{
    Console.WriteLine($"✅ Person validation successful! {result.Person?.FullName}");
}
else
{
    Console.WriteLine("❌ Person validation failed");
}

Advanced Example (With Custom Options)

// Create client with custom configuration (all optional)
var client = new KpsClientBuilder()
    .WithUsername("YOUR_USERNAME")
    .WithPassword("YOUR_PASSWORD")
    .WithTimeout(30)                    // Optional: Request timeout in seconds (default: 30)
    .WithRawResponse(false)             // Optional: Include raw SOAP response (default: false)
    .WithStsEndpoint("https://kimlikdogrulama.nvi.gov.tr/Services/Issuer.svc/IWSTrust13")  // Optional: Custom STS endpoint
    .WithKpsEndpoint("https://kpsv2.nvi.gov.tr/Services/RoutingService.svc")  // Optional: Custom KPS endpoint
    .Build();

License

MIT License

About

NVİ KPS .NET SDK

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages