pps-php

Error Handling

PPS-PHP uses both error codes and exceptions.


Error Codes

Verification results may contain these error codes:

Error Meaning
invalid_token Token parsing failed
bad_version Unsupported protocol version
bad_type Incorrect message type
bad_alg Unsupported algorithm
bad_rp RP hash mismatch
bad_epoch Epoch outside allowed window
expired Pulse expired
bad_nonce Nonce missing, invalid, or reused
bad_context Context hash mismatch
bad_policy Policy hash mismatch
bad_amount AmountMark mismatch
unknown_key Public key not recognized
bad_certificate Rotation certificate invalid
bad_rotation_sequence Rotation sequence mismatch
counter_replay Counter not increasing
bad_signature Signature verification failed
bad_trust_code Trust Code mismatch
revoked_device Device key revoked
revoked_group Threshold group revoked
threshold_not_met Not enough valid signatures

Exceptions

All exceptions extend:

Pps\Exception\PpsException

Specific exceptions:

Pps\Exception\CryptoException
Pps\Exception\EncodingException
Pps\Exception\VerificationException
Pps\Exception\KeyException
Pps\Exception\NonceException
Pps\Exception\CounterException
Pps\Exception\PolicyException
Pps\Exception\ContextException
Pps\Exception\StorageException

Do not expose detailed errors to unauthenticated clients.

Return:

{
    "status": "error"
}

Log detailed errors server-side.


Duress Handling

If:

$result->honey === true

return the same outward response as normal success.

Do not expose:

{
    "status": "duress"
}