Skip to content

feat: expose platform generation of secret bytes - #123

Open
zao wants to merge 1 commit into
PathOfBuildingCommunity:masterfrom
zao:feat/random-bytes
Open

zao wants to merge 1 commit into
PathOfBuildingCommunity:masterfrom
zao:feat/random-bytes

Conversation

@zao

@zao zao commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Stock Lua libraries doesn't have any easy access to generation of random bytes suitable for moderately secure purposes like API authentication.

This introduces GenerateSecretBytes(count) which leverages underlying operating system functionality to generate sufficiently good random bytes. On Windows it uses BCrypt and on other platforms it's stubbed to use /dev/urandom.

It's intentionally named in a way that suggests that it's not a primary source of fast random numbers for other purposes.

Stock Lua libraries doesn't have any easy access to generation of random
bytes suitable for moderately secure purposes like API authentication.

This introduces `GenerateSecretBytes(count)` which leverages underlying
operating system functionality to generate sufficiently good random
bytes. On Windows it uses BCrypt and on other platforms it's stubbed to
use `/dev/urandom`.

It's intentionally named in a way that suggests that it's not a primary
source of fast random numbers for other purposes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant