|
# Request utils.
|
|
|
|
when (NimMajor, NimMinor) < (1, 4):
|
|
{.push raises: [Defect].}
|
|
else:
|
|
{.push raises: [].}
|
|
|
|
import bearssl/rand, stew/byteutils
|
|
|
|
proc generateRequestId*(rng: ref HmacDrbgContext): string =
|
|
var bytes: array[10, byte]
|
|
hmacDrbgGenerate(rng[], bytes)
|
|
return toHex(bytes)
|