hubURL
untyped stringhubURL 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 bigintmaxInput 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) stringRender 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
- OID
- 0190b0…6a76:3
Render details
header
func() string- OID
- 0190b0…6a76:5
header details
renderHome
func() string- OID
- 0190b0…6a76:6
renderHome details
renderResult
func(input string) string- OID
- 0190b0…6a76:7
renderResult details
notFound
func(input string) string- OID
- 0190b0…6a76:8
notFound details
notFoundHints
func(input string) []stringnotFoundHints says what "not found" means for this particular input, which is three different things.
- OID
- 0190b0…6a76:9
notFoundHints details
form
func() string- OID
- 0190b0…6a76:10
form details
qevalCommand
func(input string) stringqevalCommand 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.
- OID
- 0190b0…6a76:11
qevalCommand details
safeArg
func(s string) boolsafeArg 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.
- OID
- 0190b0…6a76:12
safeArg details
trim
func(s string) stringtrim 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.
- OID
- 0190b0…6a76:13
trim details
lookup
func(input string) *users.UserDatalookup 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.
- OID
- 0190b0…6a76:14
lookup details
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")'
- OID
- 0190b0…6a76:16
Resolve details
AddressOf
func(input string) stringAddressOf 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")'
- OID
- 0190b0…6a76:17
AddressOf details
NameOf
func(input string) stringNameOf returns the current username behind a username or an address, or "" when nobody holds it.
- OID
- 0190b0…6a76:18
NameOf details
Display
func(input string) stringDisplay 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.
- OID
- 0190b0…6a76:19
Display details
CurrentName
func(input string) stringCurrentName 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.
- OID
- 0190b0…6a76:20
CurrentName details
Canonical
func(name string) stringCanonical 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")'
- OID
- 0190b0…6a76:21
Canonical details
Taken
func(name string) boolTaken 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".
- OID
- 0190b0…6a76:22
Taken details
CanonicalOwner
func(name string) stringCanonicalOwner 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.
- OID
- 0190b0…6a76:23