zuraffa_auth_android

Android adapter for zuraffa_auth — platform credential sign-in (Credential-Manager-shaped) and encrypted session persistence (EncryptedSharedPreferences-shaped) over one injected channel seam.

Pure Dart: the native embedder is a documented method/error protocol, not a dependency. Hosts inject the channel (Flutter method channel, pigeon, FFI — your choice) and everything on this side is typed and fully testable against a scripted fake.

final channel = AndroidAuthChannel(invoke: myTransport.invoke);
final auth = AuthService(
  providers: [AndroidCredentialAuthProvider(channel: channel)],
  sessions: AndroidSecureSessionStore(channel: channel),
);
// or:
registerAndroidAuthDependencies(getIt, channel: channel);

Channel protocol

Method Args Result Errors
getCredential identifier, secret, extras, packageName, signatureHash token payload (accessToken, refreshToken?, tokenType, expiresAt?, scope?) + subject, displayName?, email? see below
refreshCredential token fields + context token payload see below
revokeCredential accessToken + context any (best-effort) swallowed
secureWrite key, value (JSON) any typed
secureRead key {value: String?} typed
secureKeys prefix {keys: [String]} typed
secureDelete key {deleted: bool} typed

Errors arrive as {'error': {'code', 'message'}} payloads (or thrown transport failures → channel_error). Taxonomy: no_credentials → typed invalid_credentials; user_cancelled / api_unavailable / timeout → recoverable AndroidAuthException; crypto_failed and unknown codes → non-recoverable, code preserved verbatim.

Libraries

zuraffa_auth_android
Android adapter for zuraffa_auth: platform credential sign-in and encrypted session persistence over one injected channel seam.