Добавлено локальное хранение токена авторизации#149
Open
Gaileks wants to merge 1 commit into
Open
Conversation
- Добавлены core-модули datastore-api и datastore-impl - Добавлен TokenDataStore для работы с accessToken - Реализовано сохранение accessToken через Preferences DataStore - Добавлено чтение сохранённого accessToken - Добавлена очистка accessToken при logout - Добавлен corruptionHandler для DataStore - Добавлена DI-регистрация DataStore и TokenDataStore - datastoreModule подключён в Application - TokenDataStore подключён в LoginRepositoryImpl - После успешной авторизации accessToken сохраняется локально - Добавлен CheckAuthStateUseCase для проверки авторизованного состояния - Добавлен LogoutUseCase для очистки токена
aix-17
reviewed
May 29, 2026
| * - очищает токены авторизации | ||
| */ | ||
| class TokenDataStoreImpl( | ||
| private val dataStore: DataStore<Preferences>, |
Collaborator
There was a problem hiding this comment.
У нас в приложении в манифесте включен бэкап, куда бэкапятся также shared preferences. Это риск. И в целом я думаю было бы безопаснее юзать для хранения такого токена что-то другое, вот из доков:
To back up user credentials and authentication tokens, don't store them in shared preferences or a file. Instead use Block Store APIs to store and manage credentials. This helps ensure that they are securely stored and can be backed up and restored alongside other app data.
Collaborator
There was a problem hiding this comment.
Немного неправильно выражаюсь - у тебя же не shared preferences, а datastore. Datastore держит данные в файлике, по дефолту он без шифрования
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧩 Что сделано:
Реализовано локальное хранение accessToken через DataStore:
• Добавлены core-модули datastore-api и datastore-impl
• Добавлен TokenDataStore для работы с accessToken
• Реализовано сохранение accessToken
• Реализовано чтение сохранённого accessToken
• Реализована очистка accessToken при logout
• Добавлен corruptionHandler для DataStore
• После успешной авторизации accessToken сохраняется локально
UseCase:
• Добавлен CheckAuthStateUseCase для проверки авторизованного состояния
• Добавлен LogoutUseCase для очистки токена при logout
DI:
• Добавлена регистрация Preferences DataStore
• Добавлена регистрация TokenDataStore
• datastoreModule подключён в Application
• TokenDataStore подключён в LoginRepositoryImpl
🗂 Затронутые модули:
• core:datastore-api
• core:datastore-impl
• feature:authentication:impl
• app