Expand description
Authentication and hashing helpers for the in-browser editing endpoints.
Editing is gated by a pre-shared bearer token. The token is never stored;
only an Argon2 PHC hash of it lives in .mbr/config.toml
(edit_token_hash). verify_token compares a presented token against that
hash in constant time (Argon2’s verifier).
content_hash provides the SHA-256 used for optimistic-concurrency
checks on the raw-markdown / save endpoints.
Functions§
- content_
hash - SHA-256 of the given bytes, hex-encoded. Used for optimistic-concurrency
hashes exchanged with the editor client (
X-MBR-Content-Hash). - generate_
token - Generates a random 32-byte token, hex-encoded (64 chars).
- hash_
token - Hashes a token/password into an Argon2 PHC string (includes a random salt).
- verify_
token - Verifies a presented token against a stored Argon2 PHC hash.