aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorClawd <ai@clawd.bot>2026-03-08 16:32:53 -0700
committerClawd <ai@clawd.bot>2026-03-08 16:32:53 -0700
commitcc7637b833bb66cd8715d466e615a23ec0f05c92 (patch)
tree7c242a3c3be0ad122f5d74f8a8c04f80a85c4c98 /internal
parent0dcf191e7f63f35efe85afb60bcb57f4934a0acb (diff)
feat: NIP-04 encrypt/decrypt using internal secp256k1v0.3.1v0.3.0main
Diffstat (limited to 'internal')
-rw-r--r--internal/secp256k1/point.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/secp256k1/point.go b/internal/secp256k1/point.go
index 1def176..5215590 100644
--- a/internal/secp256k1/point.go
+++ b/internal/secp256k1/point.go
@@ -162,6 +162,18 @@ func (p *Point) Negate() *Point {
162 return &Point{x: p.x.Clone(), y: negY, infinity: false} 162 return &Point{x: p.x.Clone(), y: negY, infinity: false}
163} 163}
164 164
165// XBytes returns the x-coordinate as a 32-byte big-endian slice.
166// Returns nil for the point at infinity.
167func (p *Point) XBytes() []byte {
168 if p.infinity {
169 return nil
170 }
171 b := p.x.value.Bytes()
172 out := make([]byte, 32)
173 copy(out[32-len(b):], b)
174 return out
175}
176
165// String returns a readable representation 177// String returns a readable representation
166func (p *Point) String() string { 178func (p *Point) String() string {
167 if p.infinity { 179 if p.infinity {