Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

usernames state

Back to all declarations

hubURL

untyped string

hubURL is the toolbox this tool belongs to. A private realm cannot import the hub, so the link is a constant on this side; \`r/moul/toolbox\` holds the authoritative copy and its tests check that the tool path matches.

Value

"/r/moul/toolbox"

maxInput

untyped bigint

maxInput bounds what is echoed back into the page. A render that reflects an unbounded query parameter is a page anyone can make arbitrarily large.

Value

(64 <untyped> bigint)

Render

func(path string) string

Render routes gnoweb paths: / the form, and what the tool answers /lookup?q=moul the result, which is where the form submits /moul the same result, addressable directly /g1manfred... the same, by address

Open
OID
0190b0…6a76:3
Render details

Inspect func

renderResult

func(input string) string
Open
OID
0190b0…6a76:7
renderResult details

Inspect func

notFound

func(input string) string
Open
OID
0190b0…6a76:8
notFound details

Inspect func

notFoundHints

func(input string) []string

notFoundHints says what "not found" means for this particular input, which is three different things.

Open
OID
0190b0…6a76:9
notFoundHints details

Inspect func

qevalCommand

func(input string) string

qevalCommand is the CLI call this page is the equivalent of, with the input substituted. It returns "" for an input that cannot be put inside a fenced code block safely: nothing escapes inside a fence, so the only safe move is not to print one.

Open
OID
0190b0…6a76:11
qevalCommand details

Inspect func

safeArg

func(s string) bool

safeArg reports whether s can be interpolated into a shell single-quoted string inside a markdown code fence. Usernames and addresses are both well inside this set, so a refusal only ever hides the hint, never an answer.

Open
OID
0190b0…6a76:12
safeArg details

Inspect func

trim

func(s string) string

trim bounds an echoed input. Everything downstream escapes it; this only stops one query from rendering a page of arbitrary size. Cut on a rune boundary, not a byte one: s\[:maxInput] on a multi-byte character leaves half of it, and half a rune is not a character the escapers downstream can do anything sensible with. Counting runes also makes the cap mean the same thing for every alphabet.

Open
OID
0190b0…6a76:13
trim details

Inspect func

lookup

func(input string) *users.UserData

lookup resolves any input to a user record, or nil. An input that parses as a gno.land address is only ever looked up as an address, and anything else only as a name: a bech32 address is not a legal username, so trying both would only widen what a typo can hit.

Open
OID
0190b0…6a76:14
lookup details

Inspect func

Resolve

func(input string) (name string, addr string, found bool)

Resolve returns the current username and the address behind any input, a username or a \`g1\` address. found is false when nobody holds it, which is also the answer for a deleted user: \`r/sys/users\` keeps the tombstone and resolves it to nothing. gnokey query vm/qeval -data 'gno.land/r/moul/toolbox/usernames.Resolve("moul")'

Open
OID
0190b0…6a76:16
Resolve details

Inspect func

AddressOf

func(input string) string

AddressOf returns the address behind a username or an address, or "" when nobody holds it. It is the call another realm would want, and the one it cannot have: this realm is \`private = true\`, so nothing can import it. Over \`vm/qeval\` it is the whole point. gnokey query vm/qeval -data 'gno.land/r/moul/toolbox/usernames.AddressOf("moul")'

Open
OID
0190b0…6a76:17
AddressOf details

Inspect func

NameOf

func(input string) string

NameOf returns the current username behind a username or an address, or "" when nobody holds it.

Open
OID
0190b0…6a76:18
NameOf details

Inspect func

Display

func(input string) string

Display returns what a page should print for an input: "@name" when there is a username, and the input unchanged when there is not. So it is total over every input a page actually has, and a caller never has to branch on "not found" the way [NameOf](#NameOf) makes it. The one input it has nothing to say about is "", which it returns unchanged: an empty answer to an empty question, rather than a placeholder a page would then have to special case anyway.

Open
OID
0190b0…6a76:19
Display details

Inspect func

CurrentName

func(input string) string

CurrentName reports the user's current name when input is an alias they renamed away from, and "" otherwise. \`r/sys/users\` keeps old names resolving on purpose, so an address looked up by a name that is no longer current is not an error and nothing in the resolve result says so. This is the one call that does.

Open
OID
0190b0…6a76:20
CurrentName details

Inspect func

Canonical

func(name string) string

Canonical returns the canonical key a name collapses to. Two names with the same canonical form cannot both be registered, which is how \`r/sys/users\` refuses a lookalike of an existing account. gnokey query vm/qeval -data 'gno.land/r/moul/toolbox/usernames.Canonical("M0ul")'

Open
OID
0190b0…6a76:21
Canonical details

Inspect func

Taken

func(name string) bool

Taken reports whether the exact name is registered, including names that were deleted or renamed away from: it answers "would registering this fail", not "is somebody using this".

Open
OID
0190b0…6a76:22
Taken details

Inspect func

CanonicalOwner

func(name string) string

CanonicalOwner returns the name that already holds this name's canonical key, or "" when the key is free. A non-empty answer that is not the name itself is a lookalike collision.

Open
OID
0190b0…6a76:23
CanonicalOwner details

Inspect func
hubURL : untyped string ="/r/moul/toolbox"
maxInput : untyped bigint =(64 <untyped> bigint)
Render : func(path string) string Inspect
header : func() string Inspect
renderHome : func() string Inspect
renderResult : func(input string) string Inspect
notFound : func(input string) string Inspect
notFoundHints : func(input string) []string Inspect
form : func() string Inspect
qevalCommand : func(input string) string Inspect
safeArg : func(s string) bool Inspect
trim : func(s string) string Inspect
lookup : func(input string) *users.UserData Inspect
Resolve : func(input string) (name string, addr string, found bool) Inspect
AddressOf : func(input string) string Inspect
NameOf : func(input string) string Inspect
Display : func(input string) string Inspect
CurrentName : func(input string) string Inspect
Canonical : func(name string) string Inspect
Taken : func(name string) bool Inspect
CanonicalOwner : func(name string) string Inspect