Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wrap secure-random in a delay for compatibility with GraalVM native b…
…uild
  • Loading branch information
lowecg committed Jul 11, 2022
commit 06be336727ad7142c6931d7d52677824a8b06b8f
4 changes: 2 additions & 2 deletions src/oauth/signature.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
(name a)
(str a)))

(def secure-random (java.security.SecureRandom/getInstance "SHA1PRNG"))
(def secure-random (delay (java.security.SecureRandom/getInstance "SHA1PRNG")))

(defn rand-str
"Random string for OAuth requests."
[length]
(. (new BigInteger (int (* 5 length)) ^java.util.Random secure-random) toString 32))
(. (new BigInteger (int (* 5 length)) ^java.util.Random @secure-random) toString 32))

(defn msecs->secs
"Convert milliseconds to seconds."
Expand Down