Enhance WebSocket connection management and signer implementation
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

- Added a pong handler to extend the read deadline upon receiving PONG messages in WebSocket connections, improving connection stability.
- Updated the signer implementation to serialize the x-only public key to 32 bytes, ensuring compatibility with the internal format.
- Refactored tests to utilize MustNew() for signer initialization, enhancing error handling during key generation.
- Bumped version to v0.25.1 to reflect these updates.
This commit is contained in:
2025-11-05 06:19:28 +00:00
parent 4944bfad91
commit 1d12099f1c
5 changed files with 30 additions and 15 deletions

View File

@@ -52,15 +52,18 @@ func (s *Signer) Generate() (err error) {
return
}
// Extract x-only public key
// Extract x-only public key (internal 64-byte format)
var xonly secp.XOnlyPublicKey
var parity int32
if xonly, parity, err = s.ctx.KeypairXOnlyPub(s.keypair); err != nil {
return
}
_ = parity
// XOnlyPublicKey is [64]byte, but we only need the first 32 bytes (the x coordinate)
s.pubKey = xonly[:32]
// Serialize the x-only public key to 32 bytes
if s.pubKey, err = s.ctx.SerializeXOnlyPublicKey(xonly[:]); err != nil {
return
}
return
}
@@ -79,15 +82,18 @@ func (s *Signer) InitSec(sec []byte) (err error) {
return
}
// Extract x-only public key
// Extract x-only public key (internal 64-byte format)
var xonly secp.XOnlyPublicKey
var parity int32
if xonly, parity, err = s.ctx.KeypairXOnlyPub(s.keypair); err != nil {
return
}
_ = parity
// XOnlyPublicKey is [64]byte, but we only need the first 32 bytes (the x coordinate)
s.pubKey = xonly[:32]
// Serialize the x-only public key to 32 bytes
if s.pubKey, err = s.ctx.SerializeXOnlyPublicKey(xonly[:]); err != nil {
return
}
return
}