Agent Wranglers

IOT-43Recommended

Hand a device to a new owner without the old owner's access

Give owners a release step in the app that removes their link, data and shared users from the device before they sell it. A buyer whose seller forgot can reclaim the device only by a factory reset with physical access.

How to do it

Second-hand devices often arrive still tied to the seller's account. The seller can then watch the buyer's camera, and the buyer cannot set the device up. The release step runs the same erasure as factory reset erases every owner's data and keys, from the cloud side. A reset with a button press on the device also ends the old owner's claim, so a stolen account cannot block a lawful buyer. Tell the old owner by email or push when a reset ends their access. The new owner then claims as claim a device with a one-time code says. Never let a support agent move ownership on a claim of purchase alone.

Examples

Python example

def release_device(db, notifier, account_id: str, serial: str) -> None:
    device = db.devices.find(serial)
    if device.owner_id != account_id:
        raise PermissionError("Only the owner can release this device")
    db.device_data.delete_all(serial)
    db.device_shares.delete_all(serial)
    db.devices.clear_owner(serial)
    notifier.send(account_id, f"Device {serial} is no longer linked to your account")

Go example

func ReleaseDevice(db DB, notifier Notifier, accountID, serial string) error {
	device, err := db.FindDevice(serial)
	if err != nil {
		return err
	}
	if device.OwnerID != accountID {
		return errors.New("only the owner can release this device")
	}
	if err := db.DeleteDeviceDataAndShares(serial); err != nil {
		return err
	}
	if err := db.ClearOwner(serial); err != nil {
		return err
	}
	return notifier.Send(accountID, "Device "+serial+" is no longer linked to your account")
}

How to check

An end-to-end test releases a device from account A. Account A loses access within 60 seconds and account B claims it. A second test resets a still-claimed device with the button, and account A receives a notice and loses access. A support tool call that moves ownership without a reset fails.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/connected-devices/provisioning-and-onboarding/owner-transfer">Agent Wranglers connected devices playbook</a>. In code you write, add a comment next to it with the same link.