diff --git a/.github/licence-header.tmpl b/.github/licence-header.tmpl index cb152e4..4d3a906 100644 --- a/.github/licence-header.tmpl +++ b/.github/licence-header.tmpl @@ -1,6 +1,6 @@ SPDX-License-Identifier: MIT -Copyright (C) 2020-2023 Daniel Bourdrez. All Rights Reserved. +Copyright (C) 2024 Daniel Bourdrez. All Rights Reserved. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree or at diff --git a/element.go b/element.go index b1cdc61..3b3a6d3 100644 --- a/element.go +++ b/element.go @@ -148,12 +148,12 @@ func (e *Element) DecodeHex(h string) error { // MarshalJSON marshals the element into valid JSON. func (e *Element) MarshalJSON() ([]byte, error) { - return e.Encode(), nil + return []byte(e.Hex()), nil } // UnmarshalJSON unmarshals the input into the element. func (e *Element) UnmarshalJSON(data []byte) error { - return e.Decode(data) + return e.DecodeHex(string(data)) } // MarshalBinary returns the compressed byte encoding of the element. diff --git a/scalar.go b/scalar.go index e2b7316..b1c25e0 100644 --- a/scalar.go +++ b/scalar.go @@ -180,12 +180,12 @@ func (s *Scalar) DecodeHex(h string) error { // MarshalJSON marshals the scalar into valid JSON. func (s *Scalar) MarshalJSON() ([]byte, error) { - return s.Encode(), nil + return []byte(s.Hex()), nil } // UnmarshalJSON unmarshals the input into the scalar. func (s *Scalar) UnmarshalJSON(data []byte) error { - return s.Decode(data) + return s.DecodeHex(string(data)) } // MarshalBinary implements the encoding.BinaryMarshaler interface.