sendingnetwork-bot-sdk
Version:
TypeScript/JavaScript SDK for SDN bots
21 lines • 757 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.requiresCrypto = void 0;
/**
* Flags a SDNClient function as needing end-to-end encryption enabled.
* @category Encryption
*/
function requiresCrypto() {
return function (target, propertyKey, descriptor) {
const originalMethod = descriptor.value;
descriptor.value = function (...args) {
const client = this; // eslint-disable-line @typescript-eslint/no-this-alias
if (!client.crypto) {
throw new Error("End-to-end encryption is not enabled");
}
return originalMethod.apply(this, args);
};
};
}
exports.requiresCrypto = requiresCrypto;
//# sourceMappingURL=decorators.js.map