Skip to main content

Module secret

Module secret 

Source
Expand description

Secrets that are made, not chosen, and what is kept of them.

Constants§

SECRET_CHARS
Characters of base64url text that 32 random bytes take.

Functions§

generate
Makes a secret: prefix followed by 256 random bits as 43 URL-safe base64 characters.
hash
What a secret is kept as: its SHA-256 as 64 lowercase hexadecimal characters.
hash_bytes
The SHA-256 of bytes as 64 lowercase hexadecimal characters.
identifier
Makes a random 128-bit identifier as 32 lowercase hexadecimal characters.
is_hash
Whether value is a SHA-256 digest as hash writes it.
same
Compares two strings in time that does not depend on where they differ.