2024-11-23 01:28:58 -05:00
|
|
|
//
|
|
|
|
|
// Copyright Coinbase, Inc. All Rights Reserved.
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// Copyright Coinbase, Inc. All Rights Reserved.
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
package sharing
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
crand "crypto/rand"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
2024-12-24 11:10:20 -05:00
|
|
|
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
2024-11-23 01:28:58 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestNewPoly(t *testing.T) {
|
|
|
|
|
curve := curves.BLS12381G1()
|
|
|
|
|
secret := curve.NewScalar().Hash([]byte("test"))
|
|
|
|
|
|
|
|
|
|
poly := new(Polynomial).Init(secret, 4, crand.Reader)
|
|
|
|
|
require.NotNil(t, poly)
|
|
|
|
|
|
|
|
|
|
require.Equal(t, poly.Coefficients[0], secret)
|
|
|
|
|
}
|