2017 © Pedro Peláez
 

library colu

colu php SDK

image

colu/colu

colu php SDK

  • Monday, February 1, 2016
  • by Quilamir
  • Repository
  • 8 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Colu-node

Colu platform, PHP SDK, (*1)

Install

Install Composer in your project:, (*2)

    $curl -s http://getcomposer.org/installer | php

Create a composer.json file in your project root:, (*3)

    {
        "require": {
            "Colu/Colu": "1.0.4"
        }
    }

Install via Composer, (*4)

    $php composer.phar install

Generate keys for your company:

If you create an instance of the Colu class with only the company name, the privateKey will be generated randomly on your machine. Your privateKey is what defines your company., (*5)

require_once ('vendor/autoload.php');
use Colu\ColuSDK\Colu;
$colu = new Colu('my_company', 'testnet');

// This is your private key, keep it safe!!!
echo 'WIF: '.$colu->getWIF();

Create instance from an existing key:

When you want to use our module in your server you need to generate keys only once. After that you can create an instance of Colu with your key:, (*6)

require_once ('vendor/autoload.php');
use Colu\ColuSDK\Colu;

$privateKey = 'cQQy71GeXGeFWnDtypas2roY2qrk3KWjJLCxoFqc2wibXr2wWxie'; // this is the WIF version of a private key

$colu = new Colu('my_company', 'testnet', $privateKey);

Register a user using 2FA:

There are two methods for registering a user using 2FA, directly by using a Phonenumber or by generating a QR code and then having the user scan the QR with their phone., (*7)

In both methods you need to Create a registration message:, (*8)

php $username = 'bob'; $registrationMessage = $colu->createRegistrationMessage($username);, (*9)

  1. QR registration:, (*10)

    $qr = $colu->createRegistrationQR($registrationMessage);
    

    This will return an array containing the QR and the message to be verified:, (*11)

    "qr" => $qrCode->getDataUri (), // this is the actual QR image
    "code" => $qrRegCode, // send this to the registerUserByCode function
    "message" => $message // send this to the registerUserByCode function 
    

    Send the registration request:, (*12)

    $colu->registerUserByCode ( $code, $message );
    

    This will send a push notification to the user mobile application that will wait until approval is recieved., (*13)

  2. Phonenumber Registration:, (*14)

    $phonenumber = "+12323455673";
    $colu->registerUserByPhonenumber ( $phonenumber, $registrationMessage );
    

    This will send a push notification to the user mobile application that will wait until approval is recieved., (*15)

If successful both cases return an array:, (*16)

"success" => true,
"userId" => $user->getId () // this is the user ID

save the userId for future verifications., (*17)

Verify user:

To verify a user:, (*18)

$username = 'bob';
$userId = 'tpubDCgCu2jpxrR7j9JwFQ959wSkNwPQFNQvJJMFnikg1Sb4tkDnBNYaS3Sc1BxKL71hk3jPkQStEY1VE9mTaQjF8kDfEhzxjWid7eVK5F7nWi5';

if ($colu->verifyUser($username, $userId, 0)) {
    echo "verified";
  }
  else {
    echo $colu->error;
    // something bad happened
  }
}

This will send a push to the user mobile application and prompt him to sign on your message, you will receive the user signature and verify it locally., (*19)

The Versions

01/02 2016

dev-master

9999999-dev

colu php SDK

  Sources   Download

MIT

The Requires

 

php bitcoin der transactions cryptocurrency btc bip32 electrum ecc hd wallet

11/03 2015

v1.0.3

1.0.3.0

colu php SDK

  Sources   Download

MIT

The Requires

 

php bitcoin der transactions cryptocurrency btc bip32 electrum ecc hd wallet

11/03 2015

v1.0.4

1.0.4.0

colu php SDK

  Sources   Download

MIT

The Requires

 

php bitcoin der transactions cryptocurrency btc bip32 electrum ecc hd wallet

11/03 2015

v1.0.1

1.0.1.0

colu php SDK

  Sources   Download

MIT

The Requires

 

php bitcoin der transactions cryptocurrency btc bip32 electrum ecc hd wallet

11/03 2015

v1.0.0

1.0.0.0

colu php SDK

  Sources   Download

MIT

The Requires

 

php bitcoin der transactions cryptocurrency btc bip32 electrum ecc hd wallet