npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

find-apple-device

v1.0.0

Published

Unofficial API to use 'Find my Phone' functionality within Node.js. Supports alerts, device & location info, locking phone and remote erase.

Downloads

13

Readme

iCloud Find My iPhone Node Module

What is this for?

Apple provides some really excellent find my phone functions using it's iCloud website. I wanted to use this programmibly so I could track my phone without consuming a lot of additional battery life.

I also wanted a way to send very urgent alerts, for example "Oh no, the house is burning down!" so it will sound an alert even if my phone is on silent.

Before playing with this module, I highly recommend that you activate 2-factor authentication incase you accidentally share your credentials with the world. It won't stop somebody from locking your phone, but it will stop them from doing other nasty stuff or stealing your photos.

There is already another find-my-iphone node module available, but I felt it was a little bit rough for my needs, so I decided to code up this one.

Install

npm install --save find-apple-device

Usage

You can create the instance using the following

var ICloud = require('../index');

var email = "[email protected]";
var password = "PASSWORD_GOES_HERE!";

var iCloud = new ICloud(email, password);

iCloud.getDevices(function(err, devices) {
  if (err) return console.error('Error',err);
  if (devices.length === 0) return console.log("No devices found!");
  console.log(devices);
});

Supported Methods

  • getDevices(callback)
  • silentLostDevice(deviceId, emailUpdates, callback)
  • lostDevice(deviceId, callNumber, text, emailUpdates, callback)
  • alertDevice(deviceId, subject, callback)

Example data

All methods return JSON, please see the examples linked above for more info on how to call each method.

iCloud.getDevices(function(err, devices) {
  if (err) return console.error('Error',err);
  if (devices.length === 0) return console.log("No devices found!");
  console.log(devices[0]);
});

Gives this json object (some data has been faked for privacy)

{
  "id": "0c0fc335a3b69c8fd42fdb3a3+6ee64f9da0c0fc335+a3b69c8fd42fdb3a36ea61475e64f9da",
  "name": "My iPhone",
  "deviceModel": "iphone6splus-abcde-efghi",
  "modelDisplayName": "iPhone",
  "deviceDisplayName": "iPhone 6s Plus",
  "batteryLevel": "0.67",
  "isLocating": true,
  "lostModeCapable": true,
  "location":
   {
     "timeStamp": 1465896490086,
     "isOld": false,
     "isInaccurate": false,
     "locationFinished": false,
     "positionType": "Cell",
     "latitude": "12.123456938235353",
     "horizontalAccuracy": 1414,
     "locationType": null,
     "longitude": "22.125933956343"
   }
}

TODO

  • eraseDevice(deviceId, callback)
  • can we stop these annoying emails?
  • how can we refresh the session easily?
  • how can we check if we are logged in?

Contributing

Feel free to submit any pull requests or add functionality, I'm usually pretty responsive.

If you like the module, please consider donating some bitcoin or litecoin.

Bitcoin

LNzdZksXcCF6qXbuiQpHPQ7LUeHuWa8dDW

LiteCoin

LNzdZksXcCF6qXbuiQpHPQ7LUeHuWa8dDW