identity

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package identity provides unified user identity utilities for PicoClaw. It introduces a canonical "platform:id" format and matching logic that is backward-compatible with all legacy allow-list formats.

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. It is backward-compatible with all legacy formats:

  • "123456" → matches sender.PlatformID
  • "@alice" → matches sender.Username
  • "123456|alice" → matches PlatformID or Username
  • "telegram:123456" → exact match on sender.CanonicalID

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