Files
Assistant/platform/ids/ids.go
2026-08-16 15:22:49 +03:00

20 lines
421 B
Go

package ids
import (
"crypto/rand"
"encoding/hex"
"fmt"
)
// ID is a transport-neutral opaque identifier primitive. Domain packages wrap it
// in strong semantic ID types; do not pass bare ID across semantic boundaries.
type ID string
func New() (ID, error) {
var b [16]byte
if _, err := rand.Read(b[:]); err != nil {
return "", fmt.Errorf("generate id: %w", err)
}
return ID(hex.EncodeToString(b[:])), nil
}