MikaAir LIGHTNESSCapability Book
目次を開く

F BUS / 実装状態は正本registryから生成

F1_Auth / Auth

人の同一性を確定し、認証と認可を分ける入口。

訪問者が同一オリジンの return_to を伴う magic link を要求し、サーバー検証済みセッションとして戻る。

入力 → 状態 → 出力

線形テキスト代替: Action Registryが検証したpayloadをengineへ渡す。engineはこの器官のdurable state sliceを更新し、resultまたはerrorをAction Coreへ返す。光は実行中、琥珀の境界はarmed状態、外縁はこの器官の作用半径を表す。
  1. 入力validated JSON payload
  2. 状態engine-owned durable slice
  3. 承認必要な外部 / 不可逆操作だけ
  4. 出力result / receipt / explicit error
  5. 回復emailを保持したまま error から再送できる。allowlist不一致は unauthorized として残り、再ログインで隠さない。
2 registered actionsnone dependencies(D5.2 decision required) binding reference

保存状態はAction Coreのfilesystem state store内の capabilities sliceとして再起動可能なplain dataで保持される。functionや秘密値をstateへ保存しない。

全Action

以下はAction Registryに実在するF1_Authの全actionである。クリックでpayload境界、状態、出力、回復を開ける。

capability.auth.configureConfigure authlocal or validated transition
payload
provider
状態
state transition defined by the capability engine
result
Capability engine の ok result、または明示的な validation / provider error。plan・receipt・stateは持続sliceへ返る。
recovery
error codeと状態を残し、必要に応じて再計画・再承認・retryへ戻る。
capability.auth.signinSign in capabilitylocal or validated transition
payload
identity
状態
state transition defined by the capability engine
result
Capability engine の ok result、または明示的な validation / provider error。plan・receipt・stateは持続sliceへ返る。
recovery
error codeと状態を残し、必要に応じて再計画・再承認・retryへ戻る。

Capability Spec

F1 Auth — Capability Spec

Provider-independent authentication capability for MikaAir LIGHTNESS and bound MikaAirWeb sites.

Purpose

Establish identity for a human visitor, restore sessions across visits, and expose an explicit server-verified authorization boundary separate from authentication.

States

StateMeaning
unknownSession not yet resolved (initial load).
loadingSession resolution or auth action in flight.
signed_outNo verified session.
link_sendingMagic-link / OTP dispatch in progress.
link_sentDispatch succeeded; email retained for recovery.
signed_inVerified session and authorization passed.
signing_outLogout in progress.
errorRecoverable failure; email retained when applicable.
unauthorizedVerified identity exists but allowlist authorization failed.

Session Shape

{
  "userId": "string",
  "email": "string",
  "displayName": "string | null",
  "issuedAt": "ISO-8601",
  "expiresAt": "ISO-8601 | null",
  "provider": "string"
}

Sessions are verified only on the server. Client-visible state is derived from server responses, never from localStorage trust.

Actions

ActionFrom statesTo states
resolve_sessionunknownloadingsigned_out \signed_in \unauthorized \error
send_magic_linksigned_out, errorlink_sendinglink_sent \error
complete_callbacksigned_out, loadingloadingsigned_in \unauthorized \error
sign_outsigned_in, unauthorizedsigning_outsigned_out \error

Authorization Boundary

Authentication proves identity. Authorization is a separate server-side allowlist check.

  • Env name: MIKAAIR_AUTH_ALLOWED_EMAILS
  • Format: comma-separated email addresses, case-insensitive match after trim
  • Empty or unset allowlist: no authenticated user is authorized

Error Contract

CodeRecoverableMeaning
config_missingnoRequired env names are absent at runtime.
invalid_emailyesEmail failed validation.
link_send_failedyesProvider rejected magic-link dispatch.
callback_invalidyesCallback token or code could not be verified.
session_expiredyesSession could not be restored or refreshed.
not_authorizedyesIdentity verified but not on allowlist.
provider_erroryesProvider returned an unexpected error.

Errors expose code, message, and optional email for recovery. Secret values must never appear in errors or logs.

Environment Names (values never in repo)

NameRole
SUPABASE_URLProvider API base URL
SUPABASE_PUBLISHABLE_KEYClient-safe key for OTP / magic-link lane
SUPABASE_SECRET_KEYServer-only elevated key when required by binding
MIKAAIR_AUTH_ALLOWED_EMAILSAuthorization allowlist
MIKAAIR_AUTH_SITE_URLCanonical same-origin site URL for return/callback
MIKAAIR_AUTH_ACCESS_COOKIEAccess token cookie name override
MIKAAIR_AUTH_REFRESH_COOKIERefresh token cookie name override

Lifecycle / Return URL Rules

  • return_to must be same-origin relative path starting with /
  • Paths /auth/login, /auth/callback, /auth/sign-out are reserved
  • Protocol-relative, absolute off-origin, and // paths are rejected to /
  • Callback completes on server, then redirects to sanitized return_to

Provider Binding

F1 does not choose a provider. Binding manifests reference an approved D BUS adapter. Current reference adapter: MikaAirWeb/D_BUS_Dynamic_Capability/adapter_library/supabase/auth/.

binding / secret boundary

provider設定はbinding templateから参照する。環境変数は名前だけを扱い、値はsource repository・画面・reportに書かない。

環境変数名扱い
SUPABASE_URLconfiguration reference — 値は表示・保存しない
SUPABASE_PUBLISHABLE_KEYconfiguration reference — 値は表示・保存しない
SUPABASE_SECRET_KEYsecret reference — 値は表示・保存しない
MIKAAIR_AUTH_ALLOWED_EMAILSconfiguration reference — 値は表示・保存しない
MIKAAIR_AUTH_SITE_URLconfiguration reference — 値は表示・保存しない
MIKAAIR_AUTH_ACCESS_COOKIEconfiguration reference — 値は表示・保存しない
MIKAAIR_AUTH_REFRESH_COOKIEconfiguration reference — 値は表示・保存しない

emailを保持したまま error から再送できる。allowlist不一致は unauthorized として残り、再ログインで隠さない。

source trace

../MikaAir LIGHTNESS/F_BUS_Capability/F1_Auth/spec/capability_spec.md 08ed02b5c5d3
../MikaAir LIGHTNESS/F_BUS_Capability/F1_Auth/binding/binding_manifest.template.json 2277714a482e
../MikaAir LIGHTNESS/F_BUS_Capability/F1_Auth/agent.md c59f1b3fc373
../MikaAir LIGHTNESS/F_BUS_Capability/runtime_bridge.mjs 7e7384638a41
../MikaAir LIGHTNESS/F_BUS_Capability/action_surface.mjs e5bae5f48648
../MikaAir LIGHTNESS/A_BUS_Action_Core/A2_State_Store/filesystem_store.mjs b1cc32d3f456
../MikaAir LIGHTNESS/F_BUS_Capability/F1_Auth/contract/index.mjs 7e16210a168e