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
RyuNen344
December 08, 2023
Programming
2
1.7k
Firebase Hostingを使ってPasskeyをandroidアプリで試してみよう
RyuNen344
December 08, 2023
Tweet
Share
More Decks by RyuNen344
See All by RyuNen344
WindowInsetsだってテストしたい
ryunen344
1
240
サプライチェーン攻撃に備える
ryunen344
0
2.5k
Okioに愛を込めて
ryunen344
3
2.3k
Xcode Meets Gradle
ryunen344
0
350
わかった気になる、Coroutine1.7.0のチャンネルのパフォーマンス向上
ryunen344
0
390
K/NとNSKeyedArchiverと私
ryunen344
0
520
ComposeのModalBottomSheetは (まだ)沼
ryunen344
1
1.8k
うわっ…もしかして私のコー ド、遅すぎ…?
ryunen344
1
930
K/NでCryptoKit使いたかった
ryunen344
0
470
Other Decks in Programming
See All in Programming
AIと”コードの評価関数”を共有する / Share the "code evaluation function" with AI
euglena1215
1
170
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
2
150
dbt民主化とLLMによる開発ブースト ~ AI Readyな分析サイクルを目指して ~
yoshyum
3
1.1k
脱Riverpod?fqueryで考える、TanStack Queryライクなアーキテクチャの可能性
ostk0069
0
270
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
550
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
410
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
180
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
2
640
Deep Dive into ~/.claude/projects
hiragram
14
2.6k
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
1
440
チームのテスト力を総合的に鍛えて品質、スピード、レジリエンスを共立させる/Testing approach that improves quality, speed, and resilience
goyoki
5
940
Hack Claude Code with Claude Code
choplin
5
2.3k
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
Embracing the Ebb and Flow
colly
86
4.7k
Bash Introduction
62gerente
613
210k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
What's in a price? How to price your products and services
michaelherold
246
12k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Become a Pro
speakerdeck
PRO
29
5.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
Art, The Web, and Tiny UX
lynnandtonic
299
21k
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