linkpay-api
Version:
LinkPay JS/TS API SDK
33 lines (32 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpHeader = exports.SignType = void 0;
var SignType;
(function (SignType) {
SignType["SHA256"] = "SHA256";
SignType["SHA512"] = "SHA512";
})(SignType = exports.SignType || (exports.SignType = {}));
var HttpHeader = /** @class */ (function () {
function HttpHeader(signType, signature) {
this.contentType = 'application/json';
this.dateTime = signature.dateTime;
this.msgID = signature.msgID;
this.signType = signType;
if (this.signType === SignType.SHA256)
this.authorization = signature.sha256();
else
this.authorization = signature.sha512();
}
HttpHeader.prototype.toRecord = function () {
return {
'Authorization': this.authorization,
'Content-Type': this.contentType,
'DateTime': this.dateTime,
'MsgID': this.msgID,
'SignType': this.signType,
};
};
return HttpHeader;
}());
exports.HttpHeader = HttpHeader;
exports.default = HttpHeader;