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
250
サプライチェーン攻撃に備える
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
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
580
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
810
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
型で語るカタ
irof
0
530
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
280
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
280
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
590
AI時代の『改訂新版 良いコード/悪いコードで学ぶ設計入門』 / ai-good-code-bad-code
minodriven
22
9k
What's new in AppKit on macOS 26
1024jp
0
140
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
1
6.7k
AI時代のソフトウェア開発を考える(2025/07版) / Agentic Software Engineering Findy 2025-07 Edition
twada
PRO
97
34k
チームで開発し事業を加速するための"良い"設計の考え方 @ サポーターズCoLab 2025-07-08
agatan
1
450
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
A Tale of Four Properties
chriscoyier
160
23k
The Cost Of JavaScript in 2023
addyosmani
51
8.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
138
34k
How STYLIGHT went responsive
nonsquared
100
5.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
970
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