Documentation
¶
Index ¶
- Constants
- func ChatIDString(chatID *commonpb.ChatId) string
- func EventIDString(id *eventpb.EventId) string
- func GenerateUserId() (*commonpb.UserId, error)
- func MustGenerateEventID() *eventpb.EventId
- func MustGenerateUserID() *commonpb.UserId
- func UserIDString(userID *commonpb.UserId) string
- type KeyPair
Constants ¶
View Source
const UserIDSize = 16
UserIDSize is the length, in bytes, of a user ID. User IDs are UUIDs (see GenerateUserId), so they are fixed-width.
Variables ¶
This section is empty.
Functions ¶
func ChatIDString ¶ added in v1.32.0
ChatIDString renders a chat ID for logs and messages, in the form its family is known by. A group chat's 16-byte ID is UUID-shaped (see chat.MustDeriveGroupChatID) and prints as a UUID; a DM's 32-byte digest prints as hex. Length is the family's discriminator everywhere else (see chat.GroupChatIDSize), so it is here too — and any other length prints as hex rather than failing, since a log line must never choke on its subject.
func EventIDString ¶ added in v1.30.0
EventIDString renders an event ID for logging.
func GenerateUserId ¶
func MustGenerateEventID ¶ added in v1.30.0
MustGenerateEventID mints a fresh event ID: a random UUID.
func MustGenerateUserID ¶
func UserIDString ¶
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
func FromPrivateKey ¶ added in v1.3.0
func FromPrivateKey(priv ed25519.PrivateKey) (KeyPair, error)
func GenerateKeyPair ¶
func MustGenerateKeyPair ¶
func MustGenerateKeyPair() KeyPair
func (KeyPair) Private ¶
func (k KeyPair) Private() ed25519.PrivateKey
Click to show internal directories.
Click to hide internal directories.