Device Enrollment and Revocation#

Overview#

The package includes a lightweight DeviceEnrollment value object for factor enrollment records.

It is intentionally not a full device-management system. Applications are expected to persist enrollment rows in their own database.

Creating an enrollment record#

<?php
use Infocyph\OTP\ValueObjects\DeviceEnrollment;

$enrollment = DeviceEnrollment::create(
    deviceId: 'device-1',
    label: 'Alice iPhone',
    secretReference: 'secret-ref-001',
);

$enrollment->isPendingActivation();

Activation after first successful verification#

<?php
$activated = $enrollment->activate();

$activated->isActive();

Renaming and reprovisioning#

<?php
$renamed = $activated->rename('Primary phone');
$rotated = $renamed->withSecretReference('secret-ref-002');

$rotated->label;
$rotated->secretReference;

Revocation#

<?php
$revoked = $rotated->revoke();

$revoked->isRevoked();
$revoked->isActive();