From 961a394f41cbeb8f08d251f640d189acabe12d98 Mon Sep 17 00:00:00 2001 From: "Richard T. Carback III" <rick.carback@gmail.com> Date: Mon, 18 Apr 2022 21:39:51 +0000 Subject: [PATCH] we don't need the mock backup interface for this --- backup/utils_test.go | 157 ------------------------------------------- 1 file changed, 157 deletions(-) delete mode 100644 backup/utils_test.go diff --git a/backup/utils_test.go b/backup/utils_test.go deleted file mode 100644 index 9a1d03976..000000000 --- a/backup/utils_test.go +++ /dev/null @@ -1,157 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Copyright © 2020 xx network SEZC // -// // -// Use of this source code is governed by a license that can be found in the // -// LICENSE file // -//////////////////////////////////////////////////////////////////////////////// - -package backup - -import ( - "testing" - "time" - - "gitlab.com/elixxir/crypto/cyclic" - "gitlab.com/elixxir/primitives/fact" - "gitlab.com/xx_network/crypto/large" - "gitlab.com/xx_network/crypto/signature/rsa" - "gitlab.com/xx_network/primitives/id" -) - -// Adheres to the E2e interface. -type mockE2e struct { - partnerIDs []*id.ID - historicalDHPubkey *cyclic.Int - historicalDHPrivkey *cyclic.Int -} - -func newMockE2e(t testing.TB) *mockE2e { - grp := cyclic.NewGroup(large.NewInt(173), large.NewInt(0)) - return &mockE2e{ - partnerIDs: []*id.ID{ - id.NewIdFromString("partner1", id.User, t), - id.NewIdFromString("partner2", id.User, t), - id.NewIdFromString("partner3", id.User, t), - }, - historicalDHPubkey: grp.NewInt(45), - historicalDHPrivkey: grp.NewInt(46), - } -} -func (m *mockE2e) GetAllPartnerIDs() []*id.ID { return m.partnerIDs } -func (m *mockE2e) GetHistoricalDHPubkey() *cyclic.Int { return m.historicalDHPubkey } -func (m *mockE2e) GetHistoricalDHPrivkey() *cyclic.Int { return m.historicalDHPrivkey } - -// Adheres to the Session interface. -type mockSession struct { - regCode string - transmissionID *id.ID - transmissionSalt []byte - receptionID *id.ID - receptionSalt []byte - receptionRSA *rsa.PrivateKey - transmissionRSA *rsa.PrivateKey - transmissionRegistrationValidationSignature []byte - receptionRegistrationValidationSignature []byte - registrationTimestamp time.Time -} - -func newMockSession(t testing.TB) *mockSession { - receptionRSA, _ := rsa.LoadPrivateKeyFromPem([]byte(privKey)) - transmissionRSA, _ := rsa.LoadPrivateKeyFromPem([]byte(privKey)) - - return &mockSession{ - regCode: "regCode", - transmissionID: id.NewIdFromString("transmission", id.User, t), - transmissionSalt: []byte("transmissionSalt"), - receptionID: id.NewIdFromString("reception", id.User, t), - receptionSalt: []byte("receptionSalt"), - receptionRSA: receptionRSA, - transmissionRSA: transmissionRSA, - transmissionRegistrationValidationSignature: []byte("transmissionSig"), - receptionRegistrationValidationSignature: []byte("receptionSig"), - registrationTimestamp: time.Date(2012, 12, 21, 22, 8, 41, 0, time.UTC), - } - -} -func (m mockSession) GetRegCode() (string, error) { return m.regCode, nil } -func (m mockSession) GetTransmissionID() *id.ID { return m.transmissionID } -func (m mockSession) GetTransmissionSalt() []byte { return m.transmissionSalt } -func (m mockSession) GetReceptionID() *id.ID { return m.receptionID } -func (m mockSession) GetReceptionSalt() []byte { return m.receptionSalt } -func (m mockSession) GetReceptionRSA() *rsa.PrivateKey { return m.receptionRSA } -func (m mockSession) GetTransmissionRSA() *rsa.PrivateKey { return m.transmissionRSA } -func (m mockSession) GetTransmissionRegistrationValidationSignature() []byte { - return m.transmissionRegistrationValidationSignature -} -func (m mockSession) GetReceptionRegistrationValidationSignature() []byte { - return m.receptionRegistrationValidationSignature -} -func (m mockSession) GetRegistrationTimestamp() time.Time { return m.registrationTimestamp } - -// Adheres to the UserDiscovery interface. -type mockUserDiscovery struct { - facts fact.FactList -} - -func newMockUserDiscovery() *mockUserDiscovery { - return &mockUserDiscovery{facts: fact.FactList{ - {"myUserName", fact.Username}, - {"hello@example.com", fact.Email}, - {"6175555212", fact.Phone}, - {"name", fact.Nickname}, - }} -} -func (m mockUserDiscovery) GetFacts() fact.FactList { return m.facts } - -const privKey = `-----BEGIN PRIVATE KEY----- -MIIJQQIBADANBgkqhkiG9w0BAQEFA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