pass sigType to NewRouterInfo

This commit is contained in:
Haris Khan
2024-11-15 11:49:10 -05:00
parent e29c3c7abb
commit 015c4b23e2
2 changed files with 4 additions and 2 deletions

View File

@@ -349,6 +349,7 @@ func NewRouterInfo(
addresses []*RouterAddress, addresses []*RouterAddress,
options map[string]string, options map[string]string,
signingPrivateKey crypto.SigningPrivateKey, signingPrivateKey crypto.SigningPrivateKey,
sigType int,
) (*RouterInfo, error) { ) (*RouterInfo, error) {
log.Debug("Creating new RouterInfo") log.Debug("Creating new RouterInfo")
@@ -409,7 +410,7 @@ func NewRouterInfo(
} }
// 8. Create Signature struct from signatureBytes // 8. Create Signature struct from signatureBytes
sig, _, err := ReadSignature(signatureBytes, 7) // Refactor this later sig, _, err := ReadSignature(signatureBytes, sigType)
if err != nil { if err != nil {
log.WithError(err).Error("Failed to create Signature from signature bytes") log.WithError(err).Error("Failed to create Signature from signature bytes")
return nil, err return nil, err

View File

@@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"crypto/rand" "crypto/rand"
"encoding/binary" "encoding/binary"
"github.com/go-i2p/go-i2p/lib/common/signature"
"testing" "testing"
"time" "time"
@@ -92,7 +93,7 @@ func TestCreateRouterInfo(t *testing.T) {
} }
routerAddresses := []*router_address.RouterAddress{routerAddress} routerAddresses := []*router_address.RouterAddress{routerAddress}
// create router info // create router info
routerInfo, err := NewRouterInfo(routerIdentity, time.Now(), routerAddresses, nil, &ed25519_privkey) routerInfo, err := NewRouterInfo(routerIdentity, time.Now(), routerAddresses, nil, &ed25519_privkey, signature.SIGNATURE_TYPE_EDDSA_SHA512_ED25519)
if err != nil { if err != nil {
t.Fatalf("Failed to create router info: %v\n", err) t.Fatalf("Failed to create router info: %v\n", err)
} }