# Functions
ChnToGrp gets group topic name from channel name.
FlattenDoubleSlice turns 2d slice into a 1d slice.
GetTopicCat given topic name returns topic category.
GrpToChn converts group topic name to corresponding channel name.
IsChannel checks if the given topic name is a reference to a channel.
NewObjState parses string into an ObjState.
P2PNameForUser takes a user ID and a full name of a P2P topic and generates the name of the P2P topic as it should be seen by the given user.
ParseAcs parses AccessMode from a byte array.
ParseP2P extracts uids from the name of a p2p topic.
ParseUid parses string NOT prefixed with anything.
ParseUid32 parses base32-encoded string into Uid.
ParseUserId parses user ID of the form "usrXXXXXX".
TimeNow returns current wall time in UTC rounded to milliseconds.
# Constants
ErrCredentials means credentials like email or captcha must be validated.
ErrDuplicate means duplicate credential, i.e.
ErrExpired means the secret has expired.
ErrFailed means authentication failed (wrong login or password, etc).
ErrInternal means DB or other internal failure.
ErrInvalidResponse means the client's response does not match server's expectation.
ErrMalformed means the secret cannot be parsed or otherwise wrong.
ErrNotFound means the object other then user or topic was not found.
ErrPermissionDenied means the operation is not permitted.
ErrPolicy means policy violation, e.g.
ErrRedirected means the subscription request was redirected to another topic.
ErrTopicNotFound means the topic was not found.
ErrUnsupported means an operation is not supported.
ErrUserNotFound means the user was not found.
user can approve new members or evict existing members (A:0x10, 16).
All possible valid bits (excluding ModeInvalid and ModeUnset) = 0xFF, 255.
Admin: user who can modify access mode ("OA", dec: 144, hex: 0x90).
Default Auth access mode for a user ("JRWPAS", 63, 0x3F).
Reader's access mode to a channel (JRP, 11, 0xB).
Channel publisher: person authorized to publish content; no J: by invitation only ("RWPD", 78, 0x4E).
Owner's subscription to a generic topic ("JRWPASDO", 255, 0xFF).
Default P2P access mode ("JRWPA", 31, 0x1F).
Normal user's access to a topic ("JRWPS", 47, 0x2F).
Read-only access to topic ("JR", 3).
User's subscription to 'me' and 'fnd' ("JPS", 41, 0x29).
Sharer: flags which define user who can be notified of access mode changes ("OAS", dec: 176, hex: 0xB0).
Access to 'sys' topic by a root user ("JRWPD", 79, 0x4F).
user can hard-delete messages (D:0x40, 64).
Invalid mode to indicate an error.
user can join, i.e.
No access, requests to gain access are processed normally (N:0).
user is the owner (O:0x80, 128) - full access.
user can receive presence updates (P:8).
user can receive broadcasts ({data}, {info}) (R:2).
user can invite new members (S:0x20, 32).
Non-zero value to indicate unknown or undefined mode (:0x100, 256), to make it different from ModeNone.
user can Write, i.e.
NullValue is a Unicode DEL character which indicated that the value is being deleted.
StateDeleted indicates soft-deleted user or topic.
StateOK indicates normal user or topic.
StateSuspended indicates suspended user or topic.
StateUndefined indicates state which has not been set explicitly.
TimeFormatRFC3339 is a format string for writing timestamps as RFC3339.
TopicCatFnd is a value denoting 'fnd' topic.
TopicCatGrp is a value denoting group topic.
TopicCatMe is a value denoting 'me' topic.
TopicCatP2P is a value denoting 'p2p topic.
TopicCatSys is a constant indicating a system topic.
UploadCompleted indicates that the upload has completed successfully.
UploadDeleted indicates that the upload is no longer needed and can be deleted.
UploadFailed indicates that the upload has failed.
UploadStarted indicates that the upload has started but not finished yet.
ZeroUid is a constant representing uninitialized Uid.
# Structs
Contact is a result of a search for connections.
Credential hold data needed to validate and check validity of a credential like email or phone.
DefaultAccess is a per-topic default access modes.
DelMessage is a log entry of a deleted message range.
DeviceDef is the data provided by connected device.
FileDef is a stored record of a file upload.
LastSeenUA is a timestamp and a user agent of when the user was last seen.
Message is a stored {data} message.
ObjHeader is the header shared by all stored objects.
QueryOpt is options of a query, [since, before] - both ends inclusive (closed).
Range is a range of message SeqIDs.
SoftDelete is a single DB record of soft-deletetion.
Subscription to a topic.
Topic stored in database.
UidGenerator holds snowflake and encryption paramenets.
User is a representation of a DB-stored user record.
# Type aliases
AccessMode is a definition of access mode bits.
MessageHeaders is needed to attach Scan() to.
ObjState represents information on objects state, such as an indication that User or Topic is suspended/soft-deleted.
RangeSorter is a helper type required by 'sort' package.
StoreError satisfies Error interface but allows constant values for direct comparison.
StringSlice is defined so Scanner and Valuer can be attached to it.
TopicCat is an enum of topic categories.
Uid is a database-specific record id, suitable to be used as a primary key.
UidSlice is a slice of Uids sorted in ascending order.