Skip to content

UserRegistry

Global Durable Object providing a user index by wallet and email for admin search with case-insensitive prefix matching.

Purpose

Maintains a global index of all users for admin lookup operations. Designed for low-QPS admin usage, not user-facing queries. Supports searching by wallet address or email with prefix matching.

  • Single global instance (id: "global")
  • Case-insensitive storage (wallet and email normalized to lowercase)
  • Prefix-based search via SQL LIKE with query% pattern

Edge Cases

  • Upsert semantics -- registerUser is safe to call multiple times. Existing records are updated, not duplicated.
  • Email update before registration -- updateEmail silently returns { updated: false } if the user record does not exist yet; no error thrown.
  • Case normalization -- all wallet addresses and emails are lowercased before storage and before query, ensuring case-insensitive matching.
  • Prefix-only search -- lookup uses LIKE 'query%', so only prefix matches are supported (no substring or fuzzy search).
  • Limit capping -- lookup caps limit at 100 regardless of input.