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) {
64
64
// MarshalJSON implements customProtobufType.
65
65
func (sk ecdsaSK ) MarshalJSON () ([]byte , error ) {
66
66
b64 := base64 .StdEncoding .EncodeToString (sk .PrivKey .Bytes ())
67
- return []byte (b64 ), nil
67
+ return []byte (" \" " + b64 + " \" " ), nil
68
68
}
69
69
70
70
// UnmarshalJSON implements customProtobufType.
71
71
func (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 ] ))
73
73
if err != nil {
74
74
return err
75
75
}
Original file line number Diff line number Diff line change @@ -73,12 +73,13 @@ func (pk ecdsaPK) Marshal() ([]byte, error) {
73
73
// MarshalJSON implements customProtobufType.
74
74
func (pk ecdsaPK ) MarshalJSON () ([]byte , error ) {
75
75
b64 := base64 .StdEncoding .EncodeToString (pk .PubKey .Bytes ())
76
- return []byte (b64 ), nil
76
+ return []byte (" \" " + b64 + " \" " ), nil
77
77
}
78
78
79
79
// UnmarshalJSON implements customProtobufType.
80
80
func (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 ]))
82
83
if err != nil {
83
84
return err
84
85
}
You can’t perform that action at this time.
0 commit comments