Check token salt on hash

This commit is contained in:
Convly 2023-02-27 19:10:04 +01:00
parent ae23359954
commit 9afb0ad86d

View File

@ -328,6 +328,12 @@ const getExpirationFields = (lifespan) => {
* @returns {string}
*/
const hash = (accessKey) => {
const { hasValidTokenSalt } = getService('transfer').utils;
if (!hasValidTokenSalt()) {
throw new TypeError('Required token salt is not defined');
}
return crypto
.createHmac('sha512', strapi.config.get('admin.transfer.token.salt'))
.update(accessKey)