Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Firebase Hostingを使ってPasskeyをandroidアプリで試してみよう
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
RyuNen344
December 08, 2023
Programming
2
2k
Firebase Hostingを使ってPasskeyをandroidアプリで試してみよう
RyuNen344
December 08, 2023
Tweet
Share
More Decks by RyuNen344
See All by RyuNen344
せめて、ネイティブらしく
ryunen344
2
1.2k
Cache Me If You Can
ryunen344
3
8.2k
WindowInsetsだってテストしたい
ryunen344
2
340
サプライチェーン攻撃に備える
ryunen344
1
3.2k
Okioに愛を込めて
ryunen344
3
2.7k
Xcode Meets Gradle
ryunen344
0
400
わかった気になる、Coroutine1.7.0のチャンネルのパフォーマンス向上
ryunen344
0
420
K/NとNSKeyedArchiverと私
ryunen344
0
580
ComposeのModalBottomSheetは (まだ)沼
ryunen344
1
1.9k
Other Decks in Programming
See All in Programming
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
React Native × React Router v7 API通信の共通化で考えるべきこと
suguruooki
0
100
Apache Iceberg V3 and migration to V3
tomtanaka
0
170
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
SourceGeneratorのススメ
htkym
0
200
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
230
AgentCoreとHuman in the Loop
har1101
5
240
Package Management Learnings from Homebrew
mikemcquaid
0
230
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
210
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
330
2026年 エンジニアリング自己学習法
yumechi
0
140
Featured
See All Featured
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
440
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
The Cult of Friendly URLs
andyhume
79
6.8k
Chasing Engaging Ingredients in Design
codingconduct
0
110
Facilitating Awesome Meetings
lara
57
6.8k
The untapped power of vector embeddings
frankvandijk
1
1.6k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
68
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
240
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3k
Marketing to machines
jonoalderson
1
4.6k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
780
Transcript
Firebase Hostingを使ってPasskeyを androidアプリで試してみよう Bunjiro Miyoshi(RyuNen344) GDG DevFest Tokyo 2023
About Me • RyuNen344 • Kotlin Multiplatform(KMM/KMP)好き • 特技はKotlin/NativeでObj-Cを書くこと •
Gradleは友達, コワクナイ
Agendas 1. What is Passkey 2. Minimum requirements for practicing
Passkey 3. Setup Firebase Hosting 4. Practice androidx.CredentialManager
What is Passkey • FIDO2を使って同一エコシステム上であればキーが同期される規格 • FIDO ◦ 専用デバイスの公開鍵と署名をやりとりすることで認証する •
FIDO2 ◦ 認証器がより柔軟になった(端末認証, 生体認証が利用可) ◦ WebAuthnは柔軟にするために使われている規格(Web API)
What is Passkey • DevFest & Android Dev Summit Japan
2022のえーじさんによるセッショ ンも非常にわかりやすいのでおススメ • サービスへの組み込み方は👇がおススメ ◦ Android Developers ▪ https://developer.android.com/design/ui/mobile/guides/p atterns/passkeys ◦ DroidKaigi 2023 ▪ 様々なユースケースに利用できる "パスキー" の導入事例の紹介と UXの課題解説/ritou
Supported Services • いろいろな会社/サービスが続々サポートし始めている ◦ DocuSign ◦ Google ◦ カヤック
◦ メルカリ ◦ NTT ドコモ ◦ PayPal ◦ Shopify ◦ LINEヤフー(旧:Yahoo! JAPAN) ◦ GitHub ◦ Amazon ◦ etc…. https://developers.google.com/identity/passkeys#relying-parties
Minimum requirements for practicing Passkey • ローカル認証(生体認証, 知識認証)を有効化している端末 • android14
device or androidx.CredentialManager • Digital Asset Links • WebAuthn:PublicKeyCredentialCreationOptionsJSON/PublicKe yCredentialRequestOptionsJSON
About androidx.CredentialManager • 2023年11月1日に1.2.0(初めてのstable🎉)がリリース • android14に追加されたCredentialManagerをAndroid4.4から使用で きるようにする • Passkeyはandroid9以降のみ, それ以下はパスワードとSign
in with googleのみ
About androidx.CredentialManager • Intent引き回し芸を内部でやってくれるので使わない手はない • Smart Lock for Passwords, FIDO2(play-services-fido)を使用して
いるアプリは移行してあげるとよい ◦ アプリで検出不能なFIDO認証情報(物理的なセキュリティキー)を使 用する必要がある場合はまだfidoで行なう必要ある
About Digital Asset Links • 雑に言うと$domain/.well-known/assetlink.jsonのこと 👉つまりドメインを確保してjsonを配置しなければならない
About Digital Asset Links • 雑に言うと$domain/.well-known/assetlink.jsonのこと 🤔Firebase周りで見かけたことあるな
About Digital Asset Links • Firebase Dynamic Links(以降FDL)をつかうと見かける ◦ FDLはサービスシャットダウンがアナウンスされている🥺
• 実はFDLのmigration guideが公開されている ◦ https://firebase.google.com/support/guides/app-links-uni versal-links ◦ その中でFirebase Hostingに移行するセクションがある 😎Firebase Hostingつかおう
Setup Firebase Hosting 1. Firebase Projectをつくる 2. Firebase CLIをインストールしてセットアップする 3.
assetlink.jsonを作る 4. WebAuthnのjsonを作る 5. Firebase Hostingにdeployする
Setup Firebase Hosting 1. Firebase Projectをつくる 2. Firebase CLIをインストールしてセットアップする 3.
assetlink.jsonを作る 4. WebAuthnのjsonを作る 5. Firebase Hostingにdeployする 公式サイト通りなので割愛 https://firebase.google.com/docs/cli
Setup Firebase Hosting 1. Firebase Projectをつくる 2. Firebase CLIをインストールしてセットアップする 3.
assetlink.jsonを作る 4. WebAuthnのjsonを作る 5. Firebase Hostingにdeployする
Create AssetLink.json
Create AssetLink.json targetがドメインをどう扱って良いかを宣言する Passkeyを実装するためには👇両方必要 1. handle_all_urls(URLを処理する) 2. get_login_creds(認証情報を取り扱う)
Create AssetLink.json package_nameにはapplicationIdを指定する sha256_cert_fingerprintsはkeytoolsかapksignerを使って確認すると早い
Setup Firebase Hosting 1. Firebase Projectをつくる 2. Firebase CLIをインストールしてセットアップする 3.
assetlink.jsonを作る 4. WebAuthnのjsonを作る 5. Firebase Hostingにdeployする
Create json for WebAuthn • Passkeyを試すための最小限必要なjsonは👇の2つ a. PublicKeyCredentialCreationOptionsJSON ▪ キー生成をするためのjson
▪ https://w3c.github.io/webauthn/#dictdef-publickeycrede ntialcreationoptionsjson b. PublicKeyCredentialRequestOptionsJSON ▪ 生成済みのキーを取得するためのjson ▪ https://w3c.github.io/webauthn/#dictdef-publickeycrede ntialrequestoptionsjson
PublicKeyCredentialCreationOptions
PublicKeyCredentialCreationOptions RP(Relying Party)にはFirebase Hostingで作ったドメインを指定する
PublicKeyCredentialCreationOptions user, challengeは本来動的に生成するもの(*今回は横着して固定値)
PublicKeyCredentialCreationOptions authenticatorSelection.authenticatorAttachmentの値で挙動が変わる platform: 現在のデバイスを登録 cross-platform: 多要素認証を登録する(のでPasskey文脈では使われない) null: ユーザーが希望するデバイスを登録
PublicKeyCredentialRequestOptions
PublicKeyCredentialRequestOptions RP(Relying Party)にはFirebase Hostingで作ったドメインを指定する challengeは本来動的に生成するもの(*今回は横着して固定値)
Setup Firebase Hosting 1. Firebase Projectをつくる 2. Firebase CLIをインストールしてセットアップする 3.
assetlink.jsonを作る 4. WebAuthnのjsonを作る 5. Firebase Hostingにdeployする
Setup Firebase Hosting 1. Firebase Projectをつくる 2. Firebase CLIをインストールしてセットアップする 3.
assetlink.jsonを作る 4. WebAuthnのjsonを作る 5. Firebase Hostingにdeployする 😎firebase deployを実行するだけ
Practice androidx.CredentialManager 1. update gradle dependency 2. implement with CredentialManager
Practice androidx.CredentialManager 1. update gradle dependency 2. implement with CredentialManager
Update gradle dependency play-servicesの認証情報を使う場合は credentials-play-services-authも追加でimplementationする
Practicing androidx.CredentialManager 1. update gradle dependency 2. implement with CredentialManager
Implement with CredentialManager 😎あとは基本公式どおり・・・・だけど
Implement with CredentialManager
Implement with CredentialManager WebAuthn用のjsonをHttpClient等で取得して渡す
😎Ready for Passkey 😎動的なバックエンド実装を用意するならCloud Functionsを使うとよい
References • https://developer.android.com/training/sign-in/passkeys • https://developers.google.com/identity/passkeys • https://developers.google.com/digital-asset-links • https://www.youtube.com/watch?v=TWlZzPrlFYA •
https://github.com/android/identity-samples • https://github.com/android/codelab-fido2 • https://github.com/google/webauthndemo
EOF