Tozny.CSharp.Sdk 1.0.1

dotnet add package Tozny.CSharp.Sdk --version 1.0.1
                    
NuGet\Install-Package Tozny.CSharp.Sdk -Version 1.0.1
                    
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="Tozny.CSharp.Sdk" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tozny.CSharp.Sdk" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Tozny.CSharp.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tozny.CSharp.Sdk --version 1.0.1
                    
#r "nuget: Tozny.CSharp.Sdk, 1.0.1"
                    
#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.
#:package Tozny.CSharp.Sdk@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tozny.CSharp.Sdk&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Tozny.CSharp.Sdk&version=1.0.1
                    
Install as a Cake Tool

Tozny's C# Software Developers Kit

The Tozny Platform offers powerful tools for developers, enabling them to incorporate strong end-to-end encryption into their code bases. The Software Developer Kits provide the tools necessary for implementing the Tozny Platform without needing high cryptography expertise.

Testing

Records

Before you begin testing, you'll need a TOZ Store client config, which you can obtain through several methods. One approach is to visit the Tozny Dashboard and create an account. Then navigate to TOZ Store > Tokens to create a registration token. After that, proceed to TOZ Store > Clients to set up a new client. Click on the name of the client you've created, then locate and select tozny.key_backup and copy the client config. Another approach is to use one of our Software Developers Kits, such as our JavaScript SDK.

The next thing you need to decrypt a record is an encrypted TOZ Store record. You can create an encrypted record via the Dashboard or one of our SDKs. There is no direct way to obtain the encrypted record stored on our server, however there are several workarounds. Here are two suggestions:

  • Using the JavaScript SDK: Clone a local copy of the js-sdk to your device. Add console.log(record) before decrypting the record here. Import the local copy of the js-sdk to a node project and follow the js-sdk documentation to create and read a record. When reading the record, the encrypted record will now print to your console.
  • Using the Dashboard: Select any client in your dashboard and click the + button next to the Records header. Click on the newly created record and locate your network requests in your browser. Select the request for https://api.e3db.com/v1/storage/records/[record ID]. The encrypted record will be printed in the response. All encrypted data is listed under data.
  • Using the C SDK: Follow the C SDK instructions to create a record, and run the example script to print the encrypted record.

Now that you have an encrypted record and a client config, you can fetch an access key and decrypt your record.

Update the TestRecordApiShouldFetchAccessKey test with your client config details.

Update the TestRecordApiShouldDecryptRecord test with your access key and encrypted record. The record is formatted as a JSON string:

    @"[
        {
            'Hola': 'qlK8I8BxBFIXaolLTxEdT3pTOwr463Tw-G04Y-RzhweYzoIQghGDGohVI2QC1HHH.odxXRbEhb5aea_2f9KlU065pQKjNCjRB.BsXJPBCTSjI7fijPYBBdY-yVNNdC.Vz9U9K4Z9YNg7q1byBqncLXIJCs3CFXH',
            'Hello': 'jIyckoBr2CaYUqhGEQgoD3nKf3L24kdo60yCCg_dH4dOBuSI_ntGlNptynoE_PzG.jHPPcO4tMub85Pb-zfVFhBvKOETU19HN.6L0v4MrTvC1HKRVdJ8E0fy--_66L.92KBaICMD-YzOidw2ZpLpmtrK0DVzCB8',
        },
        {
            'Type': 'Example',
            'Company': 'Tozny',
            'Team': 'Software'
        }
    ]";

To run the tests in RecordApiTest.cs, run dotnet test --filter "FullyQualifiedName~TozSdkTest.RecordApiTests"

Publishing

To publish this SDK using Nuget package manager, run the following commands:

dotnet build --configuration Release
dotnet pack --configuration Release

Then upload the .nupkg file in TozSdk/bin/Release to NuGet.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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.0.1 270 5/15/2024
1.0.0 176 5/15/2024