refactor(crypto): simplify elliptic curve implementation

This commit is contained in:
2025-10-09 15:11:59 -04:00
parent a934caa7d3
commit 7d339ae522
205 changed files with 380 additions and 380 deletions

View File

@@ -16,7 +16,7 @@ import (
"git.sr.ht/~sircmpwn/go-bare"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
type structMarshal struct {

View File

@@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestNewAccumulator100(t *testing.T) {

View File

@@ -12,7 +12,7 @@ import (
"git.sr.ht/~sircmpwn/go-bare"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// SecretKey is the secret alpha only held by the accumulator manager.

View File

@@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestSecretKeyMarshal(t *testing.T) {

View File

@@ -10,7 +10,7 @@ import (
"fmt"
"math"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// dad constructs two polynomials - dA(x) and dD(x)

View File

@@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestEvaluatePolyG1(t *testing.T) {

View File

@@ -14,7 +14,7 @@ import (
"git.sr.ht/~sircmpwn/go-bare"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
type proofParamsMarshal struct {

View File

@@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestProofParamsMarshal(t *testing.T) {

View File

@@ -12,7 +12,7 @@ import (
"git.sr.ht/~sircmpwn/go-bare"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// MembershipWitness contains the witness c and the value y respect to the accumulator state.

View File

@@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func Test_Membership_Witness_New(t *testing.T) {

View File

@@ -10,7 +10,7 @@ import (
"github.com/pkg/errors"
"golang.org/x/crypto/sha3"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// generators contains a list of points to be used as generators for bulletproofs.

View File

@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/crypto/sha3"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestGeneratorsHappyPath(t *testing.T) {

View File

@@ -9,7 +9,7 @@ package bulletproof
import (
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// innerProduct takes two lists of scalars (a, b) and performs the dot product returning a single scalar.

View File

@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestInnerProductHappyPath(t *testing.T) {

View File

@@ -11,7 +11,7 @@ import (
"github.com/gtank/merlin"
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// InnerProductProver is the struct used to create InnerProductProofs

View File

@@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestIPPHappyPath(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"github.com/gtank/merlin"
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// InnerProductVerifier is the struct used to verify inner product proofs

View File

@@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestIPPVerifyHappyPath(t *testing.T) {

View File

@@ -6,7 +6,7 @@ import (
"github.com/gtank/merlin"
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// BatchProve proves that a list of scalars v are in the range n.

View File

@@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestRangeBatchProverHappyPath(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"github.com/gtank/merlin"
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// VerifyBatched verifies a given batched range proof.

View File

@@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestRangeBatchVerifyHappyPath(t *testing.T) {

View File

@@ -14,7 +14,7 @@ import (
"github.com/gtank/merlin"
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// RangeProver is the struct used to create RangeProofs

View File

@@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestRangeProverHappyPath(t *testing.T) {

View File

@@ -4,7 +4,7 @@ import (
"github.com/gtank/merlin"
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// RangeVerifier is the struct used to verify RangeProofs

View File

@@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
func TestRangeVerifyHappyPath(t *testing.T) {

View File

@@ -19,7 +19,7 @@ import (
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
"golang.org/x/crypto/sha3"
"github.com/sonr-io/sonr/crypto/core"
"github.com/sonr-io/crypto/core"
)
// See 'r' = https://eprint.iacr.org/2018/962.pdf Figure 16

View File

@@ -13,9 +13,9 @@ import (
"golang.org/x/crypto/sha3"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/bls12381"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/bls12381"
"github.com/sonr-io/crypto/internal"
)
var bls12381modulus = bhex(

View File

@@ -16,7 +16,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native/bls12381"
"github.com/sonr-io/crypto/core/curves/native/bls12381"
)
var (

View File

@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core"
"github.com/sonr-io/crypto/core"
)
// TestAdditionalCurveSupport tests the new curve support in hash.go

View File

@@ -12,10 +12,10 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/core"
"github.com/sonr-io/crypto/core"
"github.com/dustinxie/ecc"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
var curveNameToID = map[string]byte{

View File

@@ -15,8 +15,8 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core"
tt "github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core"
tt "github.com/sonr-io/crypto/internal"
)
func TestIsIdentity(t *testing.T) {

View File

@@ -18,9 +18,9 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/bwesterb/go-ristretto"
"github.com/sonr-io/sonr/crypto/core"
"github.com/sonr-io/sonr/crypto/core/curves/native/bls12381"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core"
"github.com/sonr-io/crypto/core/curves/native/bls12381"
"github.com/sonr-io/crypto/internal"
)
type EcScalar interface {

View File

@@ -19,7 +19,7 @@ import (
"github.com/bwesterb/go-ristretto"
ed "github.com/bwesterb/go-ristretto/edwards25519"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
type ScalarEd25519 struct {

View File

@@ -15,7 +15,7 @@ import (
ed "filippo.io/edwards25519"
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
func TestScalarEd25519Random(t *testing.T) {

View File

@@ -9,8 +9,8 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
mod "github.com/sonr-io/sonr/crypto/core"
"github.com/sonr-io/sonr/crypto/internal"
mod "github.com/sonr-io/crypto/core"
"github.com/sonr-io/crypto/internal"
)
func BenchmarkK256(b *testing.B) {

View File

@@ -15,11 +15,11 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/sonr-io/sonr/crypto/core/curves/native"
secp256k1 "github.com/sonr-io/sonr/crypto/core/curves/native/k256"
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fp"
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fq"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
secp256k1 "github.com/sonr-io/crypto/core/curves/native/k256"
"github.com/sonr-io/crypto/core/curves/native/k256/fp"
"github.com/sonr-io/crypto/core/curves/native/k256/fq"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -3,7 +3,7 @@ package bls12381
import (
"math/bits"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var fqModulusBytes = [native.FieldBytes]byte{

View File

@@ -6,8 +6,8 @@ import (
"io"
"math/big"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
// fp field element mod p

View File

@@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
func TestFpSetOne(t *testing.T) {

View File

@@ -5,7 +5,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
type Fq [native.FieldLimbs]uint64

View File

@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFqSetOne(t *testing.T) {

View File

@@ -7,8 +7,8 @@ import (
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
func TestG1IsOnCurve(t *testing.T) {

View File

@@ -7,8 +7,8 @@ import (
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
func TestG2IsOnCurve(t *testing.T) {

View File

@@ -3,8 +3,8 @@ package bls12381
import (
"io"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
// GtFieldBytes is the number of bytes needed to represent this field

View File

@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
func TestSinglePairing(t *testing.T) {

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
// FieldLimbs is the number of limbs needed to represent this field

View File

@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (

View File

@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFpSetOne(t *testing.T) {

View File

@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (

View File

@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFqSetOne(t *testing.T) {

View File

@@ -3,9 +3,9 @@ package k256
import (
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fp"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/k256/fp"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -5,8 +5,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/k256"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/k256"
)
func TestK256PointArithmetic_Hash(t *testing.T) {

View File

@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (

View File

@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFpSetOne(t *testing.T) {

View File

@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (

View File

@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFqSetOne(t *testing.T) {

View File

@@ -3,9 +3,9 @@ package p256
import (
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -6,10 +6,10 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/p256"
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
)
func TestP256PointArithmetic_Double(t *testing.T) {

View File

@@ -11,7 +11,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
type Fp fiat_pasta_fp_montgomery_domain_field_element

View File

@@ -11,7 +11,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
type Fq fiat_pasta_fq_montgomery_domain_field_element

View File

@@ -16,7 +16,7 @@ import (
"math/big"
"testing"
"github.com/sonr-io/sonr/crypto/core"
"github.com/sonr-io/crypto/core"
)
func BenchmarkP256(b *testing.B) {

View File

@@ -13,11 +13,11 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
p256n "github.com/sonr-io/sonr/crypto/core/curves/native/p256"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fq"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
p256n "github.com/sonr-io/crypto/core/curves/native/p256"
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/crypto/core/curves/native/p256/fq"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -18,8 +18,8 @@ import (
"golang.org/x/crypto/blake2b"
"github.com/sonr-io/sonr/crypto/core/curves/native/pasta/fp"
"github.com/sonr-io/sonr/crypto/core/curves/native/pasta/fq"
"github.com/sonr-io/crypto/core/curves/native/pasta/fp"
"github.com/sonr-io/crypto/core/curves/native/pasta/fq"
)
var (

View File

@@ -12,8 +12,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native/pasta/fp"
"github.com/sonr-io/sonr/crypto/core/curves/native/pasta/fq"
"github.com/sonr-io/crypto/core/curves/native/pasta/fp"
"github.com/sonr-io/crypto/core/curves/native/pasta/fq"
)
func TestPointPallasAddDoubleMul(t *testing.T) {

View File

@@ -20,7 +20,7 @@ import (
"golang.org/x/crypto/hkdf"
"golang.org/x/crypto/sha3"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
type HashField struct {

View File

@@ -16,7 +16,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
var (

View File

@@ -8,8 +8,8 @@ import (
"path/filepath"
"testing"
subtle "github.com/sonr-io/sonr/crypto/daed"
"github.com/sonr-io/sonr/crypto/subtle/random"
subtle "github.com/sonr-io/crypto/daed"
"github.com/sonr-io/crypto/subtle/random"
)
type testData struct {

View File

@@ -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

View File

@@ -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

View File

@@ -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 (

View File

@@ -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 {

View File

@@ -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

View File

@@ -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))

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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) {

View File

@@ -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

View File

@@ -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 (

View File

@@ -9,7 +9,7 @@ import (
eciesgo "github.com/ecies/go/v2"
"lukechampine.com/blake3"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
type PrivateKey = eciesgo.PrivateKey

View File

@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/sonr-io/sonr/crypto/ecies"
"github.com/sonr-io/crypto/ecies"
)
func TestGenerateKey(t *testing.T) {

2
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/sonr-io/sonr/crypto
module github.com/sonr-io/crypto
go 1.24.7

View File

@@ -8,7 +8,7 @@ package extra25519
import (
"crypto/sha512"
"github.com/sonr-io/sonr/crypto/internal/ed25519/edwards25519"
"github.com/sonr-io/crypto/internal/ed25519/edwards25519"
)
// PrivateKeyToCurve25519 converts an ed25519 private key into a corresponding

View File

@@ -10,7 +10,7 @@ import (
"crypto/sha512"
"testing"
"github.com/sonr-io/sonr/crypto/internal/ed25519/edwards25519"
"github.com/sonr-io/crypto/internal/ed25519/edwards25519"
"golang.org/x/crypto/curve25519"
"golang.org/x/crypto/ed25519"
)

View File

@@ -7,7 +7,7 @@ import (
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
p2ppb "github.com/libp2p/go-libp2p/core/crypto/pb"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
"golang.org/x/crypto/sha3"
)

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
)
// getEcdsaPoint builds an elliptic curve point from a compressed byte slice

View File

@@ -42,7 +42,7 @@ The package is built around the concept of secure **Enclaves** that manage distr
### Installation
```bash
go get github.com/sonr-io/sonr/crypto/mpc
go get github.com/sonr-io/crypto/mpc
```
### Basic Usage
@@ -54,7 +54,7 @@ package main
import (
"fmt"
"github.com/sonr-io/sonr/crypto/mpc"
"github.com/sonr-io/crypto/mpc"
)
func main() {
@@ -233,7 +233,7 @@ if err != nil {
The package includes MPC-based JWT signing for UCAN tokens:
```go
import "github.com/sonr-io/sonr/crypto/mpc/spec"
import "github.com/sonr-io/crypto/mpc/spec"
// Create MPC-backed UCAN token source
// (Implementation details in spec package)
@@ -448,10 +448,10 @@ go test -cover ./crypto/mpc
## Dependencies
- **Core Cryptography**: `github.com/sonr-io/sonr/crypto/core/curves`
- **Protocol Framework**: `github.com/sonr-io/sonr/crypto/core/protocol`
- **Threshold ECDSA**: `github.com/sonr-io/sonr/crypto/tecdsa/dklsv1`
- **UCAN Integration**: `github.com/sonr-io/sonr/crypto/ucan`
- **Core Cryptography**: `github.com/sonr-io/crypto/core/curves`
- **Protocol Framework**: `github.com/sonr-io/crypto/core/protocol`
- **Threshold ECDSA**: `github.com/sonr-io/crypto/tecdsa/dklsv1`
- **UCAN Integration**: `github.com/sonr-io/crypto/ucan`
- **Standard Crypto**: `golang.org/x/crypto/sha3`
- **JWT Support**: `github.com/golang-jwt/jwt`

View File

@@ -4,9 +4,9 @@ package mpc
import (
"crypto/rand"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/sonr/crypto/core/protocol"
"github.com/sonr-io/sonr/crypto/tecdsa/dklsv1/dkg"
"github.com/sonr-io/crypto/core/curves"
"github.com/sonr-io/crypto/core/protocol"
"github.com/sonr-io/crypto/tecdsa/dklsv1/dkg"
)
type CurveName string

View File

@@ -7,7 +7,7 @@ import (
"encoding/json"
"fmt"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves"
"golang.org/x/crypto/sha3"
)

View File

@@ -1,8 +1,8 @@
package mpc
import (
"github.com/sonr-io/sonr/crypto/core/protocol"
"github.com/sonr-io/sonr/crypto/tecdsa/dklsv1"
"github.com/sonr-io/crypto/core/protocol"
"github.com/sonr-io/crypto/tecdsa/dklsv1"
)
// NewEnclave generates a new MPC keyshare

View File

@@ -6,7 +6,7 @@ import (
"fmt"
"github.com/golang-jwt/jwt/v5"
"github.com/sonr-io/sonr/crypto/mpc"
"github.com/sonr-io/crypto/mpc"
)
// MPCSigningMethod implements the SigningMethod interface for MPC-based signing

View File

@@ -7,8 +7,8 @@ import (
"github.com/golang-jwt/jwt/v5"
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/sonr-io/sonr/crypto/keys"
"github.com/sonr-io/sonr/crypto/mpc"
"github.com/sonr-io/crypto/keys"
"github.com/sonr-io/crypto/mpc"
"lukechampine.com/blake3"
)

View File

@@ -7,9 +7,9 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/sonr/crypto/core/protocol"
"github.com/sonr-io/sonr/crypto/tecdsa/dklsv1"
"github.com/sonr-io/crypto/core/curves"
"github.com/sonr-io/crypto/core/protocol"
"github.com/sonr-io/crypto/tecdsa/dklsv1"
"golang.org/x/crypto/sha3"
)

View File

@@ -27,8 +27,8 @@ import (
"github.com/pkg/errors"
"golang.org/x/crypto/sha3"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/sonr/crypto/zkp/schnorr"
"github.com/sonr-io/crypto/core/curves"
"github.com/sonr-io/crypto/zkp/schnorr"
)
const (

View File

@@ -14,9 +14,9 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/sonr/crypto/ot/base/simplest"
"github.com/sonr-io/sonr/crypto/ot/ottest"
"github.com/sonr-io/crypto/core/curves"
"github.com/sonr-io/crypto/ot/base/simplest"
"github.com/sonr-io/crypto/ot/ottest"
)
func TestOtOnMultipleCurves(t *testing.T) {

Some files were not shown because too many files have changed in this diff Show More