{"id":16398929,"url":"https://github.com/albertyw/apple_dep_client","last_synced_at":"2026-03-11T15:13:02.697Z","repository":{"id":30546106,"uuid":"34100819","full_name":"albertyw/apple_dep_client","owner":"albertyw","description":"Apple Device Enrollment Program Client","archived":false,"fork":false,"pushed_at":"2021-04-28T07:20:25.000Z","size":135,"stargazers_count":22,"open_issues_count":5,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-06T23:27:13.118Z","etag":null,"topics":["apple","apple-dep-client","apple-device-enrollment","cellabus","dep-endpoints","ios","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/albertyw.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-17T06:39:05.000Z","updated_at":"2021-08-12T07:38:54.000Z","dependencies_parsed_at":"2022-09-08T16:00:38.116Z","dependency_job_id":null,"html_url":"https://github.com/albertyw/apple_dep_client","commit_stats":null,"previous_names":["cellabus/apple_dep_client"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/albertyw/apple_dep_client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertyw%2Fapple_dep_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertyw%2Fapple_dep_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertyw%2Fapple_dep_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertyw%2Fapple_dep_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albertyw","download_url":"https://codeload.github.com/albertyw/apple_dep_client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albertyw%2Fapple_dep_client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274800046,"owners_count":25352173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","apple-dep-client","apple-device-enrollment","cellabus","dep-endpoints","ios","ruby"],"created_at":"2024-10-11T05:14:19.689Z","updated_at":"2026-03-11T15:12:57.677Z","avatar_url":"https://github.com/albertyw.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Apple Device Enrollment Program Client\n\n[![Gem Version](https://badge.fury.io/rb/apple_dep_client.svg)](https://badge.fury.io/rb/apple_dep_client)\n[![Build Status](https://drone.albertyw.com/api/badges/albertyw/apple_dep_client/status.svg)](https://drone.albertyw.com/albertyw/apple_dep_client)\n[![Dependency Status](https://img.shields.io/librariesio/release/rubygems/apple_dep_client.svg)](https://libraries.io/rubygems/apple_dep_client)\n[![Code Climate](https://codeclimate.com/github/albertyw/apple_dep_client/badges/gpa.svg)](https://codeclimate.com/github/albertyw/apple_dep_client)\n[![Test Coverage](https://codeclimate.com/github/albertyw/apple_dep_client/badges/coverage.svg)](https://codeclimate.com/github/albertyw/apple_dep_client/coverage)\n[![security](https://hakiri.io/github/albertyw/apple_dep_client/master.svg)](https://hakiri.io/github/albertyw/apple_dep_client/master)\n\nThis gem allows for easy interaction with the Apple DEP API.\n\n## Installation\n\nRun `gem install apple_dep_client` or add `gem 'apple_dep_client'` to your\nGemfile then run `bundle install`.\n\nThis gem also also requires `OpenSSL` to be installed.  You can test it by\nrunning `require 'openssl'` in `irb` and checking that it works.\n\nIt is highly recommended that you use a patched version of the `plist` gem\navailable at https://github.com/albertyw/plist.  To do so, you should add\n`gem 'plist', git: 'https://github.com/albertyw/plist', ref: '3.1.2'` to your\nsoftware's `Gemfile`.\n\n## Usage\n\nSee Apple's [Mobile Device Management Protocol Reference](https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/MobileDeviceManagementProtocolRef/3-MDM_Protocol/MDM_Protocol.html) for more information\nabout the high level usage of their DEP Workflow.  All commands are under the\n`AppleDEPClient` namespace.  `AppleDEPClient` will\nautomatically handle OAuth for DEP endpoints.\n\n## Getting DEP Server Tokens\n\nIn order for you to read the DEP tokens returned by Apple from a DEP account,\nyou must decrypt it using a private key.  This will give the individual\nkeys needed for issuing commands to the DEP devices.\n\n```ruby\nAppleDEPClient.configure do |config|\n  config.private_key = 'PRIVATE_KEY'\nend\n# Get S/MIME encrypted Server Token from Apple\ntoken_data = AppleDEPClient::Token.decode_token(smime_data)\ntoken_data[:consumer_key]\ntoken_data[:consumer_secret]\n...\n```\n\n## Interacting with DEP endpoints\n\nThe main DEP management commands are issued like this.  See Apple's\n`MDM Protocol Reference` for information about all the commands.\n\n```ruby\nAppleDEPClient.configure do |config|\n  config.consumer_key        = token_data[:consumer_key]        # XXX\n  config.consumer_secret     = token_data[:consumer_secret]     # XXX\n  config.access_token        = token_data[:access_token]        # XXX\n  config.access_secret       = token_data[:access_secret]       # XXX\n  config.access_token_expiry = token_data[:access_token_expiry] # XXX\nend\n\ndata = AppleDEPClient::Account.fetch()\ndata[\"server_name\"]\ndata[\"server_uuid\"]\ndata[\"org_name\"]\n...\n```\n\nThe full list of commands is\n\n```\nAppleDEPClient::Account.fetch\nAppleDEPClient::Device.fetch(cursor: nil)\nAppleDEPClient::Device.sync(cursor){|device| pass }\nAppleDEPClient::Device.details(devices)\nAppleDEPClient::Device.disown(devices)\nAppleDEPClient::Profile.define(profile_hash)\nAppleDEPClient::Profile.assign(profile_uuid, devices)\nAppleDEPClient::Profile.fetch(profile_uuid)\nAppleDEPClient::Profile.remove(devices)\n```\n\n## Device Callbacks\n\nAfter assigning a DEP profile to a device, the device will hit the `url` in the profile.\nThe returned data will be \"encoded as a XML plist and then CMS-signed and DER-encoded\"\nand can be parsed as below:\n\n```ruby\ndata = AppleDEPClient::Callback.decode_callback(request_body)\ndata[\"UDID\"]\ndata[\"SERIAL\"]\n...\n```\n\n## Depsim\n\nThere is an example script at `example/example.rb` which can be run against\nApple's DEP simulator.  You'll need to download the simulator binary and\nrun it with `path/to/depsim start -p 80 example/depsim_config.json`.  You can\nthen run the script using `bundle exec ruby example/example.rb`.  `example.rb`\ncan of course be edited to use real DEP keys for manual DEP work (but be\ncareful to keep the keys secret).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertyw%2Fapple_dep_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertyw%2Fapple_dep_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertyw%2Fapple_dep_client/lists"}