MCPcopy Create free account
hub / github.com/basecamp/hey-cli / MigrateToKeyring

Method MigrateToKeyring

internal/auth/store.go:209–228  ·  view source on GitHub ↗

MigrateToKeyring migrates credentials from file to keyring.

()

Source from the content-addressed store, hash-verified

207
208// MigrateToKeyring migrates credentials from file to keyring.
209func (s *Store) MigrateToKeyring() error {
210 s.ensureInit()
211 if !s.useKeyring {
212 return nil
213 }
214
215 all, err := s.loadAllFromFile()
216 if err != nil {
217 return nil //nolint:nilerr // No file to migrate is not an error
218 }
219
220 for origin, creds := range all {
221 if err := s.saveToKeyring(origin, creds); err != nil {
222 return fmt.Errorf("failed to migrate %s: %w", origin, err)
223 }
224 }
225
226 _ = os.Remove(s.credentialsPath())
227 return nil
228}
229
230// UsingKeyring returns true if the store is using the system keyring.
231func (s *Store) UsingKeyring() bool {

Callers

nothing calls this directly

Calls 4

ensureInitMethod · 0.95
loadAllFromFileMethod · 0.95
saveToKeyringMethod · 0.95
credentialsPathMethod · 0.95

Tested by

no test coverage detected