Refactor crypto package to use p256k1 signer
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

- Replaced the p256k package with p256k1.mleku.dev/signer across the codebase, updating all instances where the previous signer was utilized.
- Removed the deprecated p256k package, including all related files and tests, to streamline the codebase and improve maintainability.
- Updated various components, including event handling, database interactions, and protocol implementations, to ensure compatibility with the new signer interface.
- Enhanced tests to validate the new signing functionality and ensure robustness across the application.
- Bumped version to v0.23.3 to reflect these changes.
This commit is contained in:
2025-11-03 10:21:31 +00:00
parent edcdec9c7e
commit 2614b51068
50 changed files with 312 additions and 972 deletions

View File

@@ -7,7 +7,7 @@ import (
"lol.mleku.dev/chk"
"next.orly.dev/pkg/crypto/ec/schnorr"
"next.orly.dev/pkg/crypto/p256k"
p256k1signer "p256k1.mleku.dev/signer"
"next.orly.dev/pkg/encoders/hex"
"next.orly.dev/pkg/utils"
)
@@ -17,7 +17,7 @@ var GeneratePrivateKey = func() string { return GenerateSecretKeyHex() }
// GenerateSecretKey creates a new secret key and returns the bytes of the secret.
func GenerateSecretKey() (skb []byte, err error) {
signer := &p256k.Signer{}
signer := p256k1signer.NewP256K1Signer()
if err = signer.Generate(); chk.E(err) {
return
}
@@ -40,7 +40,7 @@ func GetPublicKeyHex(sk string) (pk string, err error) {
if b, err = hex.Dec(sk); chk.E(err) {
return
}
signer := &p256k.Signer{}
signer := p256k1signer.NewP256K1Signer()
if err = signer.InitSec(b); chk.E(err) {
return
}
@@ -50,7 +50,7 @@ func GetPublicKeyHex(sk string) (pk string, err error) {
// SecretBytesToPubKeyHex generates a public key from secret key bytes.
func SecretBytesToPubKeyHex(skb []byte) (pk string, err error) {
signer := &p256k.Signer{}
signer := p256k1signer.NewP256K1Signer()
if err = signer.InitSec(skb); chk.E(err) {
return
}