Identity / OIDC

MtsIdNet

.NET SDK for MTS Mobile ID (OIDC/OAuth2)

MtsIdNet version on NuGetMtsIdNet downloads on NuGetMITC#
netstandard2.0net8.0net10.0

Features

  • Signed request object (RS256) for si-authorize
  • JWKS publishing on built-in cryptography
  • Server-initiated authentication (SI / CIBA)
  • SMS-OTP fallback and id_token validation
  • User data (premiuminfo) and KYC (kyc-match-split)

Installation

bash
dotnet add package MtsIdNet

Quick start

csharp
using MtsIdNet;

var client = new MtsIdClient(httpClient, new MtsIdClientOptions
{
    ClientId = "mts_test_service",
    SigningKey = MtsKeys.RsaFromPem(File.ReadAllText("sp-private.pem")),
    SigningKeyId = "rsa_kid",
    NotificationUri = "https://service-provider.io/notification_uri/",
});

// Publish your JWKS so Mobile ID can verify the signed request:
string jwksJson = client.BuildPublishedJwks().ToJson();

// Start a server-initiated (CIBA) authentication:
var result = await client.SiAuthorizeAsync(new RequestObjectParameters
{
    Scope = $"{MtsIdConstants.Scopes.OpenId} {MtsIdConstants.Scopes.Authn}",
    LoginHint = RequestObjectParameters.ForMsisdn("+7 915 000 00 00"),
    ClientNotificationToken = Guid.NewGuid().ToString(),
});

Key methods

SiAuthorizeAsyncStart authentication (CIBA)
BuildPublishedJwksPublic JWKS
VerifySmsCodeAsyncVerify SMS-OTP
GetPremiumInfoAsyncUser profile data
KycMatchAsyncData verification (KYC)
READMEgithub.com/ai-iskuzhin/MtsIdNet
Loading README from the repository…