SimaWeb2App 1.0.4

dotnet add package SimaWeb2App --version 1.0.4
NuGet\Install-Package SimaWeb2App -Version 1.0.4
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="SimaWeb2App" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimaWeb2App --version 1.0.4
#r "nuget: SimaWeb2App, 1.0.4"
#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.
// Install SimaWeb2App as a Cake Addin
#addin nuget:?package=SimaWeb2App&version=1.0.4

// Install SimaWeb2App as a Cake Tool
#tool nuget:?package=SimaWeb2App&version=1.0.4

SimaWeb2App Integration Library

Description:

The SimaWeb2App Integration Library provides a robust and secure way to integrate with the Sima Web2App protocol, facilitating seamless data exchange between service providers and identity providers. This library includes functionalities for generating and validating contracts, creating QR codes, and managing cryptographic operations.

Features:

  • Contract Generation and Encoding: Easily create and encode contracts for secure data exchange.
  • QR Code Generation: Generate QR codes as Base64 strings or byte arrays for various use cases using public methods.
  • Timestamp Certificate Validation: Validate timestamp certificates using provided signing algorithms.
  • Flexible and Extendable Models: Use pre-defined models like OperationInfo, ClientInfo, ProtoInfo, SignableContainer, and more for clear and structured data representation.
  • Error Handling: Robust error handling for unsupported signing algorithms and other edge cases.

Installation:

You can install the library directly from NuGet:

dotnet add package SimaWeb2App --version 1.0.4

Alternatively, you can clone the repository and include the library in your .NET project.

git clone https://github.com/AgilBashirov/SimaWeb2App.git

NuGet Packages:

When using this library, make sure to install the following packages from NuGet:

Install-Package BouncyCastle.Crypto -Version 1.8.1
Install-Package SkiaSharp -Version 2.88.8
Install-Package SkiaSharp.QrCode -Version 0.7.0

Usage:

Generating QR Codes:

Use the public methods GenerateQrCodeAsBase64 and GenerateQrCodeAsByte for generating QR codes.

using SimaWeb2App.Helpers;

string getFileUrl = "https://example.com";
var signableContainer = new SignableContainer
{
    ProtoInfo = new ProtoInfo(),
    OperationInfo = new OperationInfo
    {
        Type = "Auth", /* or "Sign" */
        OperationId = "123456789",
        NbfUtc = 1649721600,
        ExpUtc = 1650326400,
        Assignee = new List<string> { "Pin1", "Pin2" }
    },
    ClientInfo = new ClientInfo
    {
        ClientId = 1,
        ClientName = "MyApp",
        IconUri = "https://example.com/icon.png",
        Callback = "https://example.com/callback",
        RedirectUri = "https://example.com/redirect"
    },
    DataInfo = new DataInfo /* Optional */
    {
        DataUri = "https://example.com/data",
        AlgName = "SHA256",
        FingerPrint = "base64FingerPrint"
    }
};
string secretKey = "your_secret_key";

string qrCodeBase64 = SimaHelper.GenerateQrCodeAsBase64(getFileUrl, signableContainer, secretKey);
byte[] qrCodeBytes = SimaHelper.GenerateQrCodeAsByte(getFileUrl, signableContainer, secretKey);
Validating Timestamp Certificates:

Use the public method TsCertValidation to validate timestamp certificates.

using SimaWeb2App;

bool isValid = SimaHelper.TsCertValidation(
    tsCert: "base64EncodedCert",
    tcSign: "base64EncodedSignature",
    tsSignAlg: "ECDSA_SHA256",
    processBuffer: new byte[] { /* your data */ }
);

Use the public method GenerateButtonLink to generate a URL link for a button.

string buttonLink = SimaHelper.GenerateButtonLink(getFileUrl, signableContainer, secretKey);
Converting Path and Query String to Bytes:

Use the public method GetRequestPathAndQueryStringAsBytes to convert the path and query string into a byte array.

byte[] pathAndQueryBytes = SimaHelper.GetRequestPathAndQueryStringAsBytes("/path", "?query=string");

Contributing:

We welcome contributions! Please submit issues and pull requests for new features, bug fixes, and enhancements.

License:

This project is licensed under the MIT License. For more details, see the LICENSE.

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. 
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.4 58 6/10/2024
1.0.3 63 6/10/2024
1.0.2 72 6/10/2024