diff options
author | default <nobody@localhost> | 2022-09-25 18:54:05 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2022-09-25 18:54:05 +0200 |
commit | fcf9329449e59fe4cce179ad4e5282d87ed5f1f4 (patch) | |
tree | 2ce18f9413871c623fd4825fa0e6058d19d3475e /http.c | |
parent | 6f7f98ded3005d9c29295dfff42dbf81bba1f62a (diff) |
Minor tweak in http signatures.
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -17,7 +17,7 @@ d_char *http_signed_request(snac *snac, char *method, char *url, { xs *l1; xs *date; - xs *digest_b64, *digest; + xs *digest; xs *s64; xs *signature; xs *hdrs; @@ -43,12 +43,16 @@ d_char *http_signed_request(snac *snac, char *method, char *url, target = ""; /* digest */ - if (body != NULL) - digest_b64 = xs_sha256_base64(body, b_size); - else - digest_b64 = xs_sha256_base64("", 0); + { + xs *s; - digest = xs_fmt("SHA-256=%s", digest_b64); + if (body != NULL) + s = xs_sha256_base64(body, b_size); + else + s = xs_sha256_base64("", 0); + + digest = xs_fmt("SHA-256=%s", s); + } seckey = xs_dict_get(snac->key, "secret"); |