Browse Source

elgamal message encode bugfix

0x4a52466c696e74 2 years ago
parent
commit
7dd7f1a87d
1 changed files with 9 additions and 2 deletions
  1. 9 2
      elgamal/message.go

+ 9 - 2
elgamal/message.go

@@ -1,6 +1,9 @@
 package elgamal
 
-import "git.ali33.ru/fcg-xvii/curve/v2/tools"
+import (
+	"git.ali33.ru/fcg-xvii/curve/v2/tools"
+	"git.ali33.ru/fcg-xvii/go-tools/json"
+)
 
 type Message struct {
 	c       *Curve
@@ -10,5 +13,9 @@ type Message struct {
 }
 
 func (s *Message) Encoded() []byte {
-	return s.encoded
+	jm := json.Map{
+		"session_key": s.c1,
+		"encoded":     s.cd,
+	}
+	return []byte(jm.JSONPrettyString())
 }