Credify.SDK 1.1.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Credify.SDK --version 1.1.5
NuGet\Install-Package Credify.SDK -Version 1.1.5
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="Credify.SDK" Version="1.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Credify.SDK --version 1.1.5
#r "nuget: Credify.SDK, 1.1.5"
#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 Credify.SDK as a Cake Addin
#addin nuget:?package=Credify.SDK&version=1.1.5

// Install Credify.SDK as a Cake Tool
#tool nuget:?package=Credify.SDK&version=1.1.5

Credify .Net SDK

How to use

Initialization

 var signingPrivateKey = "";
 var apiKey = "";
 var env = Environment.Development;
 var config = new SdkConfig(signingPrivateKey,apiKey,env);
 var sdk = new CredifySdk(config);

Create a new account

This function generates a new user with a provided profile and password on the Credify system. The output is a new user's ID.

  var profile = new Profile
  {
      Name = new Name
      {
          FirstName = "Stephen",
          LastName = "Nguyen",
      },
      Phones = new List<Phone>
      {
          new()
          {
              PhoneNumber = "906987654",
              CountryCode = "+84"
          }
      },
      Emails = new List<Email>
      {
          new()
          {
              EmailAddress = "thisIsEmail@gmail.com"
          }
      },
  };
  var keys = new Keys
  {
      EncryptionPublicKey = "",
      EncryptionSecret = "",
      SigningPublicKey = "",
      SigningSecret = ""
  };
  var password = "Xbkqhrqqhe331@";
  var id = sdk.EntityService.CreateEntity(profile, password, keys);
  Console.WriteLine("entity created with id: " + id);

Push a custom claim

These records claim tokens into a blockchain. The claim tokens will be generated out of provided claim values.

 var claims = new Claims();
 claims.Add("this is scope-name",
     new Dictionary<string, object> {{"this is claim-name", "claim-value"}});

 var result = sdk.ClaimService.Push("provider id (oragnization id)",
     "entity id", claims);
 foreach (var commitment in result)
 {
     Console.WriteLine($"Scope name: {commitment.Key}");
     Console.WriteLine($"Commitments: {commitment.Value}");
 }

Encrypt claims

This encrypts claim values with a passed encryption public key.

 var claims = new Claims();
 claims.Add("this is scope-name",
     new Dictionary<string, object> {{"this is claim-name", "claim-value"}});
 var encrytionPublicKey = "";
 var encryptedClaims = sdk.ClaimService.Encrypt(claims, encrytionPublicKey);

Kicks off OIDC

This generates an ephemeral encryption key to secure an OIDC flow.

  var consumerId = "8f530df6-98aa-4849-bcaf-d62705435266";
  var callbackUrl = "https://callback.url";
  var initiateOidcRes = sdk.OidcService.InitiateOidc(consumerId, callbackUrl,
      new List<string> {"openid", "phone", "email", "profile"},
      new OidcOptions {ResponseType = "code"});

Introspect token

This validates the token is valid for the scope

  var token = "eyJhbGciOiJSUzI1NiIsImtpZCI6InB1YmxpYzo4ZD...WNQfpKKGKuw";
  var scope = "individual:read_evaluated_offer";
  var isActive = sdk.OidcService.IntrospectToken(token, scope);

Introspect token with result returning

This validates the token is valid for the scope

  var token = "eyJhbGciOiJSUzI1NiIsImtpZCI6InB1YmxpYzo4ZD...WNQfpKKGKuw";
  var scope = "individual:read_evaluated_offer";
  var result = sdk.OidcService.IntrospectTokenReturnResult(token, scope);

Validate request

This is for validating token

var accessToken = "...";
var requestToken =
    "...";
var approvalToken =
    "...";

var res = sdk.ClaimService.ValidateRequest(accessToken, requestToken, approvalToken);

Get offers for Market

This retrieves filtered offers list.

var res = sdk.OfferService.GetList("2988", null).Result;

Update offer transaction's status for Service Provider

The status of This update of a specified offer transaction.

var id = "xxxx";
var status = "COMPLETED";
var res = sdk.OfferService.UpdateStatus(id, status).Result;

If the transactionAmount is dynamic, you may pass transactionAmount to this function.

var id = "xxxx";
var status = "COMPLETED";
// Valid Amount's Currentcy: USD || VND || JPY
var transactionAmount = new FiatCurrency{ Currency = "USD", Value = "10"}
var res = sdk.OfferService.UpdateStatus(id, status, null, "", null).Result;

If have referenceId, you may pass referenceId to this function.

var id = "xxxx";
var status = "COMPLETED";
var referenceId = "referenceId";
var res = sdk.OfferService.UpdateStatus(id, status, null, referenceId, null).Result;

If the vat is dynamic, you may pass vat to this function.

var id = "xxxx";
var status = "COMPLETED";
// Valid Amount's Currentcy: USD || VND || JPY
var vat = new FiatCurrency{ Currency = "USD", Value = "10"}
var res = sdk.OfferService.UpdateStatus(id, status, null, "", vat).Result;

Get offer detail for Service Provider

This returns detailed information of a specified offer.

var offerCode = "offerCode";
var offer = sdk.OfferService.GetOfferDetail(offerCode).Result;

Get campaigns for Service Provider

This returns a list of campaign list.

var offerStatus = "APPROVED"; // APPROVED || REJECTED || IN_REVIEW
var campaignStatus: "APPROVED"; // APPROVED || REJECTED || IN_REVIEW || ARCHIVED || DRAFT
var result = sdk.OfferService.GetCampaigns(offerStatus, campaignStatus).Result;

Generate an access token

This manages OpenID Connect token API, generating a new access token from an authorization code. This is a helper function when you use an authorization flow.

var id = "YOUR ID";
var code = "AUTHORIZATION CODE";
var redirectUrl = "YOUR REDIRECTION URL";
var token = sdk.OidcService.GenerateAccessToken(id, code, redirectUrl).Result;

Get UserInfo

This retrieved and decrypt claim value

var userInfo = sdk.OidcService.UserInfo("accessToken", "this is your private key");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.1.8 457 1/13/2022
1.1.7 413 1/12/2022
1.1.6 362 10/28/2021
1.1.5 326 10/12/2021
1.1.4 362 9/16/2021
1.1.3 330 8/24/2021
1.1.2 338 7/23/2021
1.1.1 277 7/23/2021
1.1.0 355 7/23/2021
1.0.7 357 4/26/2021
1.0.6 339 4/13/2021
1.0.5 346 4/5/2021
1.0.4 346 3/29/2021
1.0.3 367 3/26/2021
1.0.2 376 3/12/2021