MCPcopy
hub / github.com/wavetermdev/waveterm / ExtractUnverifiedSocketName

Function ExtractUnverifiedSocketName

pkg/wshutil/wshutil.go:373–388  ·  view source on GitHub ↗

only for use on client

(tokenStr string)

Source from the content-addressed store, hash-verified

371
372// only for use on client
373func ExtractUnverifiedSocketName(tokenStr string) (string, error) {
374 token, _, err := new(jwt.Parser).ParseUnverified(tokenStr, &wavejwt.WaveJwtClaims{})
375 if err != nil {
376 return "", fmt.Errorf("error parsing token: %w", err)
377 }
378 claims, ok := token.Claims.(*wavejwt.WaveJwtClaims)
379 if !ok {
380 return "", fmt.Errorf("error getting claims from token")
381 }
382 sockName := claims.Sock
383 if sockName == "" {
384 return "", fmt.Errorf("sock claim is missing or invalid")
385 }
386 sockName = wavebase.ExpandHomeDirSafe(sockName)
387 return sockName, nil
388}
389
390func getShell() string {
391 if runtime.GOOS == "darwin" {

Callers 4

ConnectMethod · 0.92
setupRpcClientFunction · 0.92
serverRunNormalFunction · 0.92

Calls 1

ExpandHomeDirSafeFunction · 0.92

Tested by

no test coverage detected