Yoti.Sandbox 1.0.0

Yoti .NET SDK Sandbox

Install-Package Yoti.Sandbox -Version 1.0.0
dotnet add package Yoti.Sandbox --version 1.0.0
<PackageReference Include="Yoti.Sandbox" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Yoti.Sandbox --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Yoti .NET Sandbox SDK

Build Status

Welcome to the Yoti .NET Sandbox. This repo contains the tools you need to test your .NET back-end integration, alongside installation of the Yoti .NET SDK.

Sandbox Supported Frameworks

  • .NET Standard 2.1
  • .NET Core App 3.1
  • .NET 4.8

Please email sdksupport@yoti.com if you require a Target Framework which is not listed here.

Installing the Sandbox

To install the Yoti Sandbox NuGet package you will need to install NuGet. You can find instructions to do that here

To import the latest Yoti SDK into your project, enter the following command from NuGet Package Manager Console in Visual Studio:

Install-Package Yoti.Sandbox

For other installation methods, see nuget.org/packages/Yoti.Sandbox

Configuration

  • CLIENT_SDK_ID is the SDK identifier generated by Yoti Hub in the Key tab when you create your app.

  • /path/to/your-pem-file.pem is the path to the application pem file. It can be downloaded only once from the Keys tab in your Yoti Hub.

Please do not open the pem file as this might corrupt the key and you will need to create a new application.

Profile Token Creation

Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair keyPair;

using (StreamReader stream = File.OpenText("path/to/hub-private-key.pem"))
{
	keyPair = Yoti.Auth.CryptoEngine.LoadRsaKey(stream);
}

const string sandboxClientSdkid = "your SDK ID";

SandboxClient sandboxClient = new SandboxClientBuilder()
	.WithClientSdkId(sandboxClientSdkid)
	.WithKeyPair(keyPair)
	.Build();

SandboxAgeVerification ageVerification = new SandboxAgeVerificationBuilder()
	.WithDateOfBirth(new DateTime(2001, 12, 31))
	.WithAgeOver(18)
	.Build();

YotiTokenRequest tokenRequest = new YotiTokenRequestBuilder()
	.WithRememberMeId("some Remember Me ID")
	.WithGivenNames("some given names")
	.WithFamilyName("some family name")
	.WithFullName("some full name")
	.WithDateOfBirth(new DateTime(1980, 10, 30))
	.WithAgeVerification(ageVerification)
	.WithGender("some gender")
	.WithPhoneNumber("some phone number")
	.WithNationality("some nationality")
	.WithStructuredPostalAddress(Newtonsoft.Json.JsonConvert.SerializeObject(new
	{
		building_number = 1,
		address_line1 = "some address"
	}))
	.WithBase64Selfie(Convert.ToBase64String(Encoding.UTF8.GetBytes("some base64 encoded selfie")))
	.WithEmailAddress("some@email")
	.WithDocumentDetails("PASSPORT USA 1234abc")
	.Build();

var sandboxOneTimeUseToken = sandboxClient.SetupSharingProfile(tokenRequest);

var yotiClient = new YotiClient(new HttpClient(), sandboxClientSdkid, keyPair);

Uri sandboxUri = new UriBuilder(
	"https",
	"api.yoti.com",
	443,
	"sandbox/v1").Uri;

yotiClient.OverrideApiUri(sandboxUri);

ActivityDetails activityDetails = yotiClient.GetActivityDetails(sandboxOneTimeUseToken);

// Perform tests
Assert.AreEqual("some@email", activityDetails.Profile.EmailAddress.GetValue());

Yoti .NET Sandbox SDK

Build Status

Welcome to the Yoti .NET Sandbox. This repo contains the tools you need to test your .NET back-end integration, alongside installation of the Yoti .NET SDK.

Sandbox Supported Frameworks

  • .NET Standard 2.1
  • .NET Core App 3.1
  • .NET 4.8

Please email sdksupport@yoti.com if you require a Target Framework which is not listed here.

Installing the Sandbox

To install the Yoti Sandbox NuGet package you will need to install NuGet. You can find instructions to do that here

To import the latest Yoti SDK into your project, enter the following command from NuGet Package Manager Console in Visual Studio:

Install-Package Yoti.Sandbox

For other installation methods, see nuget.org/packages/Yoti.Sandbox

Configuration

  • CLIENT_SDK_ID is the SDK identifier generated by Yoti Hub in the Key tab when you create your app.

  • /path/to/your-pem-file.pem is the path to the application pem file. It can be downloaded only once from the Keys tab in your Yoti Hub.

Please do not open the pem file as this might corrupt the key and you will need to create a new application.

Profile Token Creation

Org.BouncyCastle.Crypto.AsymmetricCipherKeyPair keyPair;

using (StreamReader stream = File.OpenText("path/to/hub-private-key.pem"))
{
	keyPair = Yoti.Auth.CryptoEngine.LoadRsaKey(stream);
}

const string sandboxClientSdkid = "your SDK ID";

SandboxClient sandboxClient = new SandboxClientBuilder()
	.WithClientSdkId(sandboxClientSdkid)
	.WithKeyPair(keyPair)
	.Build();

SandboxAgeVerification ageVerification = new SandboxAgeVerificationBuilder()
	.WithDateOfBirth(new DateTime(2001, 12, 31))
	.WithAgeOver(18)
	.Build();

YotiTokenRequest tokenRequest = new YotiTokenRequestBuilder()
	.WithRememberMeId("some Remember Me ID")
	.WithGivenNames("some given names")
	.WithFamilyName("some family name")
	.WithFullName("some full name")
	.WithDateOfBirth(new DateTime(1980, 10, 30))
	.WithAgeVerification(ageVerification)
	.WithGender("some gender")
	.WithPhoneNumber("some phone number")
	.WithNationality("some nationality")
	.WithStructuredPostalAddress(Newtonsoft.Json.JsonConvert.SerializeObject(new
	{
		building_number = 1,
		address_line1 = "some address"
	}))
	.WithBase64Selfie(Convert.ToBase64String(Encoding.UTF8.GetBytes("some base64 encoded selfie")))
	.WithEmailAddress("some@email")
	.WithDocumentDetails("PASSPORT USA 1234abc")
	.Build();

var sandboxOneTimeUseToken = sandboxClient.SetupSharingProfile(tokenRequest);

var yotiClient = new YotiClient(new HttpClient(), sandboxClientSdkid, keyPair);

Uri sandboxUri = new UriBuilder(
	"https",
	"api.yoti.com",
	443,
	"sandbox/v1").Uri;

yotiClient.OverrideApiUri(sandboxUri);

ActivityDetails activityDetails = yotiClient.GetActivityDetails(sandboxOneTimeUseToken);

// Perform tests
Assert.AreEqual("some@email", activityDetails.Profile.EmailAddress.GetValue());

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 74 3/20/2020