From 3913989be33d533bd71d2a4b11b1ffdb14ce1e2e Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 31 Aug 2024 15:27:54 +0100 Subject: [PATCH] provide string to perform-encryption instead of letting it read stdin, which I think may have been read by a subprocess already sometimes? --- pkgs/tangc/tangc.fnl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tangc/tangc.fnl b/pkgs/tangc/tangc.fnl index 1276b4b..19131b4 100644 --- a/pkgs/tangc/tangc.fnl +++ b/pkgs/tangc/tangc.fnl @@ -121,7 +121,7 @@ jwk (jwk-exc-noi rep tmp)] (print (jwe-dec jwk ph undigested))))) -(fn perform-encryption [jwks url] +(fn perform-encryption [jwks url input] (let [enc (jose! [:jwk :use "-i-" "-r" "-u" "deriveKey" "-o-"] (json.encode jwks)) ;; adding a -s to jwk use will "Always output a JWKSet" which @@ -140,8 +140,7 @@ :clevis {:pin "tang" :tang {:url url :adv jwks }}}}] (josep! [:jwe :enc "-i-" "-k-" "-I-" "-c"] - (.. (json.encode jwe) (json.encode jwk) - (: (io.input) :read "*a")))))) + (.. (json.encode jwe) (json.encode jwk) input))))) (fn usage [] (print "tangc\n=====\n") @@ -157,6 +156,7 @@ (fn encrypt [cfg] (let [{ : url : thp : adv } cfg _ (or url (usage)) + raw-input (: (io.input) :read "*a") b64 (base64 :url) adv (or adv (http-get (.. url "/adv/" (or thp ""))))] (assert adv.payload "advertisement is malformed")