()
| 24 | } |
| 25 | |
| 26 | func defaultKeyring() (Keyring, error) { |
| 27 | ucd, err := os.UserConfigDir() |
| 28 | if err != nil { |
| 29 | return nil, err |
| 30 | } |
| 31 | |
| 32 | return keyring.Open(keyring.Config{ |
| 33 | // only use the file backend until https://github.com/99designs/keyring/issues/74 is resolved |
| 34 | AllowedBackends: []keyring.BackendType{ |
| 35 | keyring.FileBackend, |
| 36 | }, |
| 37 | |
| 38 | ServiceName: "git-bug", |
| 39 | |
| 40 | // Fallback encrypted file |
| 41 | FileDir: filepath.Join(ucd, "git-bug", "keyring"), |
| 42 | // As we write the file in the user's config directory, this file should already be protected by the OS against |
| 43 | // other user's access. We actually don't terribly need to protect it further and a password prompt across all |
| 44 | // UI's would be a pain. Therefore we use here a constant password so the file will be unreadable by generic file |
| 45 | // scanners if the user's machine get compromised. |
| 46 | FilePasswordFunc: func(string) (string, error) { |
| 47 | return "git-bug", nil |
| 48 | }, |
| 49 | }) |
| 50 | } |
| 51 | |
| 52 | // replaceKeyring allow to replace the Keyring of the underlying repo |
| 53 | type replaceKeyring struct { |
no test coverage detected