Download sdk/auth/store_registry.go from shimen/API: direct link, hf CLI and curl.
- Browser
- Download file 697 Bytes
-
https://huggingface.co/spaces/shimen/API/resolve/main/sdk/auth/store_registry.go
- Command line
-
hf download hf://spaces/shimen/API/sdk/auth/store_registry.go
-
curl -L -o store_registry.go https://huggingface.co/spaces/shimen/API/resolve/main/sdk/auth/store_registry.go
697 Bytes
| package auth | |
| import ( | |
| "sync" | |
| coreauth "github.com/router-for-me/CLIProxyAPI/v6/sdk/cliproxy/auth" | |
| ) | |
| var ( | |
| storeMu sync.RWMutex | |
| registeredStore coreauth.Store | |
| ) | |
| // RegisterTokenStore sets the global token store used by the authentication helpers. | |
| func RegisterTokenStore(store coreauth.Store) { | |
| storeMu.Lock() | |
| registeredStore = store | |
| storeMu.Unlock() | |
| } | |
| // GetTokenStore returns the globally registered token store. | |
| func GetTokenStore() coreauth.Store { | |
| storeMu.RLock() | |
| s := registeredStore | |
| storeMu.RUnlock() | |
| if s != nil { | |
| return s | |
| } | |
| storeMu.Lock() | |
| defer storeMu.Unlock() | |
| if registeredStore == nil { | |
| registeredStore = NewFileTokenStore() | |
| } | |
| return registeredStore | |
| } | |