metaid

package
v1.261006.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MPL-2.0 Imports: 4 Imported by: 0 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 metaid parses and builds the identifier Anthropic clients put in metadata.user_id. It is a leaf package so both the protocol converters and the vendor ops layer can read a request's session identity without either depending on the other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMetadataUserID

func FormatMetadataUserID(m *MetadataUserID) string

FormatMetadataUserID formats a MetadataUserID to JSON string. Returns empty string for nil input.

Types

type MetadataUserID

type MetadataUserID struct {
	DeviceID    string `json:"device_id"`
	AccountUUID string `json:"account_uuid"`
	SessionID   string `json:"session_id"`
}

MetadataUserID represents the JSON structure for metadata.user_id This matches Claude Code's format (>= 2.1.78)

func BuildMetadataUserID

func BuildMetadataUserID(extra map[string]any) *MetadataUserID

BuildMetadataUserID builds a MetadataUserID from extra map. Returns nil if all fields are empty after fixing.

func FixMetadataUserID

func FixMetadataUserID(raw string) *MetadataUserID

FixMetadataUserID parses and fixes a metadata user ID string. Returns a new MetadataUserID with generated fields for missing values.

func ParseMetadataUserID

func ParseMetadataUserID(raw string) *MetadataUserID

ParseMetadataUserID parses a metadata.user_id string in either JSON or legacy format. Returns nil if the input cannot be parsed.

func (*MetadataUserID) Fix

func (m *MetadataUserID) Fix(extras map[string]any)

func (*MetadataUserID) Format

func (m *MetadataUserID) Format() string

Format converts MetadataUserID to string for metadata.

func (*MetadataUserID) IsEmpty

func (m *MetadataUserID) IsEmpty() bool

IsEmpty checks if the MetadataUserID is effectively empty.

func (*MetadataUserID) IsValid

func (m *MetadataUserID) IsValid() bool

IsValid checks if the MetadataUserID has required fields.

Jump to

Keyboard shortcuts

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