MCPcopy Index your code
hub / github.com/jetify-com/devbox / userID

Function userID

internal/telemetry/telemetry.go:71–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69}
70
71func userID() string {
72 // TODO, once we add access token parsing, use that instead of id token.
73 // that will work with API_TOKEN as well.
74 if tok, err := identity.Peek(); err == nil && tok.IDClaims() != nil {
75 return tok.IDClaims().Subject
76 }
77 if username := os.Getenv(envir.GitHubUsername); username != "" {
78 const uidSalt = "d6134cd5-347d-4b7c-a2d0-295c0f677948"
79 const githubPrefix = "github:"
80
81 // userID is a v5 UUID which is basically a SHA hash of the username.
82 // See https://www.uuidtools.com/uuid-versions-explained for a comparison of UUIDs.
83 return uuid.NewSHA1(uuid.MustParse(uidSalt), []byte(githubPrefix+username)).String()
84 }
85 return ""
86}
87
88func orgID() string {
89 // TODO, once we add access token parsing, use that instead of id token.

Callers 2

newTrackMessageFunction · 0.85
ErrorFunction · 0.85

Calls 2

PeekFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected