UNPKG

ec-sri-invoice-signer

Version:
28 lines (27 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.buildSignedInfoTag = void 0; const constants_1 = require("../../utils/constants"); const buildSignedInfoTag = ({ invoiceHash, invoiceTagId, invoiceTagRefId, keyInfoTagHash, keyInfoTagId, keyInfoRefTagId, signedInfoTagId, signedPropertiesRefTagId, signedPropertiesTagHash, signedPropertiesTagId }) => { return `\ <ds:SignedInfo Id="${signedInfoTagId}">\ <ds:CanonicalizationMethod Algorithm="${constants_1.XmlProperties.algorithms.canonicalization}"/>\ <ds:SignatureMethod Algorithm="${constants_1.XmlProperties.algorithms.signature}"/>\ <ds:Reference Id="${invoiceTagRefId}" URI="#${invoiceTagId}">\ <ds:Transforms>\ <ds:Transform Algorithm="${constants_1.XmlProperties.algorithms.transform}"/>\ </ds:Transforms>\ <ds:DigestMethod Algorithm="${constants_1.XmlProperties.algorithms.digest}"/>\ <ds:DigestValue>${invoiceHash}</ds:DigestValue>\ </ds:Reference>\ <ds:Reference Id="${signedPropertiesRefTagId}" Type="${constants_1.XmlProperties.types.signedProperties}" URI="#${signedPropertiesTagId}">\ <ds:DigestMethod Algorithm="${constants_1.XmlProperties.algorithms.digest}"/>\ <ds:DigestValue>${signedPropertiesTagHash}</ds:DigestValue>\ </ds:Reference>\ <ds:Reference Id="${keyInfoRefTagId}" URI="#${keyInfoTagId}">\ <ds:DigestMethod Algorithm="${constants_1.XmlProperties.algorithms.digest}"/>\ <ds:DigestValue>${keyInfoTagHash}</ds:DigestValue>\ </ds:Reference>\ </ds:SignedInfo>`; }; exports.buildSignedInfoTag = buildSignedInfoTag;