Policy binding allows the server to require specific security properties for a given operation.
use Pps\Payload\PolicyObject;
$policy = new PolicyObject();
$policy->minTrustDigits = 8;
$policy->requireBiometric = true;
$policy->requireSecureEnclave = true;
$policy->threshold = 2;
$policy->maxAmountMinor = 10000000;
$policy->requireProximity = true;
$policy->requireAmountMark = true;
The policy hash is:
pol = SHA256(CBOR(policy_object))
$pulse = $client
->rpId('example.com')
->nonce($nonceB64u)
->policy($policy)
->amountMinor(2500067)
->createPulse();
$result = $handler->verify(
pulseToken: $pulse['token'],
rpId: 'example.com',
nonceB64u: $nonceB64u,
amountMinor: 2500067,
policy: $policy
);
If the policy hash does not match, verification fails with:
bad_policy
$policy = new PolicyObject();
$policy->minTrustDigits = 8;
$policy->allowOffline = true;
$policy = new PolicyObject();
$policy->minTrustDigits = 8;
$policy->requireBiometric = true;
$policy->requireSecureEnclave = true;
$policy = new PolicyObject();
$policy->minTrustDigits = 8;
$policy->requireBiometric = true;
$policy->requireSecureEnclave = true;
$policy->threshold = 2;
$policy->maxAmountMinor = 10000000;
$policy->requireAmountMark = true;
The server must reject weaker policies than required.
If the expected policy hash is:
A
and the Pulse contains:
B
the server must reject the Pulse.