Refactor crypto package to use p256k1 signer
- 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:
@@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"next.orly.dev/pkg/acl"
|
||||
"next.orly.dev/pkg/crypto/p256k"
|
||||
p256k1signer "p256k1.mleku.dev/signer"
|
||||
"next.orly.dev/pkg/database"
|
||||
"next.orly.dev/pkg/encoders/event"
|
||||
"next.orly.dev/pkg/encoders/hex"
|
||||
@@ -59,8 +59,8 @@ func testSetup(t *testing.T) (*Server, func()) {
|
||||
}
|
||||
|
||||
// createTestKeypair creates a test keypair for signing events
|
||||
func createTestKeypair(t *testing.T) ([]byte, *p256k.Signer) {
|
||||
signer := &p256k.Signer{}
|
||||
func createTestKeypair(t *testing.T) ([]byte, *p256k1signer.P256K1Signer) {
|
||||
signer := p256k1signer.NewP256K1Signer()
|
||||
if err := signer.Generate(); err != nil {
|
||||
t.Fatalf("Failed to generate keypair: %v", err)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ func createTestKeypair(t *testing.T) ([]byte, *p256k.Signer) {
|
||||
|
||||
// createAuthEvent creates a valid kind 24242 authorization event
|
||||
func createAuthEvent(
|
||||
t *testing.T, signer *p256k.Signer, verb string,
|
||||
t *testing.T, signer *p256k1signer.P256K1Signer, verb string,
|
||||
sha256Hash []byte, expiresIn int64,
|
||||
) *event.E {
|
||||
now := time.Now().Unix()
|
||||
|
||||
Reference in New Issue
Block a user