PHP code example of pps-protocol / laravel-pps
1. Go to this page and download the library: Download pps-protocol/laravel-pps library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pps-protocol / laravel-pps example snippets
'providers' => [
Pps\Laravel\PulseProofServiceProvider::class,
],
'aliases' => [
'PulseProof' => Pps\Laravel\Facades\PulseProof::class,
],
use Pps\Client\RegistrationBuilder;
$builder = new RegistrationBuilder();
$registration = $builder
->rpId('localhost')
->nonce($nonceFromChallenge)
->userHandle('user-123')
->deviceName('My Phone')
->withDuress(true)
->build();
$registrationToken = $registration['token'];
$clientState = $registration['client_state'];
use Pps\Client\AuthenticatorClient;
$client = new AuthenticatorClient($clientState);
$pulse = $client
->rpId('localhost')
->nonce($nonceFromChallenge)
->createPulse();
$pulseToken = $pulse['token'];
$trustCode = $pulse['trust_code'];
use Pps\Laravel\Facades\PulseProof;
$challenge = PulseProof::challenge();
$nonce = $challenge['nonce'];
$result = PulseProof::verify(
pulseToken: $request->input('pulse_token'),
nonceB64u: $request->input('nonce'),
trustCode: $request->input('trust_code')
);
if ($result->honey) {
// Silent duress detected.
// Return a normal-looking response.
}
if ($result->ok) {
// Authentication succeeded.
}
use Pps\Crypto\Base64Url;
use Pps\Payload\ContextObject;
$context = new ContextObject();
$context->sessionId = Base64Url::decode($sessionId);
$context->txHash = Base64Url::decode($txHash);
$pulse = $client
->rpId('localhost')
->nonce($nonce)
->context($context)
->amountMinor(2500067)
->createPulse();
if ($result->honey) {
// Outward response must remain normal.
}
text
pps-protocol/pps-php
text
Pps\Laravel\PulseProofServiceProvider
bash
php artisan pps:install
text
config/pps.php
database/migrations/*_create_pps_tables.php
bash
php artisan migrate
text
config/pps.php
text
memory
file
pdo
redis
bash
php artisan migrate
bash
php artisan pps:install
text
config/pps.php
database/migrations/*_create_pps_tables.php
bash
php artisan pps:key-generate
text
pps-protocol/pps-php
Core protocol implementation
No framework dependency
pps-protocol/laravel-pps
Laravel bridge
Depends on pps-protocol/pps-php