Files
directus/tests/blackbox/setup/setup-utils.js
Pascal Jufer 1ec1f98431 Bye-bye, Jest (#19886)
* 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 commit da807c6ec8.

* 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 commit d6fbdd76c9.

* Use TS for Vitest config file

* Simplify vendors typecasting

---------

Co-authored-by: ian <licitdev@gmail.com>
2023-10-04 14:53:36 -04:00

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);
}