UNPKG

@onereach/webform

Version:

Content Builder includes several views for: - Content builder view itself; - Web Form view; - Slack block-kit builder;

11 lines (8 loc) 405 B
import { createDecipheriv } from 'browserify-aes/browser'; export const encryptAuth = ({ iv, key, cipher }) => { if (!iv || !cipher || !key) throw new Error('Not enough encrypt information'); const cryptoKey = createDecipheriv('aes-256-cbc', Buffer.from(key, 'hex'), Buffer.from(iv, 'hex')); return Buffer.concat([cryptoKey.update(Buffer.from(cipher, 'hex')), cryptoKey.final()]).toString(); };