- pkg/protocol/ws/client.go - Added logging for received subscription events. - Optimized subscription ID assignment. - pkg/protocol/nwc/client.go - Implemented `Subscribe` function to handle event subscriptions. - cmd/walletcli/main.go - Added support for `subscribe` command to handle notifications. - Replaced `ctx` with `c` for context usage across all commands. - pkg/crypto/p256k/helpers.go - Removed unnecessary logging from `HexToBin` function.
41 lines
781 B
Go
41 lines
781 B
Go
//go:build cgo
|
|
|
|
package p256k
|
|
|
|
import (
|
|
"orly.dev/pkg/encoders/hex"
|
|
"orly.dev/pkg/interfaces/signer"
|
|
"orly.dev/pkg/utils/chk"
|
|
)
|
|
|
|
func NewSecFromHex[V []byte | string](skh V) (sign signer.I, err error) {
|
|
sk := make([]byte, len(skh)/2)
|
|
if _, err = hex.DecBytes(sk, []byte(skh)); chk.E(err) {
|
|
return
|
|
}
|
|
sign = &Signer{}
|
|
if err = sign.InitSec(sk); chk.E(err) {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
func NewPubFromHex[V []byte | string](pkh V) (sign signer.I, err error) {
|
|
pk := make([]byte, len(pkh)/2)
|
|
if _, err = hex.DecBytes(pk, []byte(pkh)); chk.E(err) {
|
|
return
|
|
}
|
|
sign = &Signer{}
|
|
if err = sign.InitPub(pk); chk.E(err) {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
func HexToBin(hexStr string) (b []byte, err error) {
|
|
if b, err = hex.DecAppend(b, []byte(hexStr)); chk.E(err) {
|
|
return
|
|
}
|
|
return
|
|
}
|