mirror of https://github.com/status-im/nim-eth.git
19 lines
436 B
Nim
19 lines
436 B
Nim
import
|
|
chronos,
|
|
./../eth/keys
|
|
|
|
type AssertionCallback = proc(): bool {.gcsafe, raises: [Defect].}
|
|
|
|
proc generateByteArray*(rng: var BrHmacDrbgContext, length: int): seq[byte] =
|
|
var bytes = newSeq[byte](length)
|
|
brHmacDrbgGenerate(rng, bytes)
|
|
return bytes
|
|
|
|
proc waitUntil*(f: AssertionCallback): Future[void] {.async.} =
|
|
while true:
|
|
let res = f()
|
|
if res:
|
|
break
|
|
else:
|
|
await sleepAsync(milliseconds(50))
|