shrimpy-node
Version:
Client for the Shrimpy API
19 lines • 850 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var crypto = require("crypto");
var AuthenticationProvider = /** @class */ (function () {
function AuthenticationProvider(publicKey, privateKey) {
this.publicKey = publicKey;
// decode the base64 secret
this._privateKey = new Buffer(privateKey, 'base64');
}
AuthenticationProvider.prototype.sign = function (prehashString) {
// create a sha256 hmac with the secret
var hmac = crypto.createHmac('sha256', this._privateKey);
// hash the prehash string and base64 encode the result
return hmac.update(prehashString).digest('base64');
};
return AuthenticationProvider;
}());
exports.AuthenticationProvider = AuthenticationProvider;
//# sourceMappingURL=authentication-provider.js.map