Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Appleウォレット / Googleウォレットに チケットを保存する方法

Appleウォレット / Googleウォレットに チケットを保存する方法

iOSDC Japan 2024 day1での発表資料です。
補足記事: https://muno-92.hatenablog.com/entry/2024/09/01/184414

Avatar for muno92

muno92

August 22, 2024
Tweet

Resources

More Decks by muno92

Other Decks in Technology

Transcript

  1. Apple΢ΥϨοτ • ༷ʑͳʮύεʯΛiPhoneɾ Apple WatchʹอଘՄೳͳ αʔϏε • ⚠ Ұൠతͳύε͸ʮଞͷछผ ʹ౰ͯ͸·Βͳ͔ͬͨʯ৔߹

    ͷΈ࢖༻Մ  ౥৐݊ Ϋʔϙϯ Πϕϯτ ళฮΧʔυ ͦͷଞͷҰൠతͳύε ը૾: https://developer.apple.com/jp/wallet/ ࠓճ͸͜Ε
  2. ࣄલ४උ 1. Google Wallet API ൃߦऀΞΧ΢ϯτొ࿥ 2. Google Cloudͷ೚ҙͷϓϩδΣΫτͰGoogle Wallet

    APIΛ༗ޮԽ 3. 2൪ͷϓϩδΣΫτͰαʔϏεΞΧ΢ϯτʢΞϓϦέʔγϣϯ༻ͷ ΞΧ΢ϯτʣΛ࡞੒ 4. Google Pay and Wallet ConsoleͰ3൪ͷΞΧ΢ϯτΛঝೝ  https://developers.google.com/wallet/tickets/events/getting-started/onboarding-guide
  3. 🚫 "Add to Google Wallet"Ϙλϯ • ೔ຊޠԽ͞ΕͨϘλϯΛ࢖͍ͬͯͳ͔ͬͨ • "It appears

    the button being used in your screenshot is incorrect and we ask that you correct this to re fl ect our Brand Guidelines." • Կ͕Ͳ͏incorrectͳͷ͔ͷهࡌ͸ແ͘ɺϩʔΧϥΠζରԠ͕ ࢦఠՕॴ͔΋͠Εͳ͍ͱमਖ਼ͨ͠Β৹ࠪΛ௨ͬͨ 
  4. ຊ൪Ͱಈ͔ͨ͠ΒΤϥʔ • 400Τϥʔ • Request contains an invalid argument •

    ͜Ε͚ͩ • → ύεʹࠩ͠ࠐΉը૾ͷURL૊Έཱͯॲཧ͕ؒҧ͍ͬͯͨ • ϩʔΧϧ؀ڥͰ͸ը૾Λݻఆ͍ͯͨ͠ͷͰؾ͚ͮͣʢ෬ઢճऩʣ 
  5. ϋογϡ (manifest.json) • zip಺ʹ͋Δ֤ϑΝΠϧͷSHA-1 ϋογϡΛ֨ೲɻϑΝΠϧ͕վ͟ Μ͞Εͯϋογϡ͕Ұக͠ͳ͍ͱ ҎԼͷΑ͏ͳΤϥʔ͕ग़Δɻ • "Invalid data

    error reading pass XXX. For fi le pass.json, manifest's listed SHA1 hash YYY doesn't match computed hash, ZZZ" 
  6. ࣮૷ 1. Apple Developer͔Βূ໌ॻΛ࡞੒ 2. pass.jsonΛ࡞੒ 3. ඞཁͳը૾Λ഑ஔ 4. pass.jsonɾը૾ͷSHA-1ϋογϡΛܭࢉ͠manifest.jsonΛ࡞੒

    5. manifest.jsonʹॺ໊ 6. zipѹॖ͠ɺ֦ுࢠΛpkpassʹมߋ 7. ʮApple΢ΥϨοτʹอଘʯϘλϯΛઃஔ 
  7. ূ໌ॻͷ࡞੒ 1. CSR (Certi fi cate Signing Requestɻূ໌ॻॺ໊ཁٻ)Λ࡞੒ • ॺ໊࣌ʹൿີ伴͕ඞཁʹͳΔͷͰɺCSRੜ੒࣌ʹൿີ伴΋࡞੒͓ͯ͘͠

    • ྫ) openssl req -new -key cert.key -out cert.csr -sha256 2. Apple Developer্ 1. Pass Type Identi fi erΛ࡞੒ 2. CSRΛΞοϓϩʔυ͠ɺূ໌ॻΛ࡞੒  https://developer.apple.com/documentation/walletpasses/building-a-pass
  8. ඞཁͳը૾ͷ഑ஔ • icon: ͲͷछྨͷύεͰ΋ඞਢ • "Customize the look of your

    pass by using images for a logo and other items. All passes require an icon" • ϝʔϧʹఴ෇͞Εͨ৔߹ͷը૾දࣔ΍ɺ௨஌Ͱ࢖༻͞ΕΔ • ͦͷଞͷը૾: ύεͷछྨ΍ϨΠΞ΢τʹԠͯ͡ඞਢ • ΠϕϯτύεͷϨΠΞ΢τ͸2छྨ 
  9. ΠϕϯτύεͰඞཁͳը૾ϑΝΠϧ • icon • Layout 1ͷ৔߹ • background or thumbnail

    • Layout 2ͷ৔߹ ←ͪ͜ΒΛ࢖༻ • strip (ԣ௕ͷը૾) 
  10. Layout͸Ͳ͏΍ܾͬͯ·Δʁ "An event ticket can display logo, strip, background, or

    thumbnail images. However, if you supply a strip image, don’t include a background or thumbnail image." 🤔  https://developer.apple.com/design/human-interface-guidelines/wallet
  11. Layout͸Ͳ͏΍ܾͬͯ·Δʁ "An event ticket can display logo, strip, background, or

    thumbnail images. However, if you supply a strip image, don’t include a background or thumbnail image." ҙ༁) background image͔thumbnail image͕͋Ε͹Layout 1 ʹɺstrip image͕͋Ε͹Layout 2ʹͳΓ·͢ɻ  https://developer.apple.com/design/human-interface-guidelines/wallet
  12. manifest.jsonʹॺ໊ • ྫ) openssl smime -sign -in manifest.json -inkey ൿີ伴ͷύε

    -signer ূ໌ॻͷύε -cert fi le தؒূ໌ ॻͷύε -out signature -outform DER • ॺ໊ʹඞཁͳϑΝΠϧ • Apple Developer͔Βൃߦͨ͠ূ໌ॻ • ূ໌ॻʹඥͮ͘ൿີ伴 • WWDRதؒূ໌ॻ https://developer.apple.com/jp/help/account/reference/wwdr-intermediate-certi fi cates/ ͷG4 
  13. ϝλσʔλͷ׆༻ (forteeະରԠ) • ύεͷϝλσʔλΛద੾ʹઃఆ͢Δͱ΢ΥϨοτ͕ΑΓศརʹ • Πϕϯτ։࠵ؒࡍͷ௨஌ • ΠϕϯτऴྃޙʹύεΛظݶ੾Εʹ • ։࢝࣌ؒɾձ৔ͷ྆ํʹ͍ۙͮͨΒiPhoneͷϩοΫը໘ʹύεΛදࣔ

    • etc  https://developer.apple.com/documentation/walletpasses/supporting-semantic-tags-in-wallet-passes https://developer.apple.com/documentation/walletpasses/showing-a-pass-on-the-lock-screen https://developers.google.com/wallet/tickets/events/use-cases/upcoming-noti fi cation
  14. ൺֱ  "QQMF΢ΥϨοτ (PPHMF΢ΥϨοτ ɾෳ਺ɻʮͦͷଞʯ͋Γ ύεͷछผ ɾෳ਺ɻʮͦͷଞʯ͋Γ ࢀՃऀຖʹಠཱ ύεͷ৘ใ ࢀՃऀڞ௨߲໨͋Γ

    QLQBTTϑΝΠϧΛ࡞੒ ύεͷ৽نొ࿥ 1045"1* ෳࡶ ύεͷߋ৽ 1651"5$)"1*Λୟ͚ͩ͘ ύε಺ʹ௚઀֨ೲ ϩʔΧϧͰ։ൃ͠΍͍͢ ը૾ 63-ࢦఆ ʢϩʔΧϧͰ։ൃ͠ʹ͍͘ʣ ༗ྉ˞ අ༻ ແྉ ͳ͠ ৹ࠪ ॳظಋೖ࣌͋Γ ※1: Apple Developer Programʹطʹೖ͍ͬͯΕ͹࣮࣭ແྉ ಉ͡ ҧ͍༗ ҧ͍େ
  15. ิ଍) εϚʔτ΢Υον΁ͷอଘํ๏ • Apple Watch • WebαΠτ͔ΒύεΛ௥Ճ͢Δ৔߹ɿiPhoneܦ༝ • ϝʔϧ΍ϝοηʔδ͔ΒύεΛ௥Ճ͢Δ৔߹ɿ௚઀ •

    Wear OS εϚʔτ΢Υον • AndroidεϚʔτϑΥϯܦ༝  https://support.apple.com/ja-jp/guide/watch/apd4362807a0/watchos https://support.google.com/googlepixelwatch/answer/14260807? hl=ja&ref_topic=12652267&sjid=11192229721491948574-AP
  16. ิ଍) JWT • JSON Web TokensͷུɻRFC 7519Ͱఆٛ͞Εͨܗࣜ • ίϯύΫτͰURLηʔϑ •

    υοτͰ۠੾ΒΕͨϔομʔ / ϖΠϩʔυ / ॺ໊͔ΒͳΔจࣈྻ • ϖΠϩʔυ • JSONܗࣜͷύεΫϥεɾΦϒδΣΫτΛbase64Τϯίʔυ 
  17. ิ଍) PKCS #7 • PKCS (Public Key Cryptography Standardsɺެ։伴҉߸ඪ४) ͷ7൪໨

    • σʔλͷ҉߸Խ΍ॺ໊ʹ࢖ΘΕΔRFC 2315Ͱఆٛ͞Εͨܗࣜ • ॺ໊σʔλͷܗࣜʹ͸3ύλʔϯ͋Δ 
  18. ิ଍) ॺ໊σʔλͷܗࣜ • ෼཭(Detached)ܗࣜ ← Apple΢ΥϨοτͰ࢖༻ • ॺ໊ର৅σʔλ͔Βಠཱͯ͠ॺ໊σʔλΛ࡞੒͢Δܗࣜ • ిࢠॺ໊͞ΕͨϝʔϧΛS/MIMEඇରԠͷϝʔϥʔͰ΋ಡΈऔΕΔΑ͏ʹ͢Δ໨తͳͲͰ࢖༻

    • ಺แ(Enveloping)ܗࣜ • ॺ໊σʔλͷதʹॺ໊ର৅σʔλΛ֨ೲ͢Δܗࣜ • แؚ(Enveloped)ܗࣜ • ॺ໊ର৅σʔλͷதʹॺ໊σʔλΛ֨ೲ͢Δܗࣜ 
  19. ᶃ forteeͰͷ࣮૷ํ਑ • ඞਢ • ड෇༻QRίʔυ • νέοτ൪߸ (QRίʔυΛಡΊͳ͍ ࣌ͷর߹༻)

     • ΍Βͳ͍ • ύεʹຒΊࠐΜͩΧϯϑΝϨϯεɾ Πϕϯτ৘ใͷߋ৽ • νέοτൢചΛ։࢝͢Δࠒʹ͸֬ ఆ͍ͯ͠Δ͸ͣ • ؤுͬͯ͸΍Βͳ͍ • ύεʹຒΊࠐΜͩνέοτࢀՃऀ৘ ใͷมߋͷߋ৽