diff --git a/main.go b/main.go index 0fde6d1..930ebd4 100644 --- a/main.go +++ b/main.go @@ -71,6 +71,7 @@ func main() { clifs.CreateFile(privateKeyFile, apiKey.TkPrivateKey, 0700) jsonBytes, err := json.MarshalIndent(map[string]interface{}{ + "publicKey": apiKey.TkPublicKey, "publicKeyFile": publicKeyFile, "privateKeyFile": privateKeyFile, }, "", " ") @@ -78,7 +79,6 @@ func main() { log.Fatalf("Unable to serialize output to JSON: %v", err) } fmt.Println(string(jsonBytes)) - fmt.Printf("\nYour public key for Turnkey is:\n%s\n", apiKey.TkPublicKey) } return nil diff --git a/main_test.go b/main_test.go index fd6da14..891de10 100644 --- a/main_test.go +++ b/main_test.go @@ -56,9 +56,13 @@ func TestKeygenInTmpFolder(t *testing.T) { assert.FileExists(t, tmpDir+"/mykey.public") assert.FileExists(t, tmpDir+"/mykey.private") + publicKeyData, err := os.ReadFile(tmpDir + "/mykey.public") + assert.Nil(t, err) + var parsedOut map[string]string err = json.Unmarshal([]byte(out), &parsedOut) assert.Nil(t, err) + assert.Equal(t, parsedOut["publicKey"], string(publicKeyData)) assert.Equal(t, parsedOut["publicKeyFile"], tmpDir+"/mykey.public") assert.Equal(t, parsedOut["privateKeyFile"], tmpDir+"/mykey.private") }