Skip to content

affinidi/affinidi-tdk-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Affinidi Trust Development Kit (Affinidi TDK)

All Contributors

The Affinidi Trust Development Kit (Affinidi TDK) is a modern interface that allows you to easily manage and integrate Affinidi Elements and Frameworks into your application. It minimises dependencies and enables developers seamless entry into the Affinidi Trust Network (ATN).

How do I use Affinidi TDK?

The Affinidi TDK for PHP is published on packagist.org and provides the following libraries:

  • Clients, which offer methods to access Affinidi Elements services like Credential Issuance, Credential Verification, and Login Configurations, among others.
  • AuthProvider, a library that provides a method to authenticate Personal Access Tokens (PATs) and generates access token to call clients and access the Affinidi Elements services.
  • Commons, a list of libraries that provides common methods like generation of claim and share links for Credential Issuance and Affinidi Iota Framework.

Each module has its own README that you can check to better understand how to integrate it into your application.

Requirements

  • PHP version 7.4 or higher.
  • Composer package manager.

Installation

Setting up a New Project

If you're starting a new project, first create a new directory and initialise it.

mkdir my-affinidi-project
cd my-affinidi-project
composer init

Install the Affinidi TDK via Composer.

composer require affinidi-tdk/affinidi-tdk-php

Quick Start

Here's a basic example of using the TDK to list wallets:

<?php

require_once 'vendor/autoload.php';

use AuthProvider\AuthProvider;
use AffinidiTdk\Clients\WalletsClient;

// Configuration parameters
$params = [
    'privateKey' => "",     // Your private key
    'keyId' => '',         // Your key ID
    'passphrase' => '',    // Your passphrase
    'projectId' => '',     // Your project ID
    'tokenId' => ''       // Your token ID
    // Optional parameters:
    // 'apiGatewayUrl' => 'https://apse1.api.affinidi.io',
    // 'tokenEndpoint' => 'https://apse1.auth.developer.affinidi.io/auth/oauth2/token',
];

$authProvider = new AuthProvider($params);

try {
  $tokenCallback = [$authProvider, 'fetchProjectScopedToken'];

  $configCwe = WalletsClient\Configuration::getDefaultConfiguration()->setApiKey('authorization', '', $tokenCallback);

  $apiInstanceCwe = new WalletsClient\Api\WalletApi(
    new GuzzleHttp\Client(),
    $configCwe
  );

  $apiInstanceCwe->listWallets();

  $resultCwe = $apiInstanceCwe->listWallets();

  $resultCweJson = json_decode($resultCwe, true);

  print_r(count($resultCweJson['wallets']));

} catch (Exception $e) {
  print_r($e->getMessage());
}

Testing

To run the test suite, use one of the following commands:

# Run all tests
composer run-script test

# Run tests with debug information
composer run-script test:debug

The debug mode provides additional information that can be helpful when troubleshooting failing tests.

Documentation

Head over to our Documentation site to know how to get started with Affinidi TDK.

Use this document to learn more about how to work with Affinidi TDK, including generating the Authorisation Token and calling the methods.

To learn how to integrate Affinidi TDK and use the different modules into your application, you can explore the following:

Support & feedback

If you face any issues or have suggestions, please don't hesitate to contact us using this link.

Reporting technical issues

If you have a technical issue with the Affinidi TDK's codebase, you can also create an issue directly in GitHub.

  1. Ensure the bug was not already reported by searching on GitHub under Issues.

  2. If you're unable to find an open issue addressing the problem, open a new one. Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring.

Contributing

Want to contribute?

Head over to our CONTRIBUTING guidelines.

FAQ

What can I develop?

You are only limited by your imagination! Affinidi TDK is a toolbox with which you can build software applications for personal or commercial use.

Is there anything I should not develop?

We only provide the tools - how you use them is largely up to you. We have no control over what you develop with our tools - but please use our tools responsibly!

We hope that you will not develop anything that contravenes any applicable laws or regulations. Your projects should also not infringe on Affinidi's or any third party's intellectual property (for instance, misusing other parties' data, code, logos, etc).

What responsibilities do I have to my end-users?

Please ensure that you have in place your terms and conditions, privacy policies, and other safeguards to ensure that the projects you build are secure for your end users.

If you are processing personal data, please protect the privacy and other legal rights of your end-users and store their personal or sensitive information securely.

Some of our components would also require you to incorporate our end-user notices into your terms and conditions.

Is Affinidi TDK free for use?

Affinidi TDK itself is free, so come onboard and experiment with our tools and see what you can build! We may bill for certain components in the future, but we will inform you beforehand.

Is there any limit or cap to my usage of the Affinidi TDK?

We may from time to time impose limits on your use of the Affinidi TDK, such as limiting the number of API requests that you may make in a given duration. This is to ensure the smooth operation of the Affinidi TDK so that you and all our other users can have a pleasant experience as we continue to scale and improve the Affinidi TDK.

Do I need to provide you with anything?

From time to time, we may request certain information from you to ensure that you are complying with the Terms and Conditions.

Can I share my developer's account with others?

When you create a developer's account with us, we will issue you your private login credentials. Please do not share this with anyone else, as you would be responsible for activities that happen under your account. If you have interested friends, ask them to sign up – let's build together!

Telemetry

Affinidi collects usage data to improve our products and services. For information on what data we collect and how we use your data, please refer to our Privacy Notice.

Disclaimer: Please note that this FAQ is provided for informational purposes only and is not to be considered a legal document. For the legal terms and conditions governing your use of the Affinidi Services, please refer to our Terms and Conditions.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Roman Brazhnyk
Roman Brazhnyk

πŸ’» πŸ“– πŸ€” πŸ”¬
Carlos Rincon
Carlos Rincon

πŸ’» πŸ“– πŸ€” 🚧
maratsh
maratsh

πŸ’» πŸ“– πŸ’‘ πŸ€” πŸš‡ πŸ“¦ πŸ›‘οΈ
Pulkit Batra
Pulkit Batra

πŸ’» πŸ“– πŸ’‘ πŸ€” πŸš‡ 🚧 πŸ“¦ πŸ”Œ
Anton Bergman
Anton Bergman

πŸ’» πŸ“–
sureshaff
sureshaff

πŸ›‘οΈ
Sebastian MΓΌller
Sebastian MΓΌller

πŸ’» πŸ“– πŸ”¬
andrew-affinidi
andrew-affinidi

πŸ’» πŸ“– πŸ”¬
rohitjjw
rohitjjw

πŸ’» πŸ“– πŸ”¬
Paramesh Kamarthi
Paramesh Kamarthi

πŸ€” πŸ’‘ πŸ’» πŸ“– πŸ”¬
obradovicaffinidi
obradovicaffinidi

πŸ’Ό
yilmazlarmurat
yilmazlarmurat

πŸ›‘οΈ
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!