node-ebics-client/lib/middleware/XMLSign.js
2018-06-11 15:25:07 +03:00

16 lines
436 B
JavaScript

'use strict';
const H004Signer = require('../versions/H004/Signer');
const H004Serializer = require('../versions/H004/OrderSerializer');
module.exports = class XMLSign {
static sign(order) {
const { keys } = order;
if (order.version.toUpperCase() === 'H004') return new H004Signer(H004Serializer.serialize(order).toXML(), keys).digest().sign().toXML();
throw Error('Error from XMLSign class: Invalid version number');
}
};