UNPKG

@imgproxy/imgproxy-node

Version:

Official node url-builder lib for imgproxy - fast and secure standalone server for resizing and converting remote images

19 lines (18 loc) 548 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const SALT = process.env.IMGPROXY_SALT; const KEY = process.env.IMGPROXY_KEY; const isPair = (arr) => arr.every(Boolean); const getSignedPair = (pair) => { let wipPair = [pair.key, pair.salt]; if (!isPair(wipPair)) { wipPair = [KEY, SALT]; if (!isPair(wipPair)) return undefined; } return { salt: wipPair[1].split(",")[0].trim(), key: wipPair[0].split(",")[0].trim(), }; }; exports.default = getSignedPair;