Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

v1 source realm

Constants 1

const MinRegisterPrice

1const MinRegisterPrice = int64(0)
source

MinRegisterPrice is the lowest price (in ugnot) that ProposeNewRegisterPrice will accept. Set to 0 — registration is free by default; governance can raise the price via ProposeNewRegisterPrice without a floor.

Variables 2

var ErrInvalidFormat, ErrReservedPrefix, ErrBlacklisted

1var (
2	ErrInvalidFormat  = errors.New("namereg: name must match nym-[a-z]{5,13}\\d{3}")
3	ErrReservedPrefix = errors.New("namereg: stem starts with a reserved prefix (" + strings.Join(reservedPrefixes, "/") + ")")
4	ErrBlacklisted    = errors.New("namereg: stem matches a reserved role name")
5)
source

Exported error sentinels returned by ValidateNymFormat. Use errors.Is or direct equality; do not string-match.

ErrReservedPrefix's message is built from reservedPrefixes at package init time so the surfaced list never drifts from the actual policy.

Canonical-collision detection moved to r/sys/users in Option B. Consumers that previously caught namereg.ErrCanonicalCollision should switch to susers.ErrCanonicalCollision.

var ErrNonUserCall, ErrPaused, ErrInvalidUsername, ErrInvalidPayment

 1var (
 2	ErrNonUserCall     = errors.New("r/gnoland/users: non-user call")
 3	ErrPaused          = errors.New("r/gnoland/users: paused")
 4	ErrInvalidUsername = errors.New("r/gnoland/users: invalid username")
 5
 6	// ErrInvalidPayment is the sentinel for "OriginSend amount didn't
 7	// match registerPrice." It deliberately omits the price from its
 8	// message — the price is read at panic time via errInvalidPayment()
 9	// below, so users see the CURRENT price even after governance has
10	// changed it. Tests that match against this error use it as a
11	// substring check via uassert.AbortsWithMessage. (audit finding #13)
12	ErrInvalidPayment = errors.New("r/gnoland/users: invalid payment amount")
13)
source

Functions 11

func Canonicalize

Action
1func Canonicalize(s string) string
source

Canonicalize is a delegating shim to r/sys/users.Canonicalize.

HISTORY: namereg/v1 used to host its own per-stem canonical store and its own Canonicalize (l→i only). Option B unified the canonical lookup into r/sys/users keyed by full canonical name with broader substitutions ({l,i,1}→i, {0,o}→o, {-,.,_} stripped). This shim preserves the call-site name for local consumers (blacklist init, IsReserved) and any external consumer that imported the function from namereg/v1 before Option B.

New code should call susers.Canonicalize directly.

func IsPaused

Action
1func IsPaused() bool
source

IsPaused exposes the realm's pause flag for cross-controller coordination.

func IsReserved

Action
1func IsReserved(stem string) bool
source

IsReserved reports whether the given alpha stem matches a reserved role name (with implicit `s`-suffix expansion). The check is canonicalized — so `vital1k`-style l-substituted variants of a reserved name are also caught. O(1) backed by `reservedSet` built in init().

func NewSetPausedExecutor

crossing Action
1func NewSetPausedExecutor(cur realm, newPausedValue bool) dao.ProposalRequest
source

NewSetPausedExecutor allows GovDAO to pause or unpause this realm

func ProposeDeleteUser

crossing Action
1func ProposeDeleteUser(cur realm, addr address, reason string) dao.ProposalRequest
source

ProposeDeleteUser allows GovDAO to propose deletion of a user This will make the associated address and names unresolvable. WARN: After deletion, the same address WILL NOT be able to register a new name.

func ProposeNewName

crossing Action
1func ProposeNewName(cur realm, addr address, newName string) dao.ProposalRequest
source

ProposeNewName allows GovDAO to propose a new name for an existing user. The associated address and all previous names of a user that changes a name are preserved, and all resolve to the new name.

Governance renames bypass the Open Nym Tier `nym-...\d{3}` format intentionally. The DAO is the trust root for this realm; if voters approve a rename to `vitalik` (e.g. for trademark dispute resolution or system reservations), the validation here imposes no further opinion. The new name is still subject to the base shape enforced by `r/sys/users.validateName` (`^[a-z][a-z0-9]*([_-][a-z0-9]+)*$`, max 64 chars), which runs inside the updateUsername callback below.

func ProposeNewRegisterPrice

crossing Action
1func ProposeNewRegisterPrice(cur realm, newPrice int64) dao.ProposalRequest
source

ProposeNewRegisterPrice allows GovDAO to update the price of registration. Rejects prices below MinRegisterPrice (currently 0) at proposal-creation time. (audit finding #14: original code only rejected negative values, which would have been arithmetically nonsensical.)

func Register

crossing Action
1func Register(cur realm, username string)
source

Register registers a new username for the caller.

Valid usernames match `nym-[a-z]{5,13}\d{3}`:

  • literal `nym-` prefix (4 chars)
  • 5-13 lowercase letters (the alpha stem)
  • exactly 3 trailing decimal digits

Total length 12-20 chars. The alpha stem additionally must NOT start with `gno`/`gi`/`gl` and must not match a reserved role name (with implicit `s`-suffix expansion). See ValidateNymFormat for the format/blacklist check.

Canonical-collision detection is enforced atomically by susers.RegisterUser via the unified canonical store in r/sys/users (decision: per Option B, every controller participates in the same canonical-form lookup keyed by full canonical name).

Only direct EOA (maketx call) invocations are supported.

func RenderLatestUsersWidget

Action
1func RenderLatestUsersWidget(num int) string
source

RenderLatestUsersWidget renders the latest num registered users. For num = -1, the maximum number (100) will be displayed.

func ValidateNymFormat

Action
1func ValidateNymFormat(username string) error
source

ValidateNymFormat checks the regex, prefix-exclusion, and reserved- name rules in that order. Returns one of the exported sentinel errors per failure mode, or nil on success.

Does NOT run the canonical-collision check — that lives in r/sys/users (susers.IsCanonicalTaken or, atomically with the write, inside susers.RegisterUser).

Imports 14

Source Files 17