Adjacent work: PDF receipts, encrypted blob+share mock, NATS tunnel, SHA256 Zapier action
Around remaining blockers (Zapier login, live Verae): generate PDF receipts without extra deps; AES-256-GCM object store with tenant isolation and share tokens; scripts/nats-tunnel.sh to NS1; SHA256 Hash Text local Zapier action; scripts/test-offline.sh for the no-login suite. Learned: other-tenant object GET is 403; share token is the mock unwrap path.
This commit is contained in:
parent
c8f9d01a04
commit
645a24909a
45 changed files with 1053 additions and 24 deletions
36
packages/verae-activate/creates/sha256.js
Normal file
36
packages/verae-activate/creates/sha256.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* SHA256 of a string — local, no API. Lets you hash a file/text in a Zap.
|
||||
* @module creates/sha256
|
||||
*/
|
||||
|
||||
const { createHash } = require('node:crypto');
|
||||
|
||||
const perform = async (_z, bundle) => {
|
||||
const text = String(bundle.inputData.text ?? '');
|
||||
const sha256 = createHash('sha256').update(text, 'utf8').digest('hex');
|
||||
return { textLength: text.length, sha256, mode: 'local' };
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
key: 'sha256_hash',
|
||||
noun: 'Hash',
|
||||
display: {
|
||||
label: 'SHA256 Hash Text',
|
||||
description: 'Computes SHA256 hex of text inside Zapier. No Verae call.',
|
||||
},
|
||||
operation: {
|
||||
cleanInputData: false,
|
||||
inputFields: [{ key: 'text', label: 'Text', type: 'text', required: true }],
|
||||
perform,
|
||||
sample: {
|
||||
textLength: 5,
|
||||
sha256: '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824',
|
||||
mode: 'local',
|
||||
},
|
||||
outputFields: [
|
||||
{ key: 'sha256', type: 'string' },
|
||||
{ key: 'textLength', type: 'integer' },
|
||||
{ key: 'mode', type: 'string' },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
const authentication = require('./authentication');
|
||||
const addNumbers = require('./creates/add_numbers');
|
||||
const echo = require('./creates/echo');
|
||||
const sha256Hash = require('./creates/sha256');
|
||||
|
||||
module.exports = {
|
||||
version: require('./package.json').version,
|
||||
|
|
@ -18,5 +19,6 @@ module.exports = {
|
|||
creates: {
|
||||
[addNumbers.key]: addNumbers,
|
||||
[echo.key]: echo,
|
||||
[sha256Hash.key]: sha256Hash,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ describe('verae-activate app', () => {
|
|||
assert.equal(authentication.type, 'custom');
|
||||
assert.ok(App.creates.add_numbers);
|
||||
assert.ok(App.creates.echo);
|
||||
assert.ok(App.creates.sha256_hash);
|
||||
assert.equal(addNumbers.key, 'add_numbers');
|
||||
assert.ok(addNumbers.operation.inputFields.some((f) => f.key === 'number1'));
|
||||
assert.ok(addNumbers.operation.inputFields.some((f) => f.key === 'number2'));
|
||||
|
|
@ -64,6 +65,13 @@ describe('verae-activate app', () => {
|
|||
assert.equal(result.sum, 5);
|
||||
});
|
||||
|
||||
it('sha256 hashes hello', async () => {
|
||||
const sha = require('../creates/sha256');
|
||||
const out = await sha.operation.perform({}, { inputData: { text: 'hello' }, authData: {} });
|
||||
assert.equal(out.sha256, '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824');
|
||||
assert.equal(out.mode, 'local');
|
||||
});
|
||||
|
||||
it('echo returns text length', async () => {
|
||||
const echo = require('../creates/echo');
|
||||
const out = await echo.operation.perform({}, { inputData: { text: 'ab' }, authData: {} });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue