aboutsummaryrefslogtreecommitdiffstats
path: root/gosrc/requests.go
diff options
context:
space:
mode:
Diffstat (limited to 'gosrc/requests.go')
-rw-r--r--gosrc/requests.go28
1 files changed, 22 insertions, 6 deletions
diff --git a/gosrc/requests.go b/gosrc/requests.go
index 4e94533..7be1d49 100644
--- a/gosrc/requests.go
+++ b/gosrc/requests.go
@@ -1,23 +1,39 @@
+// SMITH ( // /
+// requests ( )/ /
+// by salade )(/ /
+// ________________ ( /) /
+// ()__)____________))))) :^} /
+
package main
import (
"fmt"
"log"
+ "strings"
)
-func sign_request(body string, key string) {
+// sign request with given private key
+func sign_request(body string, key string) string {
fmt.Println("signing request : ", body)
+ // run pipeline
out2, err := RunStrings("/usr/bin/echo", "-n", body, "|", "/usr/bin/openssl", "dgst", "-sha256", "-hmac", key)
if err != nil {
- log.Fatal("hwhat")
+ log.Fatal("error: failed to sign request", err)
}
- fmt.Println(out2)
- // here
+ // remove unwanted characters
+ tok := strings.Index(out2, "(")
+ last := len(out2) - 1
+ first := tok + len("(stdin)= ")
+ out2 = out2[first:last]
+ return out2
}
-func make_body(order string, ticker string, price string) {
+// create body given choice ex :
+// GET /sapi/v1/capital/config/getall ||
+// POST /sapi/v1/asset/dust-btc
+func make_body(order string, ticker string, price string) string {
ret := "GET /sapi/v1/capital/config/getall"
- sign_request(ret, "heheheheh")
+ return ret
}