-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

@ -337,6 +337,10 @@ HELLO VERSION MIN=3.1 MAX=3.1
DEST GENERATE SIGNATURE_TYPE=7
*/
func NewDestination() (*I2PKeys, error) {
removeNewlines := func(s string) string {
return strings.ReplaceAll(strings.ReplaceAll(s, "\r\n", ""), "\n", "")
}
//
conn, err := net.Dial("tcp", "127.0.0.1:7656")
if err != nil {
return nil, err
@ -369,6 +373,8 @@ func NewDestination() (*I2PKeys, error) {
pub := strings.Split(strings.Split(string(buf[:n]), "PRIV=")[0], "PUB=")[1]
priv := strings.Split(string(buf[:n]), "PRIV=")[1]
priv = removeNewlines(priv) //There is an extraneous newline in the private key, so we'll remove it.
return &I2PKeys{
Address: I2PAddr(pub),
Both: pub + priv,