identity

package
v2.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package identity provides unified user identity utilities for Compa. It introduces a canonical "platform:id" format and the matching logic for allow-list entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCanonicalID

func BuildCanonicalID(platform, platformID string) string

BuildCanonicalID constructs a canonical "platform:id" identifier. Both platform and platformID are lowercased and trimmed.

func MatchAllowed

func MatchAllowed(sender bus.SenderInfo, allowed string) bool

MatchAllowed checks whether the given sender matches a single allow-list entry:

  • "123456" → matches sender.PlatformID
  • "@alice" → matches sender.Username (any case on Telegram and Discord)
  • "telegram:123456" → exact match on sender.CanonicalID
  • "telegram:@alice" → matches sender.Username on that platform
  • "@alice:matrix.org" → matches the Matrix user ID

Only a known platform name (or the sender's own platform) before the first colon makes an entry canonical. On DeltaChat, whose senders are email addresses, "@name" matches only a full address, so "@alice" never admits alice@ at some other domain.

func ParseCanonicalID

func ParseCanonicalID(canonical string) (platform, id string, ok bool)

ParseCanonicalID splits a canonical ID ("platform:id") into its parts. Returns ok=false if the input does not contain a colon separator.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL