restpki-client
Version:
Classes to consume Lacuna Software REST PKI
37 lines (28 loc) • 839 B
JavaScript
;
const {XmlSignatureStarter} = require('./xml-signature-starter');
const {PKCertificate} = require('./pk-certificate');
class FullXmlSignatureStarter extends XmlSignatureStarter {
constructor(client) {
super(client);
}
async startWithWebPki() {
this._verifyCommonParameters(true);
if (!this._xmlContent) {
throw new Error('The XML was not set');
}
try {
let request = this._getRequest();
let response = await this._client.getRestClient().post('Api/XmlSignatures/FullXmlSignature', request);
let result = {
token: response.token
};
if (response.certificate) {
result.certificate = new PKCertificate(response.ertificate);
}
return result;
} catch (err) {
throw err;
}
}
}
exports.FullXmlSignatureStarter = FullXmlSignatureStarter;