Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
EncryptedSharedPreferenceの後継OSSライブラリDataStore C...
Search
ichimura
November 15, 2025
0
100
EncryptedSharedPreferenceの後継OSSライブラリDataStore Cryptoを紹介
ichimura
November 15, 2025
Tweet
Share
More Decks by ichimura
See All by ichimura
Google/IO 2025 "Build adaptive Android apps that shine across form factors"の紹介
ichir438
0
270
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.4k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
51
43k
Are puppies a ranking factor?
jonoalderson
0
2.4k
Paper Plane
katiecoart
PRO
0
44k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
210
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
410
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
400
A designer walks into a library…
pauljervisheath
210
24k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
31
Designing for Timeless Needs
cassininazir
0
93
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.4k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Transcript
EncryptedSharedPreferenceの 後継OSSライブラリ DataStore Cryptoを紹介
DataStore Cryptoとは EncryptedSharedPreferenceの後継として今年9月に公開したOSSライブラリ https://github.com/cybozu/datastore-crypto
Encrypted SharedPreferences とは • Androidアプリ開発お馴染みのSharedPreferencesが保存する データを暗号化・複合化してくれるライブラリ • 端末に保存する機密データの漏洩リスクを軽減できる • ただし、現在はdeprecatedになっている
→ 使いたいのでDataStore Cryptoを作りました!
なぜDeprecatedになった? 今年のDroidKaigiでYuki Anzaiさんが同内容のセッションで紹介されていました!
Deprecatedの理由をざっくり紹介 • ライブラリの動作が不安定になってきた • リスクの高いデータはそもそもデバイスに保存しない設計にすべき • AndroidOSはファイルベースの暗号化とサンドボックスモデル によって十分保護されている • OS保護以上のセキュリティを担保したい場合は、
そのプロセスを完全に理解して制御しよう
Q: Deprecatedの理由を分かった上でなぜ必要なのか A: 既にEncryptedSharedPreferenceが組み込まれたプロダクトは代替手段が必要
Q: ちなみにどんなデータを保護したい? • 認証関連のトークン類(これがメイン) • ユーザーに関連する秘密情報 など
DataStoreCryptoの概要 • EncryptedSharedPreferenceの暗号化・複合化機構(Tink)をDataStoreに移植 • 使用者は普通のDataStoreと同じ要領で実装できる
DataStore Cryptoをプロダクトに組み込む デリゲートプロパティの宣言
DataStore Cryptoをプロダクトに組み込む (2/2) 書き込み関数の例
DataStore Cryptoをプロダクトに組み込む 読み取り関数の定義の例
EncryptedSharedPreferenceからの移行 datastoreがsharedPreferenceから移行するマイグレーション機能を活用できる
まとめ • DataStoreCryptoは保存データの暗号化、複合化機能を提供 • 使用感はほぼDataStoreと同様 • EncryptedSharedPreferenceからのマイグレーションも可能