()
| 41 | } |
| 42 | |
| 43 | func (s *Store) ensureInit() { |
| 44 | s.initOnce.Do(func() { |
| 45 | if s.noKeyring { |
| 46 | return |
| 47 | } |
| 48 | testKey := "hey::test" |
| 49 | err := keyring.Set(serviceName, testKey, "test") |
| 50 | if err == nil { |
| 51 | _ = keyring.Delete(serviceName, testKey) |
| 52 | s.useKeyring = true |
| 53 | return |
| 54 | } |
| 55 | fmt.Fprintf(os.Stderr, "warning: system keyring unavailable, credentials stored in plaintext at %s\n", |
| 56 | filepath.Join(s.fallbackDir, "credentials.json")) |
| 57 | }) |
| 58 | } |
| 59 | |
| 60 | func key(origin string) string { |
| 61 | return fmt.Sprintf("hey::%s", origin) |
no test coverage detected