Skip to content

feat: サインアウト時のサーバー側トークン失効に対応 - #49

Merged
LibraryLibrarian merged 13 commits into
developfrom
feature/token-revocation
Oct 6, 2026
Merged

LibraryLibrarian merged 13 commits into
developfrom
feature/token-revocation

Conversation

@LibraryLibrarian

Copy link
Copy Markdown
Owner

概要

Misskey 2026.9.0 で、アプリのアクセストークン(MiAuth / OAuth)が /api/i/revoke-token で自身を失効できるようになったことへの対応。signOut / signOutAll が既定でサーバー上のトークンを失効させてから端末上のトークンを削除する形に変更し、単独で失効させるための MisskeyTokenRevocationClient を追加。

変更内容

  • MisskeyTokenRevocationClient を追加
    • revoke は例外を投げず、TokenRevocationResult(revoked / alreadyInvalid / unsupported / failed)を返す
    • 分類は HTTP ステータスと Misskey のエラーコードで判定(204 → revoked、401 AUTHENTICATION_FAILED → alreadyInvalid、400 ACCESS_DENIED と 404 → unsupported、それ以外 → failed)。本文が不正な JSON の場合もステータスで分類
    • 再試行なし。任意の timeout は、注入された Dio のインターセプターを含むリクエスト全体の期限
    • 結果の詳細・エラーコードにトークンを含めない(サーバーやインターセプターが返した文言も伏せる)
  • MisskeyAuthManager.signOut / signOutAll に mode(SignOutMode)と timeout を追加
    • revokeAndDelete(既定): 失効を試み、結果にかかわらず端末から削除
    • revokeOrKeep: 失効を確認できた場合のみ削除。unsupported / failed は残す
    • localOnly: 失効せずに削除(従来の挙動)
    • 未保存・読み出せないトークンは失効せずに削除
    • 失効中に同じアカウントへ保存し直されたトークンは削除しない
    • signOutAll は全アカウントを並列に失効させ、timeout は呼び出し時点からの共通の期限。結果は一覧の順で返し、削除はすべて試みてから最初のエラーを投げる
    • 戻り値を SignOutResult / List<SignOutResult> に変更
    • コンストラクタに revocation を追加。既定ではマネージャーの dio を使う
  • SecureTokenStore.list が、読み出せないトークンがあっても例外を投げないよう修正(メタ情報なしで一覧に含める)
  • example のアカウント削除で、unsupported / failed のときに SnackBar を表示(6言語)
  • docs(6言語)と README(6言語)に失効の仕様・移行方法を追記
  • CHANGELOG.md の [Unreleased] に追記。既定で失効する点と戻り値の型の変更は **Breaking:**

確認

  • dart format --output=none --set-exit-if-changed . / dart analyze --fatal-infos
  • flutter test(ルート 166件、example 9件)
  • flutter pub publish --dry-run(警告 0 件)
  • docs のビルド(6言語)

LibraryLibrarian and others added 13 commits October 2, 2026 02:56
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@LibraryLibrarian
LibraryLibrarian merged commit f88f154 into develop Oct 6, 2026
11 checks passed
@LibraryLibrarian
LibraryLibrarian deleted the feature/token-revocation branch October 6, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant