Skip to content
SDKs · ServerIn developmentView source

PHP

PHP 8.1+, on ext-curl and ext-openssl. No Guzzle. Wire 8.0.

In development

This SDK is implemented but not yet published to its package registry. Until it ships, collect an opaque evidence blob on the device and appraise it server-side with @rootherald/node (or any available server SDK). The API shown below is the planned surface and may change before release.

terminalbash
composer require rootherald/rootherald

The calls

  • new Rootherald\Client(secretKey: …, baseUrl: …)
  • relayEnroll($blob) → the 201 body for the device's EnrollComplete / relayActivate($activation) → deviceId. A flat TPM body is the 7.0 shape and is refused locally with \InvalidArgumentException.
  • issueChallenge(ask: [Client::ASK_IDENTITY, …], expectedKey: …, expectedDevices: …) → Challenge with ->nonce, ->challenge. Named arguments only.
  • verify($evidence, $nonce, expectedKey: …, expectedDevices: …) → AttestResult: ->verdict (Verdict::PASS | WARN | FAIL), ->verdictData, ->enrollmentRequired, ->assuranceClaimsMet, device(), expected().
  • issueKeyChallenge($purpose, expectedDevices: …), with Client::PURPOSE_SIGN or Client::PURPOSE_DECRYPT, → KeyChallenge with ->nonce, ->keyChallenge; certifyKey($certification, $nonce) → CertifiedKey with ->deviceId, ->keyId, ->alg, ->format, ->jwk, ->hardwareBound.
  • KeySignatures::verify($jwk, $message, $signature): bool — ES256 or RS256 by the JWK, raw or DER.
  • DeviceEncryption::encryptToDevice($key, $plaintext): string — the JWE compact serialization only that device opens: ECDH-ES for an EC key, RSA-OAEP-256 for an RSA key, A256GCM for both, on ext-openssl with no Root Herald call. $key is the CertifiedKey from certifyKey. A sign key is \InvalidArgumentException; a macOS apple-ecies key is EnvelopeFormatNotSupportedException, a subclass of it.
  • Exceptions in Rootherald\Exceptions: InvalidSecretKeyException, ChallengeException, InvalidEvidenceException, InvalidAskException, UnknownPolicyException, AdmissionRefusedException, QuotaExceededException, ActivationRefusedException, RateLimitedException, ExpectedNotEnforcedException; other codes are an HttpException with $serverError preserved. Each is an error code in the API reference.