Code Monkey home page Code Monkey logo

csharp_telesign's Introduction

NuGet license

Telesign Self-service C# SDK

Telesign connects, protects, and defends the customer experience with intelligence from billions of digital interactions and mobile signals. Through developer-friendly APIs that deliver user verification, digital identity, and omnichannel communications, we help the world's largest brands secure onboarding, maintain account integrity, prevent fraud, and streamline omnichannel engagement.

Requirements

  • .NET Framework v4.8+.
  • dotnet CLI (Optional) - This tool isn't required to use this SDK, but it is required to use the installation instructions below.

NOTE:

These instructions are for MacOS. They will need to be adapted if you are installing on Windows.

Installation

Follow these steps to add this SDK as a dependency to your project.

  1. (Optional) Create a new directory for your C# project. Skip this step if you already have created a project. If you plan to create multiple C# projects that use Telesign, we recommend that you group them within a telesign_integrations directory.
    cd ~/code/local
    mkdir telesign_integrations
    cd telesign_integrations
    mkdir {your project name}
    cd {your project name}
  1. Create a new C# solution using the dotnet CLI in the top-level directory of your project.

    dotnet new console -o {name of the solution}

    For example:

    dotnet new console -o SendSMS

  2. Install the Telesign SDK using the dotnet CLI.

    dotnet add package Telesign --version 2.2.5

    Once the SDK is installed, you should see a message in the terminal notifying you that you have successfully installed the SDK.

NOTE:

There are alternate ways of installing this SDK. For examples, see this SDK's page in the NuGet gallery.

  1. Install the Newtonsoft.json dependency using the dotnet CLI.

    dotnet add package Newtonsoft.Json --version 13.0.3

Authentication

If you use a Telesign SDK to make your request, authentication is handled behind-the-scenes for you. All you need to provide is your Customer ID and API Key. The SDKs apply Digest authentication whenever they make a request to a Telesign service where it is supported. When Digest authentication is not supported, the SDKs apply Basic authentication.

What's next

  • Learn to send a request to Telesign with code with one of our tutorials.
  • Browse our Developer Portal for tutorials, how-to guides, reference content, and more.
  • Check out our sample code on GitHub.

csharp_telesign's People

Contributors

adohertyts avatar ernesthwang avatar hmorales avatar illiminable avatar jeremyjc avatar manmohan-kumar avatar mrasic-telesign avatar ramsay avatar spillerl avatar vdamjanic avatar wqaqish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csharp_telesign's Issues

.NET Standard support

Was looking in to using the SDK in a .NET Core environment. I installed the code in a console application and it seems to be working just fine, but there is a warning about it being restored using .NET Framework versions. Is there a possibility to target .NET standard in the NuGet version of the package, or would I have to download the SDK and modify it locally?

No way to verify valid code with Telesign SDK

We started looking into upgrading our Telesign SDK to the latest version, I downloaded the latest, and I've noticed that there is no way telesign can generate a code, nor a way to ask telesign to verify the code.

We are an enterprise client, and we are in production right now with Telesign SDK V 1.0. if we consume V2.0 means we have to significantly change our integration to start generating the code and verify it ourselves.

Can someone please clarify, how we're supposed to call telesign api to verify a code when upgrading from V1.0 to V2.0?

c# SDK generates the "verification" code even if the consumer omits it

It is mentioned numerous times in the documentation that it is a best practice to let Telesign generate the code as it is more secure, but looking at the c# code (SDK) that consumes the REST Api, even if we omit passing the verification code, the c# code detects that there is no code passed so it generate one using Random class and then passes it to the REST api, so technically there is no way to let the REST API generate the code for us.

Here is where the SDK generate the code:
https://github.com/TeleSign/csharp_telesign/blob/master/src/TeleSign.Services.Verify/RawVerifyService.cs#L359

private static Dictionary<string, string> ConstructVerifyArgs(
                    VerificationMethod verificationMethod, 
                    string phoneNumber, 
                    string verifyCode, 
                    string messageTemplate, 
                    string language,
                    string validityPeriod = null,
                    string useCaseId = RawVerifyService.DefaultUseCaseId)
        {
            // TODO: Review code generation rules.
            if (verifyCode == null)
            {
                Random r = new Random();
                verifyCode = r.Next(100, 99999).ToString();
            }
            else
            {
                if (verificationMethod == VerificationMethod.TwoWaySms)
                {
                    throw new ArgumentException("Verify Code cannot be specified for Two-Way SMS", "verifyCode");
                }
            }

Checking for customer id in the config

I won't say Its an issue - but I dont know how and where to put comments. Just a question If this was intentional not to check for the customer id as well?

csharp_telesign-master\csharp_telesign-master\src\TeleSign.Services\TeleSignService.cs

if (string.IsNullOrEmpty(this.configuration.Credential.SecretKey))
{
throw new ArgumentException("No secret key was provided. Requests to TeleSign services require require a valid customer id and secret key.");
}

Shouldn't the constructor for "TeleSignCredential" checks for null customer id as well?

///

    /// Initializes a new instance of the TeleSignCredential class.
    /// </summary>


    /// <param name="customerId">The customer id.</param>
    /// <param name="secretKey">The customers secret key.</param>
    public TeleSignCredential(
                Guid customerId,
                string secretKey)
    {
        CheckArgument.NotNullOrEmpty(secretKey, "secretKey");
        CheckArgument.NotNullOrEmpty(customerId, "customerId"); // ADDED
        this.CustomerId = customerId;
        this.SecretKey = secretKey;
    }

.net 6 support

I see there's already an issue about .net standard, but it's 2 years old now. It would be great to see this code updated to support more modern frameworks like .net 6.

The examples provided could use a great deal of simplification as well. At the moment the code is terribly bloated, too general and stateful. Most people are not going to use it to the full extent. It would be good to see more basic examples for those who are just quickly evaluating the product (in my case it was phoneid).

I wrote something like that in f#, feel free to use it: https://github.com/PiotrJustyna/telesign-client-fsharp-phoneid

interface for testability

It would really help if you wrap all service rest clients with interfaces so that consumers of your code can properly test/mock the service.

Please look at my pull request, I added an interface for the VerifyService, the pull request was made on a previous version of the code, but I mentioned it only as an example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.