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

@@ -5,7 +5,7 @@ import (
"testing"
"time"
"next.orly.dev/pkg/crypto/p256k"
p256k1signer "p256k1.mleku.dev/signer"
"next.orly.dev/pkg/encoders/hex"
"next.orly.dev/pkg/encoders/kind"
"next.orly.dev/pkg/encoders/tag"
@@ -14,7 +14,7 @@ import (
// createTestEvent creates a realistic test event with proper signing
func createTestEvent() *E {
signer := &p256k.Signer{}
signer := p256k1signer.NewP256K1Signer()
if err := signer.Generate(); err != nil {
panic(err)
}
@@ -44,7 +44,7 @@ func createTestEvent() *E {
// createLargeTestEvent creates a larger event with more tags and content
func createLargeTestEvent() *E {
signer := &p256k.Signer{}
signer := p256k1signer.NewP256K1Signer()
if err := signer.Generate(); err != nil {
panic(err)
}

View File

@@ -4,7 +4,7 @@ import (
"lol.mleku.dev/chk"
"lol.mleku.dev/errorf"
"lol.mleku.dev/log"
"next.orly.dev/pkg/crypto/p256k"
p256k1signer "p256k1.mleku.dev/signer"
"next.orly.dev/pkg/interfaces/signer"
"next.orly.dev/pkg/utils"
)
@@ -26,7 +26,7 @@ func (ev *E) Sign(keys signer.I) (err error) {
// Verify an event is signed by the pubkey it contains. Uses
// github.com/bitcoin-core/secp256k1 if available for faster verification.
func (ev *E) Verify() (valid bool, err error) {
keys := p256k.Signer{}
keys := p256k1signer.NewP256K1Signer()
if err = keys.InitPub(ev.Pubkey); chk.E(err) {
return
}