KeyExists checks if the SSH key file exists for a given UUID
(uuid string)
| 19 | |
| 20 | // KeyExists checks if the SSH key file exists for a given UUID |
| 21 | func KeyExists(uuid string) bool { |
| 22 | keyFile := GetKeyFile(uuid) |
| 23 | if keyFile == "" { |
| 24 | return false |
| 25 | } |
| 26 | _, err := os.Stat(keyFile) |
| 27 | return err == nil |
| 28 | } |
| 29 | |
| 30 | // SavePrivateKey writes the private key to disk with appropriate permissions |
| 31 | func SavePrivateKey(uuid, privateKey string) error { |