What's the best way to generate a base64 token wit...
# kotest
d
What's the best way to generate a base64 token with Arb?
s
You just want a random base 64 string ?
d
Yeah, with a certain range of lengths
I don't see a base64 codepoint, which I would assume to be what I need?
s
Yes was just typing that
you need a base 64 codepoint arb (please contribute?) and then feed that into the string arb
Copy code
Arb.string(0, 128, Arb.base64())
d
I guess the naive implementation would be:
Copy code
fun Arb.Companion.base64(): Arb<Codepoint> =
    Arb.element((('a'..'z') + ('A'..'Z') + ('0'..'9') + '+' + '/').toList()).map { Codepoint(it.code) }
But that ignores the
=
padding...
It doesn't really matter in my case for now... but a real implementation wouldn't just be codepoints.
s
yeah it would be codepoints + padding
still feel free to contribute one ­čÖé
d
If I have a chance to make a more complete Arb for this, I surely will!