mirror of
https://github.com/directus/directus.git
synced 2026-01-14 22:08:06 -05:00
* Bye-bye, Jest * Clean-up non-null assertions for PORT * Test all vendors * Consistent file names * Try with MSSQL 2022 * Revert "Try with MSSQL 2022" This reverts commitda807c6ec8. * Try to run on Windows for better MSSQL perf * Worth a try (hopefully runs MSSQL faster this way) * Start docker services via bash * Quick attempt with local installation of MSSQL * Test with MSSQL 2019 * Back to ubuntu-latest for other tests * Add typecheck cmd * Revert "Test all vendors" This reverts commitd6fbdd76c9. * Use TS for Vitest config file * Simplify vendors typecasting --------- Co-authored-by: ian <licitdev@gmail.com>
14 lines
627 B
JavaScript
14 lines
627 B
JavaScript
import argon2 from 'argon2';
|
|
|
|
export function generateHash(stringToHash) {
|
|
const buffer = 'string';
|
|
const argon2HashConfigOptions = { test: 'test', associatedData: buffer }; // Disallow the HASH_RAW option, see https://github.com/directus/directus/discussions/7670#discussioncomment-1255805
|
|
|
|
// test, if specified, must be passed as a Buffer to argon2.hash, see https://github.com/ranisalt/node-argon2/wiki/Options#test
|
|
if ('test' in argon2HashConfigOptions) {
|
|
argon2HashConfigOptions.associatedData = Buffer.from(argon2HashConfigOptions.associatedData);
|
|
}
|
|
|
|
return argon2.hash(stringToHash, argon2HashConfigOptions);
|
|
}
|