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

Method EnsureIndex

sdk/cliproxy/auth/types.go:378–397  ·  view source on GitHub ↗

EnsureIndex returns a stable index derived from the auth file name or credential identity.

()

Source from the content-addressed store, hash-verified

376
377// EnsureIndex returns a stable index derived from the auth file name or credential identity.
378func (a *Auth) EnsureIndex() string {
379 if a == nil {
380 return ""
381 }
382 if existingIndex := strings.TrimSpace(a.Index); existingIndex != "" {
383 a.Index = existingIndex
384 a.indexAssigned = true
385 return existingIndex
386 }
387
388 seed := a.indexSeed()
389 if seed == "" {
390 return ""
391 }
392
393 idx := stableAuthIndex(seed)
394 a.Index = idx
395 a.indexAssigned = true
396 return idx
397}
398
399// Clone duplicates a model state including nested error details.
400func (m *ModelState) Clone() *ModelState {

Calls 2

indexSeedMethod · 0.95
stableAuthIndexFunction · 0.85