Project

General

Profile

Actions

Feature #98665

open

New stdWrap property to generate HMAC hash

Added by Henrik Ziegenhain over 1 year ago. Updated about 1 year ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Frontend
Start date:
2022-10-20
Due date:
% Done:

0%

Estimated time:
PHP Version:
8.1
Tags:
Complexity:
medium
Sprint Focus:

Description

Hi all,

would it be a helpful feature to add a new property "hmac" to stdWrap?

Currently there is a property to generate a simple hash for given values.
This is lacking same "salt".

The new property stdWrap.hmac could be a simple wrapper for GeneralUtility::hmac method at the end

It could look like this:

public function stdWrap_hmac($content = '', array $conf = [])
{
    $additionalSecret = '';
    $hmacDot = $this->stdWrapValue('hmac.', $conf ?? []);
    if (is_array($hmacDot)) {
        $additionalSecret = (string)$this->stdWrapValue('additionalSecret', $hmacDot ?? []);
    }
    if (!empty($content)) {
        return GeneralUtility::hmac($content, $additionalSecret);
    }
    // Non-existing content
    return '';
}

lib.currentUserHmac = TEXT
lib.currentUserHmac {
    data = TSFE:fe_user|user|username
    stdWrap.hmac = 1
    stdWrap.hmac {
        additionalSecret = MyAdditionalSecret
    }
}

Looking forward to your comments :-)
Henrik

Actions

Also available in: Atom PDF