MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / resolveAuthPath

Method resolveAuthPath

internal/store/objectstore.go:518–541  ·  view source on GitHub ↗
(auth *cliproxyauth.Auth)

Source from the content-addressed store, hash-verified

516}
517
518func (s *ObjectTokenStore) resolveAuthPath(auth *cliproxyauth.Auth) (string, error) {
519 if auth == nil {
520 return "", fmt.Errorf("object store: auth is nil")
521 }
522 if auth.Attributes != nil {
523 if path := strings.TrimSpace(auth.Attributes["path"]); path != "" {
524 if filepath.IsAbs(path) {
525 return path, nil
526 }
527 return filepath.Join(s.authDir, path), nil
528 }
529 }
530 fileName := strings.TrimSpace(auth.FileName)
531 if fileName == "" {
532 fileName = strings.TrimSpace(auth.ID)
533 }
534 if fileName == "" {
535 return "", fmt.Errorf("object store: auth %s missing filename", auth.ID)
536 }
537 if !strings.HasSuffix(strings.ToLower(fileName), ".json") {
538 fileName += ".json"
539 }
540 return filepath.Join(s.authDir, fileName), nil
541}
542
543func (s *ObjectTokenStore) resolveDeletePath(id string) (string, error) {
544 id = strings.TrimSpace(id)

Callers 1

SaveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected