From 027bc6b70c4ab8bd04c7f3f861935d5c61c7d081 Mon Sep 17 00:00:00 2001
From: Benjamin Wenger <ben@elixxir.ioo>
Date: Fri, 16 Oct 2020 16:49:06 -0700
Subject: [PATCH] mode precanned e2e key generation predicable

---
 api/user.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/api/user.go b/api/user.go
index 1f90d7c92..118db9d47 100644
--- a/api/user.go
+++ b/api/user.go
@@ -9,6 +9,7 @@ import (
 	"gitlab.com/elixxir/crypto/xx"
 	"gitlab.com/xx_network/crypto/signature/rsa"
 	"gitlab.com/xx_network/primitives/id"
+	"math/rand"
 )
 
 const (
@@ -73,7 +74,8 @@ func createPrecannedUser(precannedID uint, rng csprng.Source, cmix, e2e *cyclic.
 	// FIXME: Why 256 bits? -- this is spec but not explained, it has
 	// to do with optimizing operations on one side and still preserves
 	// decent security -- cite this. Why valid for BOTH e2e and cmix?
-	e2eKeyBytes, err := csprng.GenerateInGroup(e2e.GetPBytes(), 256, rng)
+	prng := rand.New(rand.NewSource(int64(precannedID)))
+	e2eKeyBytes, err := csprng.GenerateInGroup(e2e.GetPBytes(), 256, prng)
 	if err != nil {
 		jww.FATAL.Panicf(err.Error())
 	}
-- 
GitLab