The person may enter an account label and query passkey availability. The label is explicitly unverified user input. A supported secure host may help satisfy a prerequisite, but the account selector still returns Deny because no server has verified a session.
ProtectedRoute constructs the denied branch without constructing account content. This is a real presentation boundary, not a button which toggles a fake signed-in flag. The incomplete integration deliberately has no path which grants account access.
{"id":"fission-tabs-1","tabs":[{"index":0,"label":"src/app.rs","value":"src-app-rs"},{"index":1,"label":"src/app/state.rs","value":"src-app-state-rs"},{"index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"},{"index":3,"label":"src/app/routes.rs","value":"src-app-routes-rs"},{"index":4,"label":"src/i18n.rs","value":"src-i18n-rs"},{"index":5,"label":"src/lib.rs","value":"src-lib-rs"},{"index":6,"label":"preview/lib.rs","value":"preview-lib-rs"},{"index":7,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"},{"index":8,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}]}
{"id":"fission-tabs-1","index":0,"label":"src/app.rs","value":"src-app-rs"}
mod routes;
mod screen;
pub mod state;
pub use routes::AccountApp;
pub use state::{route_changed, AccountState};
{"id":"fission-tabs-1","index":1,"label":"src/app/state.rs","value":"src-app-state-rs"}
use fission::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct AccountState {
pub locale: Locale,
pub current_path: String,
pub account_label: String,
pub pending: bool,
pub message_key: String,
pub diagnostic: Option<String>,
}
impl Default for AccountState {
fn default() -> Self {
Self {
locale: Locale::from("en-US"),
current_path: "/".into(),
account_label: String::new(),
pending: false,
message_key: "check.ready".into(),
diagnostic: None,
}
}
}
impl GlobalState for AccountState {}
pub fn check_host(state: &mut AccountState, cx: &mut ReducerContext<AccountState>) {
if state.pending {
return;
}
state.pending = true;
state.message_key = "check.pending".into();
state.diagnostic = None;
let ok = cx.effects.bind(HostChecked, reduce_with!(host_checked));
let err = cx
.effects
.bind(HostCheckFailed, reduce_with!(host_check_failed));
cx.effects.passkeys().availability().on_ok(ok).on_err(err);
}
#[fission_reducer(HostChecked)]
fn host_checked(state: &mut AccountState, cx: &mut ReducerContext<AccountState>) {
state.pending = false;
match cx.input.capability_ok(GET_PASSKEY_AVAILABILITY) {
Some(value) => {
state.message_key = if value.supported && value.secure_context {
"check.available"
} else {
"check.unavailable"
}
.into();
state.diagnostic = Some(format!("{value:?}"));
}
None => state.message_key = "check.invalid".into(),
}
}
#[fission_reducer(HostCheckFailed)]
fn host_check_failed(state: &mut AccountState, cx: &mut ReducerContext<AccountState>) {
state.pending = false;
match cx.input.capability_error(GET_PASSKEY_AVAILABILITY) {
Some(error) => {
state.message_key = if error.code == "unsupported" {
"check.unavailable"
} else {
"check.failed"
}
.into();
state.diagnostic = Some(format!("{}: {}", error.code, error.message));
}
None => state.message_key = "check.invalid".into(),
}
}
pub fn route_changed(
state: &mut AccountState,
action: fission::core::action::ShellRouteChanged,
_cx: &mut ReducerContext<AccountState>,
) {
state.current_path = action.location.pathname;
}
// There is no session-verification service in this example. Host support is
// never an authorization input. The unfinished integration must fail closed.
pub fn account_route_decision(_state: &AccountState) -> RouteDecision {
RouteDecision::Deny
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn support_or_an_entered_account_cannot_authorize_access() {
let mut state = AccountState::default();
state.account_label = "[email protected]".into();
state.message_key = "check.available".into();
assert!(matches!(
account_route_decision(&state),
RouteDecision::Deny
));
}
}
{"id":"fission-tabs-1","index":2,"label":"src/app/screen.rs","value":"src-app-screen-rs"}
use super::state::{check_host, AccountState};
use fission::prelude::*;
fission_component! {
pub SignInScreen<AccountState> {}
view(_screen, state, cx) {
let tokens = &cx.view.env().theme.tokens;
} => Column(gap: tokens.spacing.m, children: [
Text(cx.tr("account.sign_in")).size(tokens.typography.heading2_size),
Text(cx.tr("account.blocked")),
FormControl(
label: Some(cx.tr("account.label")),
helper: Some(cx.tr("account.label_help")),
child: TextInput(value: state.account_label.clone(), bind(on_input): to(state.account_label),
keyboard_type: TextInputType::EmailAddress),
),
if !state.account_label.trim().is_empty() {
Text(cx.tr("account.entered").replace("{account}", state.account_label.trim()))
},
Button(child: Text(cx.tr("check.request")), key: "check-host", disabled: state.pending,
on_press: reduce { check_host(state, cx); }),
if state.pending {
Spinner(motion: Some(SpinnerMotion::Default), label: Some(cx.tr("check.pending")))
},
Text(cx.tr(&state.message_key)),
if let Some(details) = &state.diagnostic { Code(text: details.clone()) },
Button(child: Text(cx.tr("account.inspect_route")), key: "inspect-account",
on_press: reduce { cx.effects.navigate("/account"); }),
Text(cx.tr("account.no_authentication")).color(tokens.colors.text_secondary),
])
}
fission_component! {
pub AccountContent<AccountState> {}
view(_account, _state, cx) => Text(cx.tr("account.protected_placeholder"))
}
fission_component! {
pub AccountBlocked<AccountState> {}
view(_blocked, _state, cx) => Column(gap: cx.view.env().theme.tokens.spacing.m, children: [
Text(cx.tr("account.denied")),
Button(child: Text(cx.tr("account.return")), key: "return-sign-in",
on_press: reduce { cx.effects.replace_route("/"); }),
])
}
{"id":"fission-tabs-1","index":3,"label":"src/app/routes.rs","value":"src-app-routes-rs"}
use super::screen::{AccountBlocked, AccountContent, SignInScreen};
use super::state::{account_route_decision, AccountState};
use fission::prelude::*;
fission_component! {
pub UnknownRoute<AccountState> {}
view(_unknown, _state, cx) => Column(children: [
Text(cx.tr("account.unknown")),
Button(child: Text(cx.tr("account.return")), key: "recover",
on_press: reduce { cx.effects.replace_route("/"); }),
])
}
fission_component! {
pub AccountApp<AccountState> {}
view(_app, state, cx) {
let tokens = &cx.view.env().theme.tokens;
let router = Router::<AccountState>::new()
.with_path(state.current_path.clone())
.route_component("/", SignInScreen)
.route_component("/account",
ProtectedRoute::new(account_route_decision(state), AccountContent)
.denied(AccountBlocked))
.not_found(|| UnknownRoute);
} => SafeArea(child: Scroll(child: Container(Column(gap: tokens.spacing.m, children: [
Row(gap: tokens.spacing.s, children: [
Button(child: Text(cx.tr("language.english")), key: "english",
on_press: reduce { state.locale = Locale::from("en-US"); }),
Button(child: Text(cx.tr("language.spanish")), key: "spanish",
on_press: reduce { state.locale = Locale::from("es-ES"); }),
]),
router,
])).padding_all(tokens.spacing.l)))
}
{"id":"fission-tabs-1","index":4,"label":"src/i18n.rs","value":"src-i18n-rs"}
use fission::i18n::{Locale, TranslationBundle};
use fission::prelude::*;
use std::collections::HashMap;
pub fn create_env() -> Env {
let mut env = Env::default();
env.locale = Locale::from("en-US");
for (locale, source) in [
("en-US", include_str!("../i18n/en-US.yaml")),
("es-ES", include_str!("../i18n/es-ES.yaml")),
] {
let messages: HashMap<String, String> =
serde_yaml::from_str(source).expect("valid navigation translations");
env.i18n.add_bundle(TranslationBundle {
locale: Locale::from(locale),
messages,
});
}
env
}
pub fn sync_env(state: &crate::app::AccountState, env: &mut Env) {
env.locale = state.locale.clone();
}
{"id":"fission-tabs-1","index":5,"label":"src/lib.rs","value":"src-lib-rs"}
pub mod app;
mod i18n;
use app::{AccountApp, AccountState};
use fission::prelude::*;
#[cfg(not(any(target_arch = "wasm32", target_os = "android", target_os = "ios")))]
pub fn run_desktop() -> anyhow::Result<()> {
DesktopApp::<AccountState, _>::new(AccountApp)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.with_route_handler(app::route_changed)
.run()
}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn run_mobile() -> anyhow::Result<()> {
MobileApp::<AccountState, _>::new(AccountApp)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.with_route_handler(app::route_changed)
.run()
}
#[cfg(target_os = "android")]
#[no_mangle]
fn android_main(app_handle: AndroidApp) {
let _ = MobileApp::<AccountState, _>::new(AccountApp)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.with_route_handler(app::route_changed)
.run_with_android_app(app_handle);
}
#[cfg(target_arch = "wasm32")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn run_web() -> Result<(), wasm_bindgen::JsValue> {
console_error_panic_hook::set_once();
WebApp::<AccountState, _>::new(AccountApp)
.with_navigation(WebNavigationConfig::new(WebRouteStrategy::Hash))
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.with_route_handler(app::route_changed)
.run()
.map_err(|error| wasm_bindgen::JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":6,"label":"preview/lib.rs","value":"preview-lib-rs"}
mod app;
mod i18n;
use fission::prelude::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen(start)]
pub fn run() -> Result<(), JsValue> {
console_error_panic_hook::set_once();
let window =
web_sys::window().ok_or_else(|| JsValue::from_str("browser window unavailable"))?;
let base_path = window.location().pathname()?;
WebApp::<app::AccountState, _>::new(app::AccountApp)
.with_env(i18n::create_env())
.with_sync_env(i18n::sync_env)
.with_route_handler(app::route_changed)
.with_navigation(WebNavigationConfig::new(WebRouteStrategy::Hash).base_path(base_path))
.mount("#fission-web-mount")
.run()
.map_err(|error| JsValue::from_str(&error.to_string()))
}
{"id":"fission-tabs-1","index":7,"label":"i18n/en-US.yaml","value":"i18n-en-us-yaml"}
account.sign_in: "Account sign-in prerequisites"
account.blocked: "This native passkey flow is blocked: there is no installed iOS credential provider or server challenge/verification integration."
account.label: "Account label"
account.label_help: "This identifies your intended account only. It is not a verified identity."
account.entered: "Entered account: {account} — not verified"
account.inspect_route: "Inspect the blocked account route"
account.no_authentication: "Checking host support never signs you in. No credential request or server verification is performed."
account.protected_placeholder: "Protected account content must remain unconstructed in this incomplete integration."
account.denied: "Account access is denied. No verified session exists."
account.return: "Return to sign-in prerequisites"
account.unknown: "This route does not exist."
check.request: "Check this host's passkey support"
check.ready: "No host-support check has been requested."
check.pending: "Waiting for the host-support response…"
check.available: "This host reports secure passkey support. Nobody has been signed in."
check.unavailable: "The active host cannot provide passkey authentication."
check.failed: "The support check failed. Inspect the diagnostic details."
check.invalid: "The host returned no usable typed result."
language.english: "English"
language.spanish: "Español"
{"id":"fission-tabs-1","index":8,"label":"i18n/es-ES.yaml","value":"i18n-es-es-yaml"}
account.sign_in: "Requisitos de inicio de sesión"
account.blocked: "El flujo nativo está bloqueado: faltan el proveedor de credenciales de iOS y la integración de desafío y verificación del servidor."
account.label: "Identificador de cuenta"
account.label_help: "Solo identifica la cuenta prevista. No es una identidad verificada."
account.entered: "Cuenta introducida: {account} — sin verificar"
account.inspect_route: "Inspeccionar la ruta de cuenta bloqueada"
account.no_authentication: "Comprobar el host no inicia sesión. No se solicita ninguna credencial ni se verifica con un servidor."
account.protected_placeholder: "El contenido protegido no debe construirse en esta integración incompleta."
account.denied: "Acceso denegado. No existe ninguna sesión verificada."
account.return: "Volver a los requisitos de inicio de sesión"
account.unknown: "Esta ruta no existe."
check.request: "Comprobar claves de acceso en este host"
check.ready: "No se ha solicitado ninguna comprobación."
check.pending: "Esperando la respuesta del host…"
check.available: "El host indica compatibilidad segura con claves de acceso. Nadie ha iniciado sesión."
check.unavailable: "El host activo no proporciona autenticación con claves de acceso."
check.failed: "La comprobación falló. Revisa los detalles de diagnóstico."
check.invalid: "El host no devolvió un resultado tipado utilizable."
language.english: "Inglés"
language.spanish: "Español"
{"id":"fission-tabs-1"}