{"id":41232,"date":"2023-11-26T21:47:19","date_gmt":"2023-11-27T02:47:19","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=41232"},"modified":"2023-11-26T21:47:19","modified_gmt":"2023-11-27T02:47:19","slug":"receipt-validation-with-all-the-ethernet-interfaces","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/11\/26\/receipt-validation-with-all-the-ethernet-interfaces\/","title":{"rendered":"Receipt Validation With All the Ethernet Interfaces"},"content":{"rendered":"<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/2023\/11\/4.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/2023\/11\/4.html\"><p>I&rsquo;ve recently run into a case that seems to call into question all extant sample code for Mac App Store receipt validation. [&#8230;] I learned that the ethernet port of the customer&rsquo;s Mac was fried as a result of electrical damage from a lightning strike. The Mac&rsquo;s motherboard was replaced, but afterward the customer still couldn&rsquo;t launch Magnet, and now they couldn&rsquo;t launch Link Unshortener either. It turns out that the Mac&rsquo;s ethernet port is now <code>en11<\/code> rather than <code>en0<\/code>. Apple&rsquo;s old sample code checked only <code>en0<\/code>, and Apple&rsquo;s new sample code checks only <code>en0<\/code> and <code>en1<\/code>, so that technique won&rsquo;t work. And the technique <a href=\"https:\/\/supermegaultragroovy.com\/2019\/10\/22\/check-your-receipt-validation-code\/\" title=\"Developer PSA: Check Your Receipt Validation Code\">suggested by Chris Liscio<\/a> won&rsquo;t work, because querying for <code>kIOPrimaryInterface<\/code> returned no results! The customer&rsquo;s Mac reported having no primary ethernet interface.<\/p><p>My solution was to query all built-in ethernet interfaces&mdash;in technical terms, <code>kIOBuiltin<\/code> devices of <code>kIOEthernetInterfaceClass<\/code>&mdash;and attempt to validate each interface&rsquo;s MAC address with the App Store receipt until a match was found. This might be the same technique <a href=\"https:\/\/pfandrade.me\/blog\/pitfalls-when-validating-app-store-receipts-on-macos\/\" title=\"Pitfalls when validating App Store receipts on macOS\">suggested by Paulo Andrade<\/a>, but that blog post contains no sample code.<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/05\/29\/receipt-validation-with-sha-256\/\">Receipt Validation With SHA-256<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2022\/05\/20\/new-receipt-validation-sample-code\/\">New Receipt Validation Sample Code<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/10\/16\/receipt-validation-and-airplay-2\/\">Receipt Validation and AirPlay 2<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson: I&rsquo;ve recently run into a case that seems to call into question all extant sample code for Mac App Store receipt validation. [&#8230;] I learned that the ethernet port of the customer&rsquo;s Mac was fried as a result of electrical damage from a lightning strike. The Mac&rsquo;s motherboard was replaced, but afterward the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-11-27T02:47:22Z","apple_news_api_id":"1d95346e-3cb9-4f97-8b22-385d95dcebba","apple_news_api_modified_at":"2023-11-27T02:47:22Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AHZU0bjy5T5eLIjhdldzrug","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[2392,762,30,39,2385,74,71],"class_list":["post-41232","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-app-store-receipt-validation","tag-ethernet","tag-mac","tag-macappstore","tag-macos-14-sonoma","tag-opensource","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=41232"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41232\/revisions"}],"predecessor-version":[{"id":41233,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41232\/revisions\/41233"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=41232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=41232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=41232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}