mirror of
https://github.com/sonr-io/crypto.git
synced 2026-08-02 15:31:38 +00:00
refactor(crypto): simplify elliptic curve implementation
This commit is contained in:
@@ -15,9 +15,9 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
"github.com/sonr-io/sonr/crypto/sharing"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
"github.com/sonr-io/crypto/sharing"
|
||||
)
|
||||
|
||||
// Round1Bcast are values that are broadcast to all other participants
|
||||
|
||||
@@ -9,9 +9,9 @@ package frost
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
"github.com/sonr-io/sonr/crypto/sharing"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
"github.com/sonr-io/crypto/sharing"
|
||||
)
|
||||
|
||||
// Round2Bcast are values that are broadcast to all other participants
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/sharing"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/sharing"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -10,9 +10,9 @@ package frost
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
"github.com/sonr-io/sonr/crypto/sharing"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
"github.com/sonr-io/crypto/sharing"
|
||||
)
|
||||
|
||||
type DkgParticipant struct {
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"crypto/elliptic"
|
||||
"fmt"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
// Participant is a DKG player that contains information needed to perform DKG rounds
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
)
|
||||
|
||||
var testGenerator, _ = curves.NewScalarBaseMult(btcec.S256(), big.NewInt(3333))
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/core"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
// Round1Bcast are the values that are broadcast to all other participants
|
||||
|
||||
@@ -9,8 +9,8 @@ package gennaro
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
type Round2Bcast = []*v1.ShareVerifier
|
||||
|
||||
@@ -9,8 +9,8 @@ package gennaro
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
// Round3Bcast contains values that will be broadcast to other participants.
|
||||
|
||||
@@ -9,10 +9,10 @@ package gennaro
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core"
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/internal"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/core"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/internal"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
// Round4 computes the public shares used by tECDSA during signing
|
||||
|
||||
@@ -13,8 +13,8 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
func TestParticipantRound1Works(t *testing.T) {
|
||||
|
||||
@@ -15,9 +15,9 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
"github.com/sonr-io/sonr/crypto/dkg/gennaro"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
"github.com/sonr-io/crypto/dkg/gennaro"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
const threshold = 2
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
||||
"github.com/sonr-io/crypto/core/curves"
|
||||
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user