Skip to content

change-engine/pbkdf-subtle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pbkdf-subtle

Hash/Verify PBKDF2. Uses only crypto.subtle.

Usage

./hash.mjs my_secret_password

To check the Authorization header:

const TOKEN_HASH = 'djAxKFWLYXubAcE8y5FktPCwWQGGoKVaFpkJ2OUcLRnV56O68DFbWSODXoVkBZn19otVVSiP';

const [scheme, token] = (request.headers.get('Authorization') ?? ' ').split(' ');
if (scheme != 'token' || !(await verify(TOKEN_HASH, token))) return new Response('', { status: 401 });