Skip to content

trusona/trusona-server-sdk-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trusona C SDK

Build Status

Build Tools

You will need a C language compiler like gcc or clang.

Dependencies

  • libcurl ver. 7.61.0, for interweb communication
  • jansson ver. 2.12 for JSON manipulation
  • openssl ver. 1.1.1 for cryptographic functions
  • ossp-uuid - or equivalent provider of uuid/uuid.h - for UUID v4 generation
  • PAM - optional. If you do not require PAM support, delete src/pam before running any make commands

Test Dependencies

To successfully run the tests via make test, you will need to have the check and subunit libraries in your environment.

Building & Installation

With all the dependencies in place, make all should complete successfully.

By default, [sudo] make install will install the shared libraries into /usr/local/lib.

Development headers will be installed into /usr/local/include/trusona

Debian Ubuntu Package Installation

Debian Ubuntu packages are made available on the releases page.

The packages are currently built for Ubuntu 20.04 aka Focal Fossa.

The following commands will download and prompt for the installation of the binary including all dependencies.

Install using wget

wget -q https://github.com/trusona/trusona-server-sdk-c/releases/download/1.0.0/trusona-server-sdk_1.0.0-1_amd64.deb -O trusona-server-sdk.deb
sudo apt-get update
sudo apt-get install ./trusona-server-sdk.deb

Install using curl

curl -sL https://github.com/trusona/trusona-server-sdk-c/releases/download/1.0.0/trusona-server-sdk_1.0.0-1_amd64.deb -o trusona-server-sdk.deb
sudo apt-get update
sudo apt-get install ./trusona-server-sdk.deb

After successful installation, see the documentation for next steps to get it configured.

API Usage

const enum TRUSONA_SDK_RESULT trusonafy_v2(const char* path_to_json_settings,
                                             const char* valid_user_identifier);

Alternatively, for extended usage:

const enum TRUSONA_SDK_RESULT trusonafy_v2_ext(const char* path_to_json_settings,
                                                 const char* valid_user_identifier,
                                                 const bool prompt,
                                                 const bool user_presence);

Legacy API Usage:

const enum TRUSONA_SDK_RESULT trusonafy_v1(const char* path_to_json_settings,
                                             const char* email_or_trusona_id);

TRUSONA_SDK_RESULT is an enum declared as follows:

enum TRUSONA_SDK_RESULT {
  TRUSONA_SUCCESS,          // what you want to see!
  TRUSONA_INSUFFICIENT,     // the trusonafication was rejected
  TRUSONA_FAILURE,          // other API error
  TRUSONA_SERVICE_ERROR,    // API service error
  TRUSONA_INIT_ERROR        // failure to initialize the API
};

A value of TRUSONA_SUCCESS indicates trusonafication was successful.

PAM API Usage

See the PAM configuration documentation.

Example Implementation

See src/example/main.c for a fully functional implementation.

TODO

  • Add debuging output option