commit 1f5ef5ad7276d8d633933b95036f431f33e3e424
parent a35a59a7538832581d0f5b6ec1f4ca7e9837a7a4
Author: parazyd <parazyd@dyne.org>
Date: Thu, 7 Dec 2017 21:01:53 +0100
Handle the JSON response in dam.go
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/go/dam/dam.go b/go/dam/dam.go
@@ -5,6 +5,7 @@ package main
import (
"encoding/base64"
"encoding/json"
+ "io/ioutil"
"log"
"os"
@@ -38,6 +39,7 @@ func main() {
"address": lib.OnionFromPubkey(key.PublicKey),
"message": "I'm a DECODE node!",
"signature": encodedSig,
+ "secret": "",
}
log.Println("Announcing keypair for:", vals["address"])
@@ -48,5 +50,10 @@ func main() {
log.Println("Sending request")
resp := lib.HTTPPost("http://localhost:8080/announce", jsonVal)
- log.Println(resp)
+ body, err := ioutil.ReadAll(resp.Body)
+ lib.CheckError(err)
+
+ // TODO: Handle the secret decryption and returning it back decrypted to the
+ // directory. Note to self: start saving state on ddir's side.
+ log.Println(string(body))
}