refactor/internal (#1216)

* refactor: update import paths in gateway handlers

* refactor: remove obsolete devtools Makefile and README

* build: optimize build process for improved efficiency

* refactor: remove obsolete pkl files related to Matrix and Sonr network configurations

* refactor: move embed code to x/dwn/types
This commit is contained in:
Prad Nukala
2024-12-24 16:10:20 +00:00
committed by GitHub
parent 0ec2f7d86a
commit 47c3a53080
356 changed files with 402 additions and 1613 deletions
-50
View File
@@ -1,50 +0,0 @@
// Package ottest contains some utilities to test ot functions. The main goal is to reduce the code duplication in
// various other packages that need to run an OT in their test setup stage.
package ottest
import (
"github.com/pkg/errors"
"github.com/onsonr/sonr/crypto/core/curves"
"github.com/onsonr/sonr/crypto/ot/base/simplest"
)
// RunSimplestOT is a utility function used _only_ during various tests.
// essentially, it encapsulates the entire process of running a base OT, so that other tests can use it / bootstrap themselves.
// it handles the creation of the base OT sender and receiver, as well as orchestrates the rounds on them;
// it returns their outsputs, so that others can use them.
func RunSimplestOT(curve *curves.Curve, batchSize int, uniqueSessionId [simplest.DigestSize]byte) (*simplest.SenderOutput, *simplest.ReceiverOutput, error) {
receiver, err := simplest.NewReceiver(curve, batchSize, uniqueSessionId)
if err != nil {
return nil, nil, errors.Wrap(err, "constructing OT receiver in run simplest OT")
}
sender, err := simplest.NewSender(curve, batchSize, uniqueSessionId)
if err != nil {
return nil, nil, errors.Wrap(err, "constructing OT sender in run simplest OT")
}
proof, err := sender.Round1ComputeAndZkpToPublicKey()
if err != nil {
return nil, nil, errors.Wrap(err, "sender round 1 in run simplest OT")
}
receiversMaskedChoice, err := receiver.Round2VerifySchnorrAndPadTransfer(proof)
if err != nil {
return nil, nil, errors.Wrap(err, "receiver round 2 in run simplest OT")
}
challenge, err := sender.Round3PadTransfer(receiversMaskedChoice)
if err != nil {
return nil, nil, errors.Wrap(err, "sender round 3 in run simplest OT")
}
challengeResponse, err := receiver.Round4RespondToChallenge(challenge)
if err != nil {
return nil, nil, errors.Wrap(err, "receiver round 4 in run simplest OT")
}
challengeOpenings, err := sender.Round5Verify(challengeResponse)
if err != nil {
return nil, nil, errors.Wrap(err, "sender round 5 in run simplest OT")
}
err = receiver.Round6Verify(challengeOpenings)
if err != nil {
return nil, nil, errors.Wrap(err, "receiver round 6 in run simplest OT")
}
return sender.Output, receiver.Output, nil
}