feat(cryptography/actions): add output encoding field

This commit is contained in:
Ali BARIN
2024-07-17 08:46:32 +00:00
parent 949a2543f5
commit 58819aad94
2 changed files with 33 additions and 5 deletions

View File

@@ -27,19 +27,33 @@ export default defineAction({
variables: true,
},
{
label: 'Secret key',
label: 'Secret Key',
key: 'secretKey',
type: 'string',
required: true,
description: 'The secret key used to create the HMAC.',
variables: true,
},
{
label: 'Output Encoding',
key: 'outputEncoding',
type: 'dropdown',
required: true,
value: 'hex',
description: 'Specifies the encoding format for the HMAC digest output.',
options: [
{ label: 'base64', value: 'base64' },
{ label: 'base64url', value: 'base64url' },
{ label: 'hex', value: 'hex' },
],
variables: true,
},
],
async run($) {
const hash = createHmac($.step.parameters.algorithm, $.step.parameters.secretKey)
.update($.step.parameters.message)
.digest('hex');
.digest($.step.parameters.outputEncoding);
$.setActionItem({
raw: {