Expand description
Register a device’s keys with PhyCloud (issues #397, #453), and bind them to the device’s TPM (issue #452).
PhyCloud only trusts ES256 event signatures from keys enrolled for the
event’s source, and TPM quotes signed by the device’s registered
attestation key. These helpers run once on the device, with an
operator credential that has the devices:write scope; afterwards the
device sends events with its normal events:write key. They mirror
the Python SDK’s phytrace.enrollment.
use phytrace_sdk::core::enrollment::{enroll_device, register_attestation_key};
let device = enroll_device(
"https://api.phycloud.phyware.io", "operator-key", signer.as_ref(),
"turtlebot4-lite-01", Some("SLB9670-0001"),
).await?;
let device_id = device["device_id"].as_str().unwrap_or_default();
register_attestation_key("https://api.phycloud.phyware.io", "operator-key",
signer.as_ref(), device_id).await?;Traits§
- Hardware
Identity - The TPM operations hardware-bound enrollment needs (issue #452);
phytrace_tpm::TpmSignerimplements it.
Functions§
- ak_
registration_ message - The message a device’s signing key signs to vouch for its AK.
- bind_
hardware - Prove to PhyCloud that the device’s keys live in its TPM: send the EK
certificate (and any intermediate CA certificates, DER) and the keys’
public areas, answer PhyCloud’s credential challenge with
TPM2_ActivateCredential, and certify the signing key with the attestation key. Returns the device, whosehardwareblock carries the device certificate if PhyCloud has a device CA. The attestation key must already be registered (register_attestation_key). - enroll_
device - Enroll
signer’s key as the device forsource_id; returns PhyCloud’s device record. Fails with HTTP 409 if the source already has an active device (userotate_device_key). - enrollment_
message - The message a device signs to prove it holds the key it enrolls.
- public_
key_ pem - PEM
PUBLIC KEYblock for a DERSubjectPublicKeyInfo. - register_
attestation_ key - Register
signer’s attestation key for enrolled devicedevice_id, vouched for by its signing key. Returns the device’s AKs. - rotate_
device_ key - Replace device
device_id’s key withsigner’s; the old key is retired, so events signed before the rotation still verify.