aboutsummaryrefslogtreecommitdiffstats
path: root/gosrc/requests.go
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-04-03 17:59:14 +0200
committersalaaad2 <arthurdurant263@gmail.com>2022-04-03 17:59:14 +0200
commitf2f7654a416b7ad0715ddf93f635021c62eb6c87 (patch)
treefd0a7b4b474eb4b411692ed5b0c0b86b2ec3a711 /gosrc/requests.go
parentsigning requests (diff)
downloadsmith-f2f7654a416b7ad0715ddf93f635021c62eb6c87.tar.gz
smith-f2f7654a416b7ad0715ddf93f635021c62eb6c87.tar.bz2
smith-f2f7654a416b7ad0715ddf93f635021c62eb6c87.tar.xz
smith-f2f7654a416b7ad0715ddf93f635021c62eb6c87.tar.zst
smith-f2f7654a416b7ad0715ddf93f635021c62eb6c87.zip
go: trimmed signature switched to termui \nc: added get_timestamp function
Diffstat (limited to '')
-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
}