One identity service, several session types#
Seed accounts are Supabase Auth users in the shared project. The central portal is https://seedworkslab.de/account.html. Coconut native/local and Banana can use email/password sessions; hosted Coconut uses a registered public OAuth client.
Those sessions share the same underlying user identity but not the same storage or authority model. Read OAuth for delegated login and authorization for server restrictions.
Portal implementation#
account-config.js provides the public project URL, publishable key, auth storage key and deletion function name.
account-core.js supplies input normalization, validation, error mapping, overview normalization and createAccountService(client, options). account.js manages views, forms, busy/error states and SDK events.
The client is configured for PKCE, persistence, automatic refresh and disabled automatic URL session detection. Email codes are exchanged deliberately so a URL hint cannot independently grant access to a recovery view.
Sign-in and signup#
signIn normalizes/validates email, requires a password, then calls auth.signInWithPassword. It returns the SDK session; friendly error mapping prevents raw backend errors becoming confusing UI copy.
signUp validates email and the new password, passes the central confirmation redirect and returns both a possible session and needsEmailConfirmation. With email confirmation enabled, registration can succeed without immediately producing an authenticated session.
Frontend policy currently requires:
- An email of at most 254 characters passing the basic email format check.
- New passwords of at least 12 characters.
- At most 72 UTF-8 bytes for the password.
- Passwords that are not entirely whitespace.
Existing-password sign-in does not reapply the new-password length policy to reject older valid credentials. Hosted Auth settings and rate limits still need independent configuration; browser validation is not a server security policy.
Email confirmation and recovery#
Central redirect targets are:
https://seedworkslab.de/account.html
https://seedworkslab.de/account.html?flow=signup
https://seedworkslab.de/account.html?flow=recovery
requestPasswordReset invokes resetPasswordForEmail with the recovery target. account.js observes Auth events and explicitly exchanges a returned code with exchangeCodeForSession.
A flow=recovery parameter by itself is not proof of a valid recovery session. The implementation waits for verified recovery state rather than showing a privileged password-reset form just because someone edited the URL.
completePasswordRecovery validates the new password, invokes updateUser, then attempts to sign out other sessions. Its result reports whether that latter operation actually succeeded; password success must not be falsely described as guaranteed global revocation.
Normal password change#
updatePassword(currentPassword, newPassword):
- Requires a current password and a policy-valid different new password.
- Reads the current session/user email.
- Reauthenticates using that email and current password.
- Verifies the reauthenticated user matches the original session.
- Updates the password.
- Attempts
signOut({ scope: "others" }), returning success/failure separately.
The current-password check is useful UI/service protection, but someone holding a token can call Auth directly. Enable Supabase's secure password change settings; do not claim the browser prompt alone is an unbypassable authorization boundary.
Profile and account overview#
The account-wide username is public.seed_profiles.display_name. normalizeDisplayName collapses whitespace, trims, and validation rejects control characters and names longer than 80 code points. An empty normalized name is stored as null.
updateDisplayName updates only the session user's profile. The username-bridge migration keeps Coconut's compatible synced username aligned. Banana's current sync implementation reads/writes the Seed profile separately.
loadOverview calls public.seed_account_overview(). normalizeOverview converts returned profile, connections, usage and totals into predictable UI shapes with safe defaults.
Usage and connected devices appear because apps reported them. They are not discovered by scanning every local application database. Record/byte totals are client-reported information—not audited billing or exact PostgreSQL disk consumption.
Profile picture contract#
seed_get_profile_picture() returns only the caller's processed PNG data URI or null, with no target-user parameter. seed_set_profile_picture(p_png) accepts raw base64 or null for removal.
The database keeps one private row per account, maximum 256 KiB, and checks the PNG signature plus 256×256 IHDR dimensions. It is not a complete image decoder. The image is separate from the ordinary account overview and usage totals.
Registered Coconut OAuth sessions can read their own image through a narrowly allowed route, but cannot write pictures. Legacy password/native sessions remain eligible for central APIs because they are not distinguishable from the central portal's password session.
Permanent account deletion#
Browser deleteAccount requires a password and the exact phrase:
DELETE MY SEED ACCOUNT
It invokes the configured delete-account Edge Function. The function is the actual privileged boundary:
- Accepts only POST/OPTIONS and handles configured CORS origins.
- Requires a Bearer token and verifies it with Auth
getUser. - Only after verification, inspects signed claims and rejects sessions with OAuth
client_id. - Reads a bounded body (maximum 4,096 bytes) and validates confirmation/password.
- Reauthenticates server-side with the verified user's email and supplied password, requiring the same user UUID.
- Uses the server-only service-role client to delete the Auth user.
- Returns
{ deleted: true }; the browser then tries to clear its local session.
CORS is not authentication: a non-browser caller can forge Origin. The signed-client check and server-side password verification remain necessary even when the request claims the website origin.
Foreign-key cascades remove private server data; Shared Space ownership/history has special transfer/detachment rules. Deleting an account does not remotely erase every browser or device cache, backup file or retained database backup.
Sign-out, grants and token lifetime#
Portal sign-out uses local session scope. Coconut sign-out is separate. The account page's grant view calls auth.oauth.listGrants and revokeGrant.
Revocation stops grant refresh, but an already-issued access JWT can remain usable until expiry. An offline cache cannot immediately learn of remote revocation. “Signed out centrally” and “all apps erased and inaccessible offline” are not equivalent promises.
Troubleshooting safely#
For login failures, check public config, exact redirects, email-confirmation state, server limits and Auth events. For recovery, establish whether a valid event/code exchange occurred. For deletion, inspect the deployed function version and server configuration—not only the form.
Never paste access tokens, passwords, recovery codes or service keys into issue reports, URLs, documentation or screenshots.