File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,12 @@ func (sk ecdsaSK) Marshal() ([]byte, error) {
6464// MarshalJSON implements customProtobufType.
6565func (sk ecdsaSK ) MarshalJSON () ([]byte , error ) {
6666 b64 := base64 .StdEncoding .EncodeToString (sk .PrivKey .Bytes ())
67- return []byte (b64 ), nil
67+ return []byte (" \" " + b64 + " \" " ), nil
6868}
6969
7070// UnmarshalJSON implements customProtobufType.
7171func (sk * ecdsaSK ) UnmarshalJSON (data []byte ) error {
72- bz , err := base64 .StdEncoding .DecodeString (string (data ))
72+ bz , err := base64 .StdEncoding .DecodeString (string (data [ 1 : len ( data ) - 1 ] ))
7373 if err != nil {
7474 return err
7575 }
Original file line number Diff line number Diff line change @@ -73,12 +73,13 @@ func (pk ecdsaPK) Marshal() ([]byte, error) {
7373// MarshalJSON implements customProtobufType.
7474func (pk ecdsaPK ) MarshalJSON () ([]byte , error ) {
7575 b64 := base64 .StdEncoding .EncodeToString (pk .PubKey .Bytes ())
76- return []byte (b64 ), nil
76+ return []byte (" \" " + b64 + " \" " ), nil
7777}
7878
7979// UnmarshalJSON implements customProtobufType.
8080func (pk * ecdsaPK ) UnmarshalJSON (data []byte ) error {
81- bz , err := base64 .StdEncoding .DecodeString (string (data ))
81+ // the string is quoted so we need to remove them
82+ bz , err := base64 .StdEncoding .DecodeString (string (data [1 : len (data )- 1 ]))
8283 if err != nil {
8384 return err
8485 }
You can’t perform that action at this time.
0 commit comments