diff --git a/.idea/apple-knowledge.iml b/.idea/apple-knowledge.iml
index b0574111..75328247 100644
--- a/.idea/apple-knowledge.iml
+++ b/.idea/apple-knowledge.iml
@@ -24,6 +24,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -83,7 +117,7 @@
-
+
@@ -145,7 +179,7 @@
-
+
@@ -194,6 +228,7 @@
+
@@ -206,7 +241,7 @@
-
+
@@ -219,7 +254,8 @@
-
+
+
diff --git a/.idea/jsonSchemas.xml b/.idea/jsonSchemas.xml
new file mode 100644
index 00000000..4dd317c7
--- /dev/null
+++ b/.idea/jsonSchemas.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/AppleData_Specs.xml b/.idea/runConfigurations/AppleData_Specs.xml
new file mode 100644
index 00000000..dd1ea645
--- /dev/null
+++ b/.idea/runConfigurations/AppleData_Specs.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/webResources.xml b/.idea/webResources.xml
new file mode 100644
index 00000000..11b42a95
--- /dev/null
+++ b/.idea/webResources.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.rubocop.yml b/.rubocop.yml
index 35cf58ef..bbc3b8e4 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -9,11 +9,13 @@
#
# See https://docs.rubocop.org/rubocop/configuration
+plugins:
+ - rubocop-rspec
AllCops:
NewCops: enable
SuggestExtensions: false
- TargetRubyVersion: 3.1
+ TargetRubyVersion: 3.3
Exclude:
- 'vendor/**/*'
- '_packages/ruby/vendor/**/*'
@@ -39,4 +41,10 @@ Naming/FileName:
Metrics/AbcSize:
CountRepeatedAttributes: false
- Max: 25
\ No newline at end of file
+ Max: 25
+
+Metrics/ClassLength:
+ Max: 150
+
+RSpec/ExampleLength:
+ Max: 15
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
index 82dbbfc9..2ffa8001 100644
--- a/Gemfile
+++ b/Gemfile
@@ -73,6 +73,7 @@ group :development, :test do
gem 'pry'
gem 'rake'
gem 'rate_throttle_client'
+ gem 'rbs-inline'
gem 'rspec'
gem 'rspec-rake'
gem 'rubocop'
diff --git a/Gemfile.lock b/Gemfile.lock
index 097a2ee8..0cc85fb9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,7 +1,12 @@
PATH
remote: _packages/ruby
specs:
- apple-data (1.0.375)
+ apple-data (1.0.665)
+ activesupport
+ jsonpath
+ pathutil
+ shale
+ zeitwerk
GEM
remote: https://rubygems.org/
@@ -98,7 +103,7 @@ GEM
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
- erb (6.0.6)
+ erb (6.0.7)
erubi (1.13.1)
escape_utils (1.3.0)
eth (0.5.17)
@@ -265,12 +270,13 @@ GEM
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
manpages (0.7.0)
- mdl (0.17.0)
+ mdl (0.18.0)
kramdown (~> 2.5)
kramdown-parser-gfm (~> 1.1)
mixlib-cli
mixlib-config
mixlib-shellout
+ uri
mediawiki_api (0.9.0)
faraday (>= 2.7.0)
faraday-cookie_jar
@@ -376,6 +382,9 @@ GEM
logger
prism (>= 1.6.0)
tsort
+ rbs-inline (0.14.0)
+ prism (>= 0.29)
+ rbs (~> 4.0)
rbsecp256k1 (6.0.0)
mini_portile2 (~> 2.8)
pkg-config (~> 1.5)
@@ -406,7 +415,7 @@ GEM
rake
rspec-core
rspec-support (3.13.7)
- rubocop (1.88.2)
+ rubocop (1.89.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
@@ -452,7 +461,9 @@ GEM
ffi-compiler (>= 1.0, < 2.0)
rake (~> 13)
securerandom (0.4.1)
- sorbet-runtime (0.6.13403)
+ shale (1.2.2)
+ bigdecimal
+ sorbet-runtime (0.6.13405)
sqlite3 (2.9.5-aarch64-linux-gnu)
sqlite3 (2.9.5-aarch64-linux-musl)
sqlite3 (2.9.5-arm64-darwin)
@@ -567,6 +578,7 @@ DEPENDENCIES
rake
rate_throttle_client
rbs
+ rbs-inline
rspec
rspec-rake
rubocop
@@ -587,7 +599,7 @@ CHECKSUMS
actionview (8.1.3.1) sha256=2da68b8414c47b43bfbed1ce69c5afe1c04f78c267aacb5660a4cab5ca12cfb6
activesupport (8.1.3.1) sha256=85458765f25ea48b9019c46b6bb3fa5683197bf4280d9f06710a6e8d7a831376
addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
- apple-data (1.0.375)
+ apple-data (1.0.665)
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
awesome_print (1.9.2) sha256=e99b32b704acff16d768b3468680793ced40bfdc4537eb07e06a4be11133786e
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
@@ -620,7 +632,7 @@ CHECKSUMS
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
ecdsa (1.2.0) sha256=b8f7c9541b6c587cbe37e705a1b76be6dc1e85336aa23ac3cf2f07b038bcec55
em-websocket (0.5.3) sha256=f56a92bde4e6cb879256d58ee31f124181f68f8887bd14d53d5d9a292758c6a8
- erb (6.0.6) sha256=a9b24986700f5bf127c4f297c5403c3ca41b83b0a316c0cd09a096b56e644ae5
+ erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
escape_utils (1.3.0) sha256=dffb7010922880ace6ceed642156c64e2a64620f27e0849f43bc4f68fd3c2c09
eth (0.5.17) sha256=5be9caa85b0643613010ae33c92e746a02ce376a35245e6eb5f491e80531f137
@@ -692,7 +704,7 @@ CHECKSUMS
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
loofah (2.25.2) sha256=2007f746959ac65552456e04b433e83deb22759ab38c838b4445c70e43425918
manpages (0.7.0) sha256=03da5fb59d5c3a847b86594b2f9a9ebec3b42d46caeb60b73ed0486beee7b309
- mdl (0.17.0) sha256=bb0a0813db04d3a41c991bdae8acc70912f153fc4fb88a3e0f126711da12c335
+ mdl (0.18.0) sha256=7d87163f7ea4d878209d65ab878fc17faeec3438faed688724ed13b24eaceba0
mediawiki_api (0.9.0) sha256=a4d77e35f8f608b923657da5f284a2b7beb130f443db910a0c10f3ca1641d1d3
mercenary (0.4.0) sha256=b25a1e4a59adca88665e08e24acf0af30da5b5d859f7d8f38fba52c28f405138
merkle_tree (0.2.0) sha256=12c8d37085edf856022434a49e397877a7772316c13d801ecb750f5c498416f1
@@ -746,6 +758,7 @@ CHECKSUMS
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
rbs (4.1.2) sha256=050eb1d8b508f1233bed929c0f2c7052302f7adf295230d9cb314e9024078f48
+ rbs-inline (0.14.0) sha256=eaf47b46690d63acddab1f6804c9cc205a4bc78e637cfc421a0b1239874ef51c
rbsecp256k1 (6.0.0) sha256=d38f563bfc6bcf3ce20c336a4798cc6990427f291e74c6817360363a72f11669
rdoc (8.0.0) sha256=03bf8c08a9639658855a0cfd77c0abca8325c227693f7f33f82957811348c469
regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
@@ -758,7 +771,7 @@ CHECKSUMS
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
rspec-rake (0.0.4) sha256=0a3f7e7685cd2f98f9c65c1c69c67b8ba3d737c6cb8cc3968670731aae86ab2f
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
- rubocop (1.88.2) sha256=8def251c90cd955feb4daa3edc0ab56893250c4ce90ef81e6c80c03f9a939bbf
+ rubocop (1.89.0) sha256=4dee8e3ee9c45e474834efd9e8d6fd031e8331c8dacdff0de4ad65ae0a6faae7
rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d
rubocop-rspec (3.10.2) sha256=0b3e2ecc592cd10ecbf0095bb58d1e357905276e069643523cc19eb7495f65e2
@@ -776,7 +789,8 @@ CHECKSUMS
sawyer (0.9.3) sha256=0d0f19298408047037638639fe62f4794483fb04320269169bd41af2bdcf5e41
scrypt (3.1.0) sha256=67fde35bc7e3b7fe906c5be9c242acf95fe4a886c89572f405f6b11df30aa6af
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
- sorbet-runtime (0.6.13403) sha256=8545fc4cd55fbf820f2000f6d13c0ea1c2e5f7b67369e76ebf39fea81fc490b3
+ shale (1.2.2) sha256=e298bd0658e2651c76a1a4ffc7db8d43592288181d28d78ce5748c8525094cca
+ sorbet-runtime (0.6.13405) sha256=b1e38aea9200cdfcdd2f7758836f8150f22462eecb4ee0cef86a8f58df4e9e31
sqlite3 (2.9.5-aarch64-linux-gnu) sha256=78075b6337d3d182c6d2b4691049ed45cd220826160c9ea18946bf6a1de200dc
sqlite3 (2.9.5-aarch64-linux-musl) sha256=18c801185deb4adc01ddb281e8f672a39e3d1729979ca91e39439cd3eac0402d
sqlite3 (2.9.5-arm64-darwin) sha256=d0cf444a70fc9395d513cfbcc1e6719e224aa645314e3824cb0474c721425aa2
diff --git a/Rakefile b/Rakefile
index 31dce346..bf8b5d13 100755
--- a/Rakefile
+++ b/Rakefile
@@ -3,6 +3,7 @@
require 'bundler/setup'
require 'rubocop/rake_task'
+require 'rspec/core/rake_task'
BASE_PATH = File.dirname(__FILE__)
@@ -20,13 +21,14 @@ RuboCop::RakeTask.new
desc 'do all precommit tasks'
task precommit: %i[sort]
+RSpec::Core::RakeTask.new(:spec)
+
desc 'default build task'
-task default: ['rubocop:auto_correct', :precommit]
+task default: ['rubocop:autocorrect', :spec, :precommit]
desc 'Perform all automated updates'
task :update do
UPDATE_TASKS.each do |task|
- puts "Executing update task: #{task}"
Rake::Task[task].invoke
end
end
diff --git a/_data/fdr.yaml b/_data/fdr.yaml
index 9c41c6a8..2bcadf4a 100644
--- a/_data/fdr.yaml
+++ b/_data/fdr.yaml
@@ -5,7 +5,7 @@ metadata:
collections:
- fdr_properties
fdr_modes:
- '':
+ base:
description: Objects for the device directly, indicates no factory process or
mode in use.
mansta:
@@ -97,7 +97,7 @@ fdr_properties:
comb:
description: Combined FDR object
dCfg:
- description: Display LCD
+ description:
contexts:
- base
- mansta
@@ -152,11 +152,12 @@ fdr_properties:
- base
- mansta
meid:
- description: Mobile Equipment Identifier (CMDA)
+ title: Mobile Equipment Identifier (CMDA)
mft2:
mlb#:
- description: Main Logic Board Serial Number
+ title: Main Logic Board Serial Number
mmap:
+ title: Memory Map
description: The memory map passed from the iBoot loader to the Kernel
nuid:
description:
@@ -204,7 +205,8 @@ fdr_properties:
title: Recovery SSL
description: Root SSL / TLS certificate
rvok:
- description: Trust Object Revocation
+ title: Revocation List
+ description: FDR trust object list of revoked certificates / public keys
scrt:
description: SEP Certificate
contexts:
@@ -213,7 +215,9 @@ fdr_properties:
description: Point Compressed Elliptic Curve point sering as the master Public
Key for the SE
seal:
- description:
+ title: FDR Sealing Object
+ description: Used to provide a cryptographic seal of the data that is restored
+ to the device via FDR to prevent tampering with said data.
contexts:
- base
secb:
@@ -231,7 +235,9 @@ fdr_properties:
title: Trusted Public Keys
description: Trusted Public Key
trst:
- description: Trust Object
+ title: Trust Object
+ description: The various data required to connect to FDR, includes the remote
+ SSL root, revocation list, and trusted public keys
tsid:
description:
vcrt:
diff --git a/_data/img4.yaml b/_data/img4.yaml
index f4bfe5ff..a7503f66 100644
--- a/_data/img4.yaml
+++ b/_data/img4.yaml
@@ -1019,7 +1019,7 @@ objects:
rdtr:
title: Restore Device Tree
description:
- firmware_name: RestoreDeviceTree
+ firmware_name: RestoreDeviceTree
recm:
description: Recovery Mode
firmware_name: RecoveryMode
diff --git a/_data/pki.yaml b/_data/pki.yaml
index 4ba80c74..210857aa 100644
--- a/_data/pki.yaml
+++ b/_data/pki.yaml
@@ -7,18 +7,27 @@ metadata:
- keys
- oids
certificate_names:
- dcrt: Device Identity Certificate
- dcrt-oid: Device Owner Identity Certificate
- lcrt: Lynx / Secure Storage for SEP Certificate
- pcrt: product/production certificate?
- rcrt: remote/recovery certificate?
- scrt: SEP Certificate
- sdcrt: SEP Device Certificate
- tcrt: test certificate?
+ dcrt:
+ name: Device Identity Certificate
+ dcrt-oid:
+ name: Device Owner Identity Certificate
+ lcrt:
+ name: Lynx / Secure Storage for SEP Certificate
+ pcrt:
+ name: Protected Certificate
+ rcrt:
+ name: remote/recovery certificate?
+ scrt:
+ name: SEP Certificate
+ sdcrt:
+ name: SEP Device Certificate
+ tcrt:
+ name: test certificate?
ucrt:
name: User Identity Certificate
issuer: Basic Attestation User Root CA
- vcrt: virtual certificate?
+ vcrt:
+ name: virtual certificate?
keys:
oik:
title: Owner Identity Key
diff --git a/_packages/ruby/1 b/_packages/ruby/1
deleted file mode 100644
index e69de29b..00000000
diff --git a/_packages/ruby/Gemfile b/_packages/ruby/Gemfile
index 1c4f1888..c89bbdb3 100644
--- a/_packages/ruby/Gemfile
+++ b/_packages/ruby/Gemfile
@@ -2,7 +2,11 @@
source 'https://rubygems.org'
+gem 'activesupport'
+gem 'jsonpath'
gem 'pathutil'
+gem 'shale'
+gem 'zeitwerk'
group :development, :test do
gem 'rake'
diff --git a/_packages/ruby/Gemfile.lock b/_packages/ruby/Gemfile.lock
index bc46e218..550ea5f9 100644
--- a/_packages/ruby/Gemfile.lock
+++ b/_packages/ruby/Gemfile.lock
@@ -1,16 +1,45 @@
GEM
remote: https://rubygems.org/
specs:
+ activesupport (8.1.3.1)
+ base64
+ bigdecimal
+ concurrent-ruby (~> 1.0, >= 1.3.1)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ json
+ logger (>= 1.4.2)
+ minitest (>= 5.1)
+ securerandom (>= 0.3)
+ tzinfo (~> 2.0, >= 2.0.5)
+ uri (>= 0.13.1)
ast (2.4.3)
+ base64 (0.3.0)
+ bigdecimal (4.1.2)
concurrent-ruby (1.3.8)
+ connection_pool (3.0.2)
csv (3.3.6)
diff-lcs (1.6.2)
+ drb (2.2.3)
+ ffi (1.17.4)
+ ffi (1.17.4-aarch64-linux-gnu)
+ ffi (1.17.4-aarch64-linux-musl)
+ ffi (1.17.4-arm-linux-gnu)
+ ffi (1.17.4-arm-linux-musl)
ffi (1.17.4-arm64-darwin)
+ ffi (1.17.4-x86-linux-gnu)
+ ffi (1.17.4-x86-linux-musl)
ffi (1.17.4-x86_64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
+ ffi (1.17.4-x86_64-linux-musl)
fileutils (1.8.0)
forwardable-extended (2.6.0)
+ i18n (1.15.2)
+ concurrent-ruby (~> 1.0)
json (2.21.2)
+ jsonpath (1.1.5)
+ multi_json
language_server-protocol (3.17.0.6)
lint_roller (1.1.0)
listen (3.10.0)
@@ -18,6 +47,10 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
+ minitest (6.0.6)
+ drb (~> 2.0)
+ prism (~> 1.5)
+ multi_json (1.21.1)
parallel (2.1.0)
parser (3.3.12.0)
ast (~> 2.4.1)
@@ -49,7 +82,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
- rubocop (1.88.2)
+ rubocop (1.89.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
@@ -65,6 +98,8 @@ GEM
prism (~> 1.7)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
+ shale (1.2.2)
+ bigdecimal
steep (2.0.0)
concurrent-ruby (>= 1.1.10)
csv (>= 3.0.9)
@@ -85,26 +120,102 @@ GEM
terminal-table (4.0.0)
unicode-display_width (>= 1.1.1, < 4)
tsort (0.2.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
uri (1.1.1)
+ zeitwerk (2.8.3)
PLATFORMS
- arm64-darwin-22
- arm64-darwin-23
- arm64-darwin-25
- x86_64-darwin-21
- x86_64-darwin-22
+ aarch64-linux-gnu
+ aarch64-linux-musl
+ arm-linux-gnu
+ arm-linux-musl
+ arm64-darwin
+ x86-linux-gnu
+ x86-linux-musl
+ x86_64-darwin
x86_64-linux
+ x86_64-linux-gnu
+ x86_64-linux-musl
DEPENDENCIES
+ activesupport
+ jsonpath
pathutil
rake
rbs
rspec
rubocop
+ shale
steep
+ zeitwerk
+
+CHECKSUMS
+ activesupport (8.1.3.1) sha256=85458765f25ea48b9019c46b6bb3fa5683197bf4280d9f06710a6e8d7a831376
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
+ bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
+ bundler (4.0.16) sha256=d6ca5dd440c24f9abce9844cf44cc8e18c6a553de65a47efb4544137af92c47d
+ concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
+ connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
+ csv (3.3.6) sha256=aba61e7e507a66f03d45cb1f3c4b6359861c3504038b422962875dce099e4456
+ diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
+ drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
+ ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf
+ ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
+ ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
+ ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
+ ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95
+ ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b
+ ffi (1.17.4-x86-linux-gnu) sha256=38e150df5f4ca555e25beca4090823ae09657bceded154e3c52f8631c1ed72cf
+ ffi (1.17.4-x86-linux-musl) sha256=fbeec0fc7c795bcf86f623bb18d31ea1820f7bd580e1703a3d3740d527437809
+ ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
+ ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
+ ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
+ fileutils (1.8.0) sha256=8c6b1df54e2540bdb2f39258f08af78853aa70bad52b4d394bbc6424593c6e02
+ forwardable-extended (2.6.0) sha256=1bec948c469bbddfadeb3bd90eb8c85f6e627a412a3e852acfd7eaedbac3ec97
+ i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
+ json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
+ jsonpath (1.1.5) sha256=29f70467193a2dc93ab864ec3d3326d54267961acc623f487340eb9c34931dbe
+ language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
+ lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
+ listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
+ minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
+ multi_json (1.21.1) sha256=e6126a31808e3b4d19f483c775ceac34df190dffa62adfb63a165ee14ba68080
+ parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
+ parser (3.3.12.0) sha256=21a6d7f755d5a24dfbdc6e6b772e4e879a52e7631a88bc5a3a134606052c9828
+ pathutil (0.16.2) sha256=e43b74365631cab4f6d5e4228f812927efc9cb2c71e62976edcb252ee948d589
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
+ rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
+ rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
+ rbs (4.1.2) sha256=050eb1d8b508f1233bed929c0f2c7052302f7adf295230d9cb314e9024078f48
+ regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
+ rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
+ rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
+ rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
+ rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
+ rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
+ rubocop (1.89.0) sha256=4dee8e3ee9c45e474834efd9e8d6fd031e8331c8dacdff0de4ad65ae0a6faae7
+ rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
+ securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
+ shale (1.2.2) sha256=e298bd0658e2651c76a1a4ffc7db8d43592288181d28d78ce5748c8525094cca
+ steep (2.0.0) sha256=6eb0ecc09637bbb54f0a5f2cf63daea6d3208ccace64b4f1107d976333605c30
+ strscan (3.1.8) sha256=aae2db611a225559f21ffbb71765c9a4e60fd262534a9ea84f4f11c7f32f679e
+ terminal-table (4.0.0) sha256=f504793203f8251b2ea7c7068333053f0beeea26093ec9962e62ea79f94301d2
+ tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
+ tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
+ unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
+ unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
+ zeitwerk (2.8.3) sha256=2c85125a8467ce069e20123d1e709a08955c9d29c118c25b46b7b7fafdbb92e5
BUNDLED WITH
- 2.3.7
+ 4.0.16
diff --git a/_packages/ruby/Rakefile b/_packages/ruby/Rakefile
index e7891040..4e494d69 100644
--- a/_packages/ruby/Rakefile
+++ b/_packages/ruby/Rakefile
@@ -14,7 +14,7 @@ OUTPUT_PATH = Pathutil.new OUTPUT_ROOT
desc 'set the version patch to the git main height'
task :version do
- repo_height = `git rev-list --count main`
+ repo_height = `git rev-list --count HEAD`
repo_height = '0' if repo_height.empty?
version_file = %(# frozen_string_literal: true
@@ -40,7 +40,7 @@ task :files do
end
desc 'build the package'
-task default: %i[files version]
+task default: %i[files version spec]
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
diff --git a/_packages/ruby/apple-data.gemspec b/_packages/ruby/apple-data.gemspec
index d0a8dbc9..82580062 100644
--- a/_packages/ruby/apple-data.gemspec
+++ b/_packages/ruby/apple-data.gemspec
@@ -22,6 +22,12 @@ Gem::Specification.new do |s|
s.email = 'rickmark@outlook.com'
s.files = Dir['share/**/*.yaml'] + Dir['lib/**/*']
s.homepage = 'https://docs.hackdiffe.rent'
- s.required_ruby_version = '>= 3.1'
+ s.required_ruby_version = '>= 3.3'
s.metadata = { 'source_code_uri' => 'https://github.com/hack-different/apple-knowledge' }
+
+ s.add_dependency 'activesupport'
+ s.add_dependency 'jsonpath'
+ s.add_dependency 'pathutil'
+ s.add_dependency 'shale'
+ s.add_dependency 'zeitwerk'
end
diff --git a/_packages/ruby/bin/console b/_packages/ruby/bin/console
new file mode 100755
index 00000000..75d5751c
--- /dev/null
+++ b/_packages/ruby/bin/console
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+require 'bundler/setup'
+require 'apple_data'
+
+# You can add fixtures and/or initialization code here to make experimenting
+# with your gem easier. You can also use a different console, if you like.
+
+# (If you use this, don't forget to add pry to your Gemfile!)
+# require "pry"
+# Pry.start
+
+require 'pry'
+Pry.start(__FILE__)
diff --git a/_packages/ruby/lib/apple-data.rb b/_packages/ruby/lib/apple-data.rb
deleted file mode 100644
index 4c6ed517..00000000
--- a/_packages/ruby/lib/apple-data.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-# frozen_string_literal: true
-
-require_relative 'apple_data'
diff --git a/_packages/ruby/lib/apple_data.rb b/_packages/ruby/lib/apple_data.rb
index 993f77b4..ae6427b5 100644
--- a/_packages/ruby/lib/apple_data.rb
+++ b/_packages/ruby/lib/apple_data.rb
@@ -1,7 +1,25 @@
# frozen_string_literal: true
+require 'active_support/all'
+require 'shale'
+require 'zeitwerk'
+require 'jsonpath'
+
# Base Namespace for AppleData gem
module AppleData
+ LOADER = Zeitwerk::Loader.new.tap do |loader|
+ loader.push_dir(__dir__)
+ loader.tag = 'apple-data'
+ loader.inflector.tap do |inflector|
+ inflector.inflect 'dsl' => 'DSL'
+ inflector.inflect 'img4' => 'IMG4'
+ inflector.inflect 'pki' => 'PKI'
+ end
+ loader.setup
+
+ loader.eager_load_dir(File.join(__dir__, 'apple_data/schemas'))
+ end
+
DEFAULT_APPLE_DATA_SHARE = File.join(File.dirname(__FILE__), '../share/')
def get_data(file)
@@ -16,9 +34,3 @@ def self.data_location
@apple_data || AppleData::DEFAULT_APPLE_DATA_SHARE
end
end
-
-require 'apple_data/data_file'
-require 'apple_data/factory_data_reset'
-require 'apple_data/io_reg'
-require 'apple_data/lockdown'
-require 'apple_data/keybag'
diff --git a/_packages/ruby/lib/apple_data/data_file.rb b/_packages/ruby/lib/apple_data/data_file.rb
index e62b793b..a6cf5d1c 100644
--- a/_packages/ruby/lib/apple_data/data_file.rb
+++ b/_packages/ruby/lib/apple_data/data_file.rb
@@ -1,17 +1,31 @@
# frozen_string_literal: true
-require 'active_support/all'
-require 'jsonpath'
-
module AppleData
# Base class for all data files
class DataFile
+ def self.define(&)
+ dsl = AppleData::DSL::DataFileDefinition.new
+ dsl.instance_eval(&)
+ dsl.build!
+ end
+
+ def self.inherited(klass)
+ super
+ @data_files ||= []
+ @data_files << klass
+ end
+
+ def self.all
+ @data_files
+ end
+
attr_reader :data
def initialize(*parts)
@parts = parts
+ @parts = [self.class.const_get(:DEFAULT_FILENAME)] if @parts.empty?
@collections = {}
- load_file(*parts)
+ load_file(*@parts)
ensure_metadata
end
@@ -27,11 +41,12 @@ def self.from_path(path)
end
def load_file(*parts)
- parts[-1] = "#{parts[-1]}.yaml" unless T.must(parts[-1]).end_with? '.yaml'
- @filename = File.join(AppleData.data_location, T.unsafe(File).join(*parts))
+ parts[-1] = "#{parts[-1]}.yaml" unless parts[-1].end_with? '.yaml'
+ @filename = File.join(AppleData.data_location, File.join(*parts))
@data = {}
@data = YAML.load_file @filename if File.exist? @filename
- @data.with_indifferent_access
+ @data.deep_symbolize_keys!
+ @data = @data.with_indifferent_access
end
def save!
@@ -120,5 +135,31 @@ def sort!
end
end
end
+
+ def construct_array(collection_definition, value)
+ value.data.map do |item|
+ if collection_definition.mapper
+ collection_definition.mapper.from_hash(item)
+ else
+ item
+ end
+ end
+ end
+
+ def construct_hash(collection_definition, value)
+ result = value.data.map do |key, item|
+ instance = if item
+ if collection_definition.mapper
+ collection_definition.mapper.from_hash(item)
+ else
+ item
+ end
+ end
+ instance.key = key if instance.respond_to? :key=
+ [key, instance]
+ end
+
+ result.to_h
+ end
end
end
diff --git a/_packages/ruby/lib/apple_data/dsl/collection_definition.rb b/_packages/ruby/lib/apple_data/dsl/collection_definition.rb
new file mode 100644
index 00000000..39d67f8f
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/dsl/collection_definition.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+module AppleData
+ module DSL
+ # A definition of a collection of objects, with a particular schema
+ class CollectionDefinition
+ attr_reader :name
+ attr_accessor :mapper
+
+ def initialize(name, mapper)
+ @name = name
+ @mapper = mapper
+ end
+
+ # Builds the collection into the given data file class
+ def build!(klass)
+ name = @name
+ klass.instance_eval do
+ define_method(name) do
+ @mapped_collections ||= {}
+ if @mapped_collections[name].nil?
+ collection_definition = self.class.const_get(:COLLECTIONS)[name]
+
+ value = collection(name.to_s)
+ result = case value.data
+ when Hash
+ construct_hash(collection_definition, value)
+ when Array
+ construct_array(collection_definition, value)
+ else
+ value.data
+ end
+
+ @mapped_collections[name] = result
+ end
+
+ @mapped_collections[name]
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/dsl/data_file_definition.rb b/_packages/ruby/lib/apple_data/dsl/data_file_definition.rb
new file mode 100644
index 00000000..66e50877
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/dsl/data_file_definition.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+module AppleData
+ module DSL
+ # The DSL that is used when defining a data file
+ class DataFileDefinition
+ def initialize
+ @collections = {}
+ end
+
+ def collection(name, mapper = nil, &)
+ @collections[name] = AppleData::DSL::CollectionDefinition.new(name, mapper)
+ if block_given? && @collections[name].mapper.nil?
+ @collections[name].mapper = Class.new(AppleData::SchemaBase)
+ @collections[name].mapper.class_eval(&)
+ end
+ @collections[name]
+ end
+
+ attr_writer :default_filename
+
+ def build!
+ klass = Class.new(DataFile)
+
+ klass.const_set(:DEFAULT_FILENAME, @default_filename)
+ klass.const_set(:COLLECTIONS, @collections)
+
+ @collections.each_value do |collection_definition|
+ collection_definition.build!(klass)
+ end
+
+ klass
+ end
+ end
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/models/img4/object.rb b/_packages/ruby/lib/apple_data/models/img4/object.rb
new file mode 100644
index 00000000..dc6c4bf0
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/models/img4/object.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module AppleData
+ module Models
+ module IMG4
+ # IMG4 "objects" are either a reference to a file, or some other structured set of properties
+ class Object < AppleData::Models::IMG4::Tag
+ attribute :encoding, :string
+ attribute :firmware_name, :string
+ attribute :recovery, :boolean
+ attribute :restore, :boolean
+ attribute :firmware, :boolean
+ attribute :subtype, :string
+ attribute :manifest, :boolean
+ attribute :nullable, :boolean
+ attribute :roots, :string, collection: true
+ attribute :metadata, :string, collection: true
+ attribute :values, :string, collection: true
+ attribute :width, :integer
+ end
+ end
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/models/img4/property.rb b/_packages/ruby/lib/apple_data/models/img4/property.rb
new file mode 100644
index 00000000..4e5210b5
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/models/img4/property.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module AppleData
+ module Models
+ module IMG4
+ # An IMG4 property is a name and a value
+ class Property < AppleData::Models::IMG4::Tag
+ attribute :roots, :string, collection: true
+ attribute :example, :string
+ end
+ end
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/models/img4/tag.rb b/_packages/ruby/lib/apple_data/models/img4/tag.rb
new file mode 100644
index 00000000..d31f3caa
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/models/img4/tag.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module AppleData
+ module Models
+ module IMG4
+ # Generic IMG4 DER "tag"
+ class Tag < Shale::Mapper
+ attr_accessor :key
+
+ attribute :name, :string
+ attribute :description, :string
+ attribute :title, :string
+ attribute :alias, :string, collection: true
+ attribute :example, :string
+ attribute :type, :string
+
+ def to_s
+ name || title || description || key
+ end
+
+ def to_sym
+ to_s.to_sym
+ end
+ end
+ end
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/models/metadata.rb b/_packages/ruby/lib/apple_data/models/metadata.rb
new file mode 100644
index 00000000..14375769
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/models/metadata.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+module AppleData
+ module Models
+ # The metadata common to all Apple Data models
+ class Metadata < AppleData::SchemaBase
+ attribute :credits, :string, collection: true
+ attribute :description, :string
+ attribute :auto_sort, :boolean
+ end
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/schema_base.rb b/_packages/ruby/lib/apple_data/schema_base.rb
new file mode 100644
index 00000000..c714c54b
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/schema_base.rb
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+module AppleData
+ class SchemaBase < Shale::Mapper
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/schemas/factory_data_restore.rb b/_packages/ruby/lib/apple_data/schemas/factory_data_restore.rb
new file mode 100644
index 00000000..9d472331
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/schemas/factory_data_restore.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+AppleData::Schemas::FactoryDataRestore = AppleData::DataFile.define do
+ self.default_filename = 'fdr'
+
+ collection :fdr_modes do
+ attribute :description, :string
+ end
+
+ collection :fdr_objects, AppleData::Models::IMG4::Object
+
+ collection :fdr_properties, AppleData::Models::IMG4::Property
+end
diff --git a/_packages/ruby/lib/apple_data/schemas/img4.rb b/_packages/ruby/lib/apple_data/schemas/img4.rb
new file mode 100644
index 00000000..2db58a2e
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/schemas/img4.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+AppleData::Schemas::IMG4 = AppleData::DataFile.define do
+ self.default_filename = 'img4'
+
+ collection :unmapped
+
+ collection :core, AppleData::Models::IMG4::Tag
+ collection :lpol_properties, AppleData::Models::IMG4::Property
+ collection :cryptex_properties, AppleData::Models::IMG4::Property
+ collection :cryptex_objects, AppleData::Models::IMG4::Object
+ collection :manifest_properties, AppleData::Models::IMG4::Property
+ collection :objects, AppleData::Models::IMG4::Object
+ collection :img4_tags, AppleData::Models::IMG4::Tag
+
+ collection :types do
+ attribute :description, :string
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/schemas/local_policy.rb b/_packages/ruby/lib/apple_data/schemas/local_policy.rb
new file mode 100644
index 00000000..543a439a
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/schemas/local_policy.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+AppleData::Schemas::LocalPolicy = AppleData::DataFile.define do
+ self.default_filename = 'local_policy'
+end
diff --git a/_packages/ruby/lib/apple_data/schemas/pki.rb b/_packages/ruby/lib/apple_data/schemas/pki.rb
new file mode 100644
index 00000000..a2047ece
--- /dev/null
+++ b/_packages/ruby/lib/apple_data/schemas/pki.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+AppleData::Schemas::PKI = AppleData::DataFile.define do
+ self.default_filename = 'pki'
+
+ collection :certificate_names do
+ attribute :key, :string
+ attribute :name, :string
+ attribute :issuer, :string
+ end
+
+ collection :keys do
+ attribute :title, :string
+ attribute :certificates, :string, collection: true
+ end
+
+ collection :oids do
+ attribute :title, :string
+ attribute :type, :string
+ attribute :description, :string
+ attribute :apple_description, :string
+ attribute :found_in, :string, collection: true
+ attribute :issuers, :string, collection: true
+ attribute :ous, :string, collection: true
+ end
+end
diff --git a/_packages/ruby/lib/apple_data/version.rb b/_packages/ruby/lib/apple_data/version.rb
index ddb04b58..261cb628 100644
--- a/_packages/ruby/lib/apple_data/version.rb
+++ b/_packages/ruby/lib/apple_data/version.rb
@@ -1,6 +1,5 @@
-# typed: strict
# frozen_string_literal: true
module AppleData
- VERSION = '1.0.375'
+ VERSION = '1.0.665'
end
diff --git a/_packages/ruby/ruby.iml b/_packages/ruby/ruby.iml
index f56ae094..aa6703ce 100644
--- a/_packages/ruby/ruby.iml
+++ b/_packages/ruby/ruby.iml
@@ -12,22 +12,32 @@
+
+
-
+
+
+
+
+
+
+
+
+
@@ -44,17 +54,20 @@
-
+
+
+
+