-Critical change: trim newline from private key

-commented out newline investigation in Test_KeyGenerationAndHandling
-Test_KeyGnerationAndHandling works as expected now.
This commit is contained in:
Haris Khan
2024-09-15 21:48:51 -04:00
parent ada0d39af4
commit 6c95fc6ac7
2 changed files with 17 additions and 6 deletions

View File

@ -156,9 +156,12 @@ func Test_I2PAddrToBytes(t *testing.T) {
}
})
}
func removeNewlines(s string) string {
return strings.ReplaceAll(strings.ReplaceAll(s, "\r\n", ""), "\n", "")
}
/*
func removeNewlines(s string) string {
return strings.ReplaceAll(strings.ReplaceAll(s, "\r\n", ""), "\n", "")
}
*/
func Test_KeyGenerationAndHandling(t *testing.T) {
// Generate new keys
keys, err := NewDestination()
@ -190,9 +193,11 @@ func Test_KeyGenerationAndHandling(t *testing.T) {
}
if loadedKeys.Both != keys.Both {
t.Errorf("LoadKeysIncompat returned incorrect pair. Got '%s'\nwant '%s'\n", loadedKeys.Both, keys.Both)
if loadedKeys.Both == removeNewlines(keys.Both) {
fmt.Println("However, both pairs are correct if newline is removed in generated keys.")
}
/*
if loadedKeys.Both == removeNewlines(keys.Both) {
fmt.Println("However, both pairs are correct if newline is removed in generated keys.")
}
*/
}
})