-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Supabase のセッション保存・復元処理を自前で実装 #111
Conversation
WalkthroughKotlinプロジェクトにおいて、マルチプラットフォーム設定とコルーチンに関連する機能が追加されました。具体的には、依存関係に Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (2)
- core/network/build.gradle.kts (1 hunks)
- core/network/src/commonMain/kotlin/club/nito/core/network/SupabaseClient.kt (2 hunks)
Files skipped from review due to trivial changes (1)
- core/network/build.gradle.kts
Additional comments: 2
core/network/src/commonMain/kotlin/club/nito/core/network/SupabaseClient.kt (2)
39-39:
NitoSettingsSessionManager
クラスはprivate
として宣言されていますが、これはこのクラスがファイル内でのみ使用されることを意味します。他の場所でこのクラスが必要な場合は、アクセス修飾子を適切に変更する必要があります。40-40:
ExperimentalSettingsApi
へのOptIn
は、APIがまだ実験的であることを示しています。将来的にAPIが変更される可能性があるため、このAPIに依存するコードは注意して使用する必要があります。
@@ -15,8 +23,43 @@ internal fun createNitoSupabaseClient( | |||
supabaseKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imd0Zmp1a3JhdXlocmJnbHJ6bHZhIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTkwMDQ3NTgsImV4cCI6MjAxNDU4MDc1OH0.zRjlzXVyz4vBM8Tb8GcpyPyTkCmOwdV-Xs18Agw2w-E", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ハードコードされた supabaseKey
はセキュリティリスクを引き起こす可能性があります。これが実際のキーである場合、環境変数や設定ファイルから読み込むように変更することを検討してください。
override suspend fun saveSession(session: UserSession) { | ||
suspendSettings.putString(SETTINGS_KEY, nitoJsonSettings.encodeToString(session)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saveSession
メソッドにはエラーハンドリングがありません。putString
操作が失敗した場合に備えて、エラーハンドリングを追加することを検討してください。
@OptIn(ExperimentalSettingsApi::class)
override suspend fun saveSession(session: UserSession) {
try {
suspendSettings.putString(SETTINGS_KEY, nitoJsonSettings.encodeToString(session))
} catch (e: Exception) {
Logger.e(e) { "Failed to save session" }
}
}
Issue
概要
expiresAt が正しく復元されずリフレッシュが動作しない状態だったため、Supabase のセッション保存・復元処理を自前で実装します。
レビュー観点
特になし
レビューレベル
レビュー優先度
参考リンク
スクリーンショット
Summary by CodeRabbit
NitoSettingsSessionManager
クラスが追加されました。