slackid

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package slackid normalises Slack user identifiers across the codebase.

Slack's OIDC sub claim is the composite "Uxxx-Txxx" (user-team) form — see https://api.slack.com/authentication/sign-in-with-slack — while every downstream API (channel invites, Slack interactivity callback.User.ID, the channel-membership cache) keys on the bare "Uxxx" / "Wxxx" user ID. We normalise at every persistence / resolution boundary so the rest of the codebase consistently sees a single user-ID form; otherwise reporter / actor IDs persisted from the Web side fail silently when downstream lookups (Slack API, SlackUser repository) reject the composite value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsUserID

func IsUserID(s string) bool

IsUserID reports whether s looks like a Slack user ID (a single "U" or "W" prefix followed by alphanumeric characters).

func Normalize

func Normalize(sub string) string

Normalize extracts the Slack user ID portion (Uxxx or Wxxx) from an OIDC sub claim. Slack returns the sub as a hyphen-separated composite of the user ID and the team ID — in practice either form ("Uxxx-Txxx" or "Txxx-Uxxx") may appear depending on the workspace configuration / enterprise-grid setup, so we pick the first hyphen-separated chunk that looks like a user identifier. If no chunk matches we fall back to the raw value so a strange future sub format does not silently strip identity information.

Types

This section is empty.

Jump to

Keyboard shortcuts

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