pps-php

API Reference

This document summarizes the main PPS-PHP classes.


PulseProof

Pps\PulseProof::VERSION
Pps\PulseProof::ALG
Pps\PulseProof::EPOCH_SECONDS
Pps\PulseProof::checkRequirements(): array

KeyManager

Pps\Key\KeyManager::generateMasterSeed(): string
Pps\Key\KeyManager::deriveSeed(string $masterSeed, string $path): string
Pps\Key\KeyManager::keyPairFromSeed(string $seed): KeyPair
Pps\Key\KeyManager::generateKeyPair(): KeyPair
Pps\Key\KeyManager::rotateKeyPair(string $currentSeed, int $epoch, int $counter, bool $duress = false): KeyPair
Pps\Key\KeyManager::createClientState(string $rpId, ?string $masterSeed = null): array

RegistrationBuilder

$builder = new Pps\Client\RegistrationBuilder();

$registration = $builder
    ->rpId(string $rpId)
    ->nonce(string $nonceB64u)
    ->userHandle(string $userHandle)
    ->deviceName(string $deviceName)
    ->attestation(string $attestation)
    ->withDuress(bool $withDuress = true)
    ->build();

Returns:

[
    'token' => string,
    'client_state' => array,
    'public_keys' => array,
]

AuthenticatorClient

$client = new Pps\Client\AuthenticatorClient(array $clientState);

$pulse = $client
    ->rpId(string $rpId)
    ->nonce(?string $nonceB64u)
    ->context(?ContextObject $context)
    ->policy(?PolicyObject $policy)
    ->amountMinor(?int $amountMinor)
    ->duress(bool $duress = true)
    ->offline(bool $offline = true)
    ->thresholdGroup(string $gidB64u, int $threshold)
    ->createPulse();

Returns:

[
    'token' => string,
    'trust_code' => string,
    'trust_phrase' => string,
    'epoch' => int,
    'counter' => int,
    'new_client_state' => array,
]

AuthenticationHandler

$handler = new Pps\Server\AuthenticationHandler(StorageInterface $storage);

$result = $handler->verify(
    pulseToken: string,
    rpId: string,
    nonceB64u: ?string = null,
    amountMinor: ?int = null,
    context: ?ContextObject = null,
    policy: ?PolicyObject = null,
    trustCode: ?string = null
);

Returns:

Pps\Verification\VerificationResult

VerificationResult

$result->ok;
$result->mode;
$result->honey;
$result->thresholdMet;
$result->error;
$result->updates;
$result->payload;