mirror of
https://github.com/sonr-io/crypto.git
synced 2026-01-12 04:09:13 +00:00
refactor(crypto): simplify elliptic curve implementation
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type structMarshal struct {
|
type structMarshal struct {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestNewAccumulator100(t *testing.T) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"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.
|
// SecretKey is the secret alpha only held by the accumulator manager.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestSecretKeyMarshal(t *testing.T) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"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)
|
// dad constructs two polynomials - dA(x) and dD(x)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestEvaluatePolyG1(t *testing.T) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type proofParamsMarshal struct {
|
type proofParamsMarshal struct {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestProofParamsMarshal(t *testing.T) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"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.
|
// MembershipWitness contains the witness c and the value y respect to the accumulator state.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func Test_Membership_Witness_New(t *testing.T) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/crypto/sha3"
|
"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.
|
// generators contains a list of points to be used as generators for bulletproofs.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/crypto/sha3"
|
"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) {
|
func TestGeneratorsHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package bulletproof
|
|||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"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.
|
// innerProduct takes two lists of scalars (a, b) and performs the dot product returning a single scalar.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestInnerProductHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"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
|
// InnerProductProver is the struct used to create InnerProductProofs
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestIPPHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"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
|
// InnerProductVerifier is the struct used to verify inner product proofs
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestIPPVerifyHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"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.
|
// BatchProve proves that a list of scalars v are in the range n.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestRangeBatchProverHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"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.
|
// VerifyBatched verifies a given batched range proof.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestRangeBatchVerifyHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"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
|
// RangeProver is the struct used to create RangeProofs
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestRangeProverHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"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
|
// RangeVerifier is the struct used to verify RangeProofs
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestRangeVerifyHappyPath(t *testing.T) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
|
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
|
||||||
"golang.org/x/crypto/sha3"
|
"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
|
// See 'r' = https://eprint.iacr.org/2018/962.pdf Figure 16
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/bls12381"
|
"github.com/sonr-io/crypto/core/curves/native/bls12381"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bls12381modulus = bhex(
|
var bls12381modulus = bhex(
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/bls12381"
|
"github.com/sonr-io/crypto/core/curves/native/bls12381"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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
|
// TestAdditionalCurveSupport tests the new curve support in hash.go
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core"
|
"github.com/sonr-io/crypto/core"
|
||||||
|
|
||||||
"github.com/dustinxie/ecc"
|
"github.com/dustinxie/ecc"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var curveNameToID = map[string]byte{
|
var curveNameToID = map[string]byte{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core"
|
"github.com/sonr-io/crypto/core"
|
||||||
tt "github.com/sonr-io/sonr/crypto/internal"
|
tt "github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIsIdentity(t *testing.T) {
|
func TestIsIdentity(t *testing.T) {
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/bwesterb/go-ristretto"
|
"github.com/bwesterb/go-ristretto"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core"
|
"github.com/sonr-io/crypto/core"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/bls12381"
|
"github.com/sonr-io/crypto/core/curves/native/bls12381"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EcScalar interface {
|
type EcScalar interface {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/bwesterb/go-ristretto"
|
"github.com/bwesterb/go-ristretto"
|
||||||
ed "github.com/bwesterb/go-ristretto/edwards25519"
|
ed "github.com/bwesterb/go-ristretto/edwards25519"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ScalarEd25519 struct {
|
type ScalarEd25519 struct {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
ed "filippo.io/edwards25519"
|
ed "filippo.io/edwards25519"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestScalarEd25519Random(t *testing.T) {
|
func TestScalarEd25519Random(t *testing.T) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
|
||||||
mod "github.com/sonr-io/sonr/crypto/core"
|
mod "github.com/sonr-io/crypto/core"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkK256(b *testing.B) {
|
func BenchmarkK256(b *testing.B) {
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
secp256k1 "github.com/sonr-io/sonr/crypto/core/curves/native/k256"
|
secp256k1 "github.com/sonr-io/crypto/core/curves/native/k256"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fp"
|
"github.com/sonr-io/crypto/core/curves/native/k256/fp"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fq"
|
"github.com/sonr-io/crypto/core/curves/native/k256/fq"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package bls12381
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fqModulusBytes = [native.FieldBytes]byte{
|
var fqModulusBytes = [native.FieldBytes]byte{
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fp field element mod p
|
// fp field element mod p
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fq [native.FieldLimbs]uint64
|
type Fq [native.FieldLimbs]uint64
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestG1IsOnCurve(t *testing.T) {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestG2IsOnCurve(t *testing.T) {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package bls12381
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GtFieldBytes is the number of bytes needed to represent this field
|
// GtFieldBytes is the number of bytes needed to represent this field
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func TestSinglePairing(t *testing.T) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"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
|
// FieldLimbs is the number of limbs needed to represent this field
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package k256
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fp"
|
"github.com/sonr-io/crypto/core/curves/native/k256/fp"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/k256"
|
"github.com/sonr-io/crypto/core/curves/native/k256"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestK256PointArithmetic_Hash(t *testing.T) {
|
func TestK256PointArithmetic_Hash(t *testing.T) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package p256
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
|
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/p256"
|
"github.com/sonr-io/crypto/core/curves/native/p256"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
|
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestP256PointArithmetic_Double(t *testing.T) {
|
func TestP256PointArithmetic_Double(t *testing.T) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fp fiat_pasta_fp_montgomery_domain_field_element
|
type Fp fiat_pasta_fp_montgomery_domain_field_element
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fq fiat_pasta_fq_montgomery_domain_field_element
|
type Fq fiat_pasta_fq_montgomery_domain_field_element
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core"
|
"github.com/sonr-io/crypto/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkP256(b *testing.B) {
|
func BenchmarkP256(b *testing.B) {
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native"
|
"github.com/sonr-io/crypto/core/curves/native"
|
||||||
p256n "github.com/sonr-io/sonr/crypto/core/curves/native/p256"
|
p256n "github.com/sonr-io/crypto/core/curves/native/p256"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
|
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fq"
|
"github.com/sonr-io/crypto/core/curves/native/p256/fq"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/blake2b"
|
"golang.org/x/crypto/blake2b"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/pasta/fp"
|
"github.com/sonr-io/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/fq"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves/native/pasta/fp"
|
"github.com/sonr-io/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/fq"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPointPallasAddDoubleMul(t *testing.T) {
|
func TestPointPallasAddDoubleMul(t *testing.T) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"golang.org/x/crypto/hkdf"
|
"golang.org/x/crypto/hkdf"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HashField struct {
|
type HashField struct {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
subtle "github.com/sonr-io/sonr/crypto/daed"
|
subtle "github.com/sonr-io/crypto/daed"
|
||||||
"github.com/sonr-io/sonr/crypto/subtle/random"
|
"github.com/sonr-io/crypto/subtle/random"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testData struct {
|
type testData struct {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
"github.com/sonr-io/sonr/crypto/sharing"
|
"github.com/sonr-io/crypto/sharing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Round1Bcast are values that are broadcast to all other participants
|
// Round1Bcast are values that are broadcast to all other participants
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ package frost
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
"github.com/sonr-io/sonr/crypto/sharing"
|
"github.com/sonr-io/crypto/sharing"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Round2Bcast are values that are broadcast to all other participants
|
// Round2Bcast are values that are broadcast to all other participants
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/sharing"
|
"github.com/sonr-io/crypto/sharing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ package frost
|
|||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
"github.com/sonr-io/sonr/crypto/sharing"
|
"github.com/sonr-io/crypto/sharing"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DkgParticipant struct {
|
type DkgParticipant struct {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import (
|
|||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Participant is a DKG player that contains information needed to perform DKG rounds
|
// 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/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testGenerator, _ = curves.NewScalarBaseMult(btcec.S256(), big.NewInt(3333))
|
var testGenerator, _ = curves.NewScalarBaseMult(btcec.S256(), big.NewInt(3333))
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core"
|
"github.com/sonr-io/crypto/core"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Round1Bcast are the values that are broadcast to all other participants
|
// Round1Bcast are the values that are broadcast to all other participants
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ package gennaro
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Round2Bcast = []*v1.ShareVerifier
|
type Round2Bcast = []*v1.ShareVerifier
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ package gennaro
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Round3Bcast contains values that will be broadcast to other participants.
|
// Round3Bcast contains values that will be broadcast to other participants.
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ package gennaro
|
|||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core"
|
"github.com/sonr-io/crypto/core"
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/internal"
|
"github.com/sonr-io/crypto/internal"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Round4 computes the public shares used by tECDSA during signing
|
// Round4 computes the public shares used by tECDSA during signing
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParticipantRound1Works(t *testing.T) {
|
func TestParticipantRound1Works(t *testing.T) {
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/dkg/gennaro"
|
"github.com/sonr-io/crypto/dkg/gennaro"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const threshold = 2
|
const threshold = 2
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
v1 "github.com/sonr-io/sonr/crypto/sharing/v1"
|
v1 "github.com/sonr-io/crypto/sharing/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
eciesgo "github.com/ecies/go/v2"
|
eciesgo "github.com/ecies/go/v2"
|
||||||
"lukechampine.com/blake3"
|
"lukechampine.com/blake3"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PrivateKey = eciesgo.PrivateKey
|
type PrivateKey = eciesgo.PrivateKey
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/ecies"
|
"github.com/sonr-io/crypto/ecies"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateKey(t *testing.T) {
|
func TestGenerateKey(t *testing.T) {
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github.com/sonr-io/sonr/crypto
|
module github.com/sonr-io/crypto
|
||||||
|
|
||||||
go 1.24.7
|
go 1.24.7
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ package extra25519
|
|||||||
import (
|
import (
|
||||||
"crypto/sha512"
|
"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
|
// PrivateKeyToCurve25519 converts an ed25519 private key into a corresponding
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"crypto/sha512"
|
"crypto/sha512"
|
||||||
"testing"
|
"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/curve25519"
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
|
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
|
||||||
p2ppb "github.com/libp2p/go-libp2p/core/crypto/pb"
|
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"
|
"golang.org/x/crypto/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"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
|
// getEcdsaPoint builds an elliptic curve point from a compressed byte slice
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ The package is built around the concept of secure **Enclaves** that manage distr
|
|||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go get github.com/sonr-io/sonr/crypto/mpc
|
go get github.com/sonr-io/crypto/mpc
|
||||||
```
|
```
|
||||||
|
|
||||||
### Basic Usage
|
### Basic Usage
|
||||||
@@ -54,7 +54,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/sonr-io/sonr/crypto/mpc"
|
"github.com/sonr-io/crypto/mpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -233,7 +233,7 @@ if err != nil {
|
|||||||
The package includes MPC-based JWT signing for UCAN tokens:
|
The package includes MPC-based JWT signing for UCAN tokens:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/sonr-io/sonr/crypto/mpc/spec"
|
import "github.com/sonr-io/crypto/mpc/spec"
|
||||||
|
|
||||||
// Create MPC-backed UCAN token source
|
// Create MPC-backed UCAN token source
|
||||||
// (Implementation details in spec package)
|
// (Implementation details in spec package)
|
||||||
@@ -448,10 +448,10 @@ go test -cover ./crypto/mpc
|
|||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
- **Core Cryptography**: `github.com/sonr-io/sonr/crypto/core/curves`
|
- **Core Cryptography**: `github.com/sonr-io/crypto/core/curves`
|
||||||
- **Protocol Framework**: `github.com/sonr-io/sonr/crypto/core/protocol`
|
- **Protocol Framework**: `github.com/sonr-io/crypto/core/protocol`
|
||||||
- **Threshold ECDSA**: `github.com/sonr-io/sonr/crypto/tecdsa/dklsv1`
|
- **Threshold ECDSA**: `github.com/sonr-io/crypto/tecdsa/dklsv1`
|
||||||
- **UCAN Integration**: `github.com/sonr-io/sonr/crypto/ucan`
|
- **UCAN Integration**: `github.com/sonr-io/crypto/ucan`
|
||||||
- **Standard Crypto**: `golang.org/x/crypto/sha3`
|
- **Standard Crypto**: `golang.org/x/crypto/sha3`
|
||||||
- **JWT Support**: `github.com/golang-jwt/jwt`
|
- **JWT Support**: `github.com/golang-jwt/jwt`
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package mpc
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/core/protocol"
|
"github.com/sonr-io/crypto/core/protocol"
|
||||||
"github.com/sonr-io/sonr/crypto/tecdsa/dklsv1/dkg"
|
"github.com/sonr-io/crypto/tecdsa/dklsv1/dkg"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CurveName string
|
type CurveName string
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package mpc
|
package mpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/sonr-io/sonr/crypto/core/protocol"
|
"github.com/sonr-io/crypto/core/protocol"
|
||||||
"github.com/sonr-io/sonr/crypto/tecdsa/dklsv1"
|
"github.com/sonr-io/crypto/tecdsa/dklsv1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewEnclave generates a new MPC keyshare
|
// NewEnclave generates a new MPC keyshare
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"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
|
// MPCSigningMethod implements the SigningMethod interface for MPC-based signing
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
"github.com/libp2p/go-libp2p/core/crypto"
|
"github.com/libp2p/go-libp2p/core/crypto"
|
||||||
"github.com/sonr-io/sonr/crypto/keys"
|
"github.com/sonr-io/crypto/keys"
|
||||||
"github.com/sonr-io/sonr/crypto/mpc"
|
"github.com/sonr-io/crypto/mpc"
|
||||||
"lukechampine.com/blake3"
|
"lukechampine.com/blake3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/core/protocol"
|
"github.com/sonr-io/crypto/core/protocol"
|
||||||
"github.com/sonr-io/sonr/crypto/tecdsa/dklsv1"
|
"github.com/sonr-io/crypto/tecdsa/dklsv1"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/zkp/schnorr"
|
"github.com/sonr-io/crypto/zkp/schnorr"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/sonr-io/sonr/crypto/core/curves"
|
"github.com/sonr-io/crypto/core/curves"
|
||||||
"github.com/sonr-io/sonr/crypto/ot/base/simplest"
|
"github.com/sonr-io/crypto/ot/base/simplest"
|
||||||
"github.com/sonr-io/sonr/crypto/ot/ottest"
|
"github.com/sonr-io/crypto/ot/ottest"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestOtOnMultipleCurves(t *testing.T) {
|
func TestOtOnMultipleCurves(t *testing.T) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user