From ee075055acdd9ee7fcdacd900105003176ce9456 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Mon, 19 Sep 2022 09:26:00 -0700
Subject: [PATCH] fixed some more stuff in channels

---
 channels/interface.go          |  4 ++--
 channels/joinedChannel_test.go | 27 +++------------------------
 2 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/channels/interface.go b/channels/interface.go
index 01e406603..622ee6802 100644
--- a/channels/interface.go
+++ b/channels/interface.go
@@ -12,7 +12,7 @@ import (
 	"gitlab.com/elixxir/client/cmix/rounds"
 	cryptoBroadcast "gitlab.com/elixxir/crypto/broadcast"
 	cryptoChannel "gitlab.com/elixxir/crypto/channel"
-	"gitlab.com/xx_network/crypto/signature/rsa"
+	"gitlab.com/elixxir/crypto/rsa"
 	"gitlab.com/xx_network/primitives/id"
 	"gitlab.com/xx_network/primitives/id/ephemeral"
 	"math"
@@ -51,7 +51,7 @@ type Manager interface {
 	// should be wrapped in a function which defines the wire protocol
 	// If the final message, before being sent over the wire, is too long, this will
 	// return an error. The message must be at most 510 bytes long.
-	SendAdminGeneric(privKey *rsa.PrivateKey, channelID *id.ID,
+	SendAdminGeneric(privKey rsa.PrivateKey, channelID *id.ID,
 		messageType MessageType, msg []byte, validUntil time.Duration,
 		params cmix.CMIXParams) (cryptoChannel.MessageID, rounds.Round,
 		ephemeral.Id, error)
diff --git a/channels/joinedChannel_test.go b/channels/joinedChannel_test.go
index d7b9533bd..0e1c812b4 100644
--- a/channels/joinedChannel_test.go
+++ b/channels/joinedChannel_test.go
@@ -17,7 +17,6 @@ import (
 	"gitlab.com/elixxir/client/storage/versioned"
 	cryptoBroadcast "gitlab.com/elixxir/crypto/broadcast"
 	cryptoChannel "gitlab.com/elixxir/crypto/channel"
-	"gitlab.com/elixxir/crypto/cmix"
 	"gitlab.com/elixxir/crypto/fastRNG"
 	"gitlab.com/elixxir/crypto/rsa"
 	"gitlab.com/elixxir/ekv"
@@ -446,29 +445,9 @@ func Test_makeJoinedChannelKey_Consistency(t *testing.T) {
 // cryptoBroadcast.NewChannel does but with a smaller RSA key and salt to make
 // tests run quicker.
 func newTestChannel(name, description string, rng csprng.Source) (
-	*cryptoBroadcast.Channel, *rsa.PrivateKey, error) {
-	// Uses 128 bits instead of 4096 bits
-	pk, err := rsa.GenerateKey(rng, 128)
-	if err != nil {
-		return nil, nil, err
-	}
-
-	// Uses 16 bits instead of 512 bits
-	salt := cmix.NewSalt(rng, 16)
-
-	channelID, err := cryptoBroadcast.NewChannelID(
-		name, description, salt, rsa.CreatePublicKeyPem(pk.GetPublic()))
-	if err != nil {
-		return nil, nil, err
-	}
-
-	return &cryptoBroadcast.Channel{
-		ReceptionID: channelID,
-		Name:        name,
-		Description: description,
-		Salt:        salt,
-		RsaPubKey:   pk.GetPublic(),
-	}, pk, nil
+	*cryptoBroadcast.Channel, rsa.PrivateKey, error) {
+	c, pk, err := cryptoBroadcast.NewChannel(name, description, 1000, rng)
+	return c, pk, err
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-- 
GitLab