Glossary: treetracker-wallet-app
Generated by .github/scripts/build-glossary.mjs from domain-graph.json (source commit 3c14113). Do not edit by hand.
This glossary lists the business terms of treetracker-wallet-app. Each term links to its domain, which says what the domain does, its rules, and its flows. The estate glossary shows which other repos use the same terms.
Terms
- Access token: Authentication and Identity
- Action token: Share Links and Claims
- Claim link: Share Links and Claims
- Incoming transfer: Token Transfer
- Keycloak session: Authentication and Identity
- Pending claim: Share Links and Claims
- Pending transfer: Token Transfer
- QR payload: Search and Discovery
- Recent search: Search and Discovery
- Refresh token: Authentication and Identity
- Reward bundle: Wallet Management
- Search category: Search and Discovery
- Search item: Search and Discovery
- Service-account token: Authentication and Identity
- Share link state: Share Links and Claims
- Token: Wallet Management
- Token bundle: Token Transfer
- Token transaction: Wallet Management
- Transfer: Token Transfer
- Transfer state: Token Transfer
- Tree: Wallet Management
- User account: Authentication and Identity
- User profile: Authentication and Identity
- Wallet: Wallet Management
- Wallet profile: Wallet Management
Domains
Authentication and Identity
Handles sign-in, registration, session lifetime and the account profile. The web app delegates login and registration to the Keycloak hosted pages (public client with PKCE), mirrors the access token into the shared core tokenAtom and ends sessions across tabs; the NestJS user API proxies password login, user creation and the /me profile to Keycloak. Several parts are not live: the native login, forgot-password and log-out screens make no API call, the web /api/auth/login and /api/auth/signup route handlers have no caller and cannot run under the static export, the core loginAtom and registerAtom are not used by any app, and the web forgot-password RESEND LINK button only logs.
Terms: Keycloak session, Access token, Refresh token, User account, User profile, Service-account token
Rules:
- Web login and registration go through the Keycloak hosted pages with redirect URI /auth/callback.
- Only a refused token refresh or an explicit logout ends a web session, never an HTTP status from a resource call.
- The access token lives in per-tab sessionStorage, so logout is broadcast to other tabs over the wallet-auth BroadcastChannel.
- Keycloak init is capped at 8 seconds before the app renders.
- GET /me rejects a request without a bearer token with 401.
- The user API caches its client_credentials token until expires_in elapses.
Flows:
- Sign In or Register with Keycloak (
GET /login or GET /signup (web)): Sends a web visitor to the Keycloak hosted login or registration page, processes the OIDC code on /auth/callback, resumes or refreshes the session and lets the user into the protected pages. After registration the callback goes straight to /home: no live code navigates to the /welcome or /account-created pages. - Log Out Across Tabs (
log out button on /settings or /settings/account (web)): Ends the web session from the settings or account page: it clears the stored tokens, tells the other tabs, and ends the Keycloak SSO session with a redirect to /login. - View Account Profile (
GET /settings/account (web), GET /me (user API)): Shows the signed-in user's email and member-since date on /settings/account, from the user API /me endpoint with a Keycloak userinfo fallback, and links to the Keycloak account console for password management. - User API Login and Registration (
POST /login, POST /register (user API)): The NestJS user API exposes POST /login (password grant) and POST /register (Keycloak admin user creation). No client in this repo calls them: the core loginAtom and registerAtom that post to them are not imported by any app, and the web app uses the Keycloak hosted pages instead. - Native Onboarding and Login (
app launch (native)): Routes a native app launch to onboarding, the home tab or the login screen from AsyncStorage flags. The native login is a stub: it calls no API and only stores a local isAuth flag. Sign up points to /(auth)/register, a route that does not exist, the forgot-password link is commented out, password reset sends nothing, log out only logs, and no route leads to the account confirmation screen.
Wallet Management
Covers the user's wallets: the home dashboard of token and wallet totals, wallet creation, the wallet profile (display name, about text, logo, cover image, web-map visibility), the token list of a wallet and the provenance of each token (tree photo, transaction history, map link). The user API also listens for wallet-creation events to send a reward token bundle, but that listener has defects that likely stop it from working. The native wallet screens use hard-coded mock wallets and placeholder activity, and native wallet creation only logs.
Terms: Wallet, Token, Token transaction, Tree, Wallet profile, Reward bundle
Rules:
- A user can have at most 2 wallets; only the web client enforces this, because the API sets no limit.
- Wallet names must be unique, compared case-insensitively, and a new wallet needs a name and a description.
- Display name must be 2 to 30 characters and about text 5 to 250 characters; a field that had a value cannot be emptied.
- Logo and cover images must be image files of at most 1MB, sent as multipart form data.
- Token tree data comes from the public Treetracker query API without authentication.
Flows:
- View Wallet Dashboard (
GET /home (web)): Shows the web home page with the total tokens (and pending count) across the user's wallets, the wallet count and the 5 most recent transfers as sent or received activity. The native home tab instead shows hard-coded balances (1000 tokens, 2 wallets) and mock activity. - Create Wallet (
CREATE WALLET button on /wallet (web)): Creates a managed wallet from the web /wallet page with a name and description, then redeems any saved claim link into it. The page shows a first-wallet gift message; the gift depends on the user API reward listener, which likely does not work. - Reward New Wallet (
PostgreSQL LISTEN wallets/creation (user API)): The user API listens on the PostgreSQL wallets/creation channel and sends a reward token bundle from a configured sender wallet to the new user's first wallet. No code in this repo publishes to that channel. The code has defects that likely stop the reward: the listener reads msg.payload, but subscribe emits the queue.message row; the Authorization header holds an unawaited Promise; the body uses receive_wallet, not receiver_wallet; and errors still return transferStatus true. - Browse Wallet Tokens and Provenance (
GET /wallet/details?name= and GET /token/details?id= (web)): Shows one wallet's cover, logo, display name, balance and token list, then the details of one token: its wallet, creation date, tree photo and species from the public query API, a map link and its transaction history. - Edit Wallet Profile (
Edit or Customize on /wallet/details (web)): Edits a wallet's public profile: display name, about text and web-map visibility in a drawer on the details page, or display name, about text, logo and cover image on the customize page, saved through a multipart PATCH. - Native Wallet Screens (Mock) (
Wallet tab (native)): The native wallet tab lists two hard-coded wallets and opens a detail screen with placeholder activity. Native wallet creation validates the form but only logs; the Edit wallet, Delete wallet and filter APPLY actions have no handlers.
Token Transfer
Moves tokens between wallets through the wallet API: a sender starts a transfer of an N-token bundle to a named wallet, the receiver accepts or declines it from notifications or the transfers page, the sender can cancel it while it is pending, and both sides see the transfer history and details. The native send and request screens only collect a recipient and an amount from mock search data and show a snackbar; they make no API call, and the native notifications tab shows hard-coded items.
Terms: Transfer, Token bundle, Pending transfer, Incoming transfer, Transfer state
Rules:
- The amount must be a whole number of at least 1 and not more than the tokens_available of the sender wallet.
- The recipient wallet must differ from the sender wallet.
- Only transfers addressed to one of the user's own wallets can be accepted or declined.
- Only the sender can cancel a pending transfer, before the receiver accepts it.
- A decline is final and the tokens stay with the sender.
- Pending means the requested and pending states, fetched separately and merged.
Flows:
- Send Tokens to Wallet (
Send button of the bottom navigation, GET /send (web)): Sends an N-token bundle from one of the user's wallets to a named recipient wallet through POST /transfers, then shows the pending list. - Review Incoming Transfer (
GET /notifications and GET /notifications/details?id= (web)): Shows pending transfers addressed to the user's wallets as notifications with a badge count, and lets the recipient accept or decline one. The native notifications tab shows four hard-coded mock items instead. - Manage Pending Transfers and History (
GET /transfers and GET /transfers/details?id= (web)): Groups the user's transfers on /transfers into incoming (accept or decline), outgoing pending (cancel) and the 20 most recent, and opens the details of one transfer. - Native Send or Request (Mock) (
center swap button of the tab bar (native)): The native app lets the user choose Send or Request, pick a recipient from mock search results or a QR code, and enter an amount and a note. It calls no wallet API: the entry screen only returns to the home tab with a snackbar. No screen navigates to the transfer/notification confirmation route.
Share Links and Claims
Lets a sender give tokens to someone without a known wallet: the web send page issues a signed, expiring action token as a /claim link with a QR code, the transfers page lists and cancels these links, and the public /claim page redeems a link into the recipient's wallet. A signed-out or wallet-less recipient gets the link saved in localStorage, and the protected layout or the first wallet creation redeems it later.
Terms: Action token, Claim link, Share link state, Pending claim
Rules:
- A claim link is single use; the saved link leaves storage before the redeem request, so a failure is never retried.
- Only active links can be cancelled.
- A signed-in user without a wallet gets the no_wallet reason and is sent to create a wallet; the link stays saved.
- Redeem errors map to user messages: expired, not valid, or already used.
- The link recipient email is a fixed placeholder (link-recipient@greenstand.org).
Flows:
- Create and Manage Share Links (
Share by QR code option on /send (web)): Issues a claim link with a QR code from the send page for a bundle of tokens without a recipient wallet, and lists the user's links on /transfers with a cancel action for active links. - Claim Shared Tokens (
GET /claim?action_token= (web)): Redeems a /claim link into the recipient's wallet. A signed-in user with a wallet redeems at once; a signed-out visitor or a user without a wallet gets the link saved, and the protected layout or the first wallet creation redeems it later.
Search and Discovery
Finds a recipient wallet or user to send tokens to or request tokens from. The native app searches a hard-coded core mockData directory through Jotai search atoms and can read a recipient from a QR code. The web /search page filters a hard-coded wallet list and opens a mock send or request keypad; no web link leads to /search, because the ChooseAction drawer is not used and the default header has no search button.
Terms: Search item, Search category, Recent search, QR payload
Rules:
- Search categories are send (users), request (businesses) and all.
- Results split into matching and non-matching sections for the query.
- Up to 5 recent searches are kept.
- A QR payload is read as JSON, as a URL query, or as plain text; it must hold a recipient name.
Flows:
- Native Recipient Search (
search icon of the header bar (native)): Searches the hard-coded core mockData directory of five users and five businesses from the shared header bar and lists matching and other results by category. The home tab swaps to the results while searching; the separate search tab is hidden (href null) and no screen navigates to it. - Scan Recipient QR Code (
Scan or show QR code card (native)): Reads a recipient from a QR code with the camera or from a gallery image and opens the native transfer entry screen in send mode. - Web Wallet Search (Mock) (
GET /search?action=send|request (web, direct URL only)): The web /search page filters three hard-coded wallets by the header query and opens a keypad modal to send or request. It calls no API: the modal only stores a pendingTransaction in sessionStorage, the home page shows it as a snackbar, and UNDO only logs. No live link leads to /search.