Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to erase devices in FindMyiPhone #448

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lynatic1337
Copy link

@lynatic1337 lynatic1337 commented Mar 15, 2024

Breaking change

This PR is based on #227 and therefore has all changes this PR has. Otherwise no breaking changes. I saw it as necessary to base my PR on this PR to reduce the risk of accidentally erasing family devices.

Proposed change

  • add function erase_device in AppleDevice class that takes an eraseToken for specified device and erases that device using it.
  • add function fmipWebAuthenticate in PyiCloudService that requests such a token from Apple for a device
  • add property canWipe to AppleDevice. This property specifies whether a device supports remote erasion

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New service (thank you!)
  • New feature (which adds functionality to an existing service)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests
  • Documentation or code sample

Example of code:

Usage example:
This code loops through all your devices and prompts you to erase the first one that supports remote erasion

api.find_my_iphone.with_family = False
api.find_my_iphone.refresh_client()

for x in range(0,len(api.find_my_iphone.devices)):
    currentDevice = api.find_my_iphone.device(x)
    print("Device", currentDevice.name, "does support remote erasure: ", currentDevice.canWipe)
    if (currentDevice.canWipe):
        erasetoken = api.fmipWebAuthenticate(currentDevice)
        print(erasetoken)
        input("Submit anything to wipe device")
        currentDevice.erase_device(text="",erasetoken=erasetoken)
        break

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated to README

Quentame and others added 3 commits March 14, 2024 19:34
Adds the functionality to erase supported devices. An erasetoken has to be requested with fmipWebAuthenticate(device) first, then the device in question can be wiped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants