provide string to perform-encryption
instead of letting it read stdin, which I think may have been read by a subprocess already sometimes?
This commit is contained in:
parent
43e5e6876e
commit
3913989be3
@ -121,7 +121,7 @@
|
|||||||
jwk (jwk-exc-noi rep tmp)]
|
jwk (jwk-exc-noi rep tmp)]
|
||||||
(print (jwe-dec jwk ph undigested)))))
|
(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-"]
|
(let [enc (jose! [:jwk :use "-i-" "-r" "-u" "deriveKey" "-o-"]
|
||||||
(json.encode jwks))
|
(json.encode jwks))
|
||||||
;; adding a -s to jwk use will "Always output a JWKSet" which
|
;; adding a -s to jwk use will "Always output a JWKSet" which
|
||||||
@ -140,8 +140,7 @@
|
|||||||
:clevis {:pin "tang"
|
:clevis {:pin "tang"
|
||||||
:tang {:url url :adv jwks }}}}]
|
:tang {:url url :adv jwks }}}}]
|
||||||
(josep! [:jwe :enc "-i-" "-k-" "-I-" "-c"]
|
(josep! [:jwe :enc "-i-" "-k-" "-I-" "-c"]
|
||||||
(.. (json.encode jwe) (json.encode jwk)
|
(.. (json.encode jwe) (json.encode jwk) input)))))
|
||||||
(: (io.input) :read "*a"))))))
|
|
||||||
|
|
||||||
(fn usage []
|
(fn usage []
|
||||||
(print "tangc\n=====\n")
|
(print "tangc\n=====\n")
|
||||||
@ -157,6 +156,7 @@
|
|||||||
(fn encrypt [cfg]
|
(fn encrypt [cfg]
|
||||||
(let [{ : url : thp : adv } cfg
|
(let [{ : url : thp : adv } cfg
|
||||||
_ (or url (usage))
|
_ (or url (usage))
|
||||||
|
raw-input (: (io.input) :read "*a")
|
||||||
b64 (base64 :url)
|
b64 (base64 :url)
|
||||||
adv (or adv (http-get (.. url "/adv/" (or thp ""))))]
|
adv (or adv (http-get (.. url "/adv/" (or thp ""))))]
|
||||||
(assert adv.payload "advertisement is malformed")
|
(assert adv.payload "advertisement is malformed")
|
||||||
|
Loading…
Reference in New Issue
Block a user