Replace os.urandom(32).hex() with secrets.token_hex(32)

This commit is contained in:
Simon Willison 2020-06-08 21:37:35 -07:00
commit 5a6a73e319
2 changed files with 4 additions and 3 deletions

View file

@ -302,7 +302,7 @@ Or::
One way to generate a secure random secret is to use Python like this::
$ python3 -c 'import os; print(os.urandom(32).hex())'
$ python3 -c 'import secrets; print(secrets.token_hex(32))'
cdb19e94283a20f9d42cca50c5a4871c0aa07392db308755d60a1a5b9bb0fa52
Plugin authors make use of this signing mechanism in their plugins using :ref:`datasette_sign` and :ref:`datasette_unsign`.