var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import { SERVICE_CALLS } from "./service-calls";
import { AbstractService } from "@iotize/tap";
var ScramService = /** @class */ (function (_super) {
    __extends(ScramService, _super);
    function ScramService() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.resources = SERVICE_CALLS;
        return _this;
    }
    /**
     * First command to initiate scram login, for client to send login and nonce to IoTize, and IoTize to return user salt, user iteration counter (j) and combined nonce
     *
     * LWM2M path: /1024//40
     *
     * @tapVersion(">=")
     * @param params input
     * @return
     */
    ScramService.prototype.login = function (
    /*
     *
     */
    params) {
        return this.serviceCallRunner.execute(this.loginCall(params));
    };
    /**
     *
     *
     * LWM2M path: /1024//40
     *
     * @tapVersion(">=")
     * @param params input
     * @return call options
     */
    ScramService.prototype.loginCall = function (
    /*
     *
     */
    params) {
        var callOptions = __assign({}, this.resources.login);
        callOptions.body = params;
        return callOptions;
    };
    /**
     * Scram login proof
     *
     * LWM2M path: /1024//41
     *
     * @tapVersion(">=")
     * @param params input
     * @return
     */
    ScramService.prototype.loginProof = function (
    /*
     *
     */
    params) {
        return this.serviceCallRunner.execute(this.loginProofCall(params));
    };
    /**
     *
     *
     * LWM2M path: /1024//41
     *
     * @tapVersion(">=")
     * @param params input
     * @return call options
     */
    ScramService.prototype.loginProofCall = function (
    /*
     *
     */
    params) {
        var callOptions = __assign({}, this.resources.loginProof);
        callOptions.body = params;
        return callOptions;
    };
    /**
     * Get scram hash iteration counter
     *
     * LWM2M path: /1024//42
     *
     * @tapVersion(">=1.11")
     * @return
     */
    ScramService.prototype.getHashIteration = function () {
        return this.serviceCallRunner.execute(this.getHashIterationCall());
    };
    /**
     *
     *
     * LWM2M path: /1024//42
     *
     * @tapVersion(">=1.11")
     * @return call options
     */
    ScramService.prototype.getHashIterationCall = function () {
        var callOptions = __assign({}, this.resources.getHashIteration);
        return callOptions;
    };
    /**
     * Set scram hash iteration counter
     *
     * LWM2M path: /1024//42
     *
     * @tapVersion(">=1.11")
     * @param data input
     * @return
     */
    ScramService.prototype.putHashIteration = function (
    /*
     *
     */
    data) {
        return this.serviceCallRunner.execute(this.putHashIterationCall(data));
    };
    /**
     *
     *
     * LWM2M path: /1024//42
     *
     * @tapVersion(">=1.11")
     * @param data input
     * @return call options
     */
    ScramService.prototype.putHashIterationCall = function (
    /*
     *
     */
    data) {
        var callOptions = __assign({}, this.resources.putHashIteration);
        callOptions.body = data;
        return callOptions;
    };
    /**
     * Start scram communication
     *
     * LWM2M path: /1024//47
     *
     * @tapVersion(">=1.11")
     * @return
     */
    ScramService.prototype.initialize = function () {
        return this.serviceCallRunner.execute(this.initializeCall());
    };
    /**
     *
     *
     * LWM2M path: /1024//47
     *
     * @tapVersion(">=1.11")
     * @return call options
     */
    ScramService.prototype.initializeCall = function () {
        var callOptions = __assign({}, this.resources.initialize);
        return callOptions;
    };
    /**
     * Communication channel
     *
     * LWM2M path: /1024//48
     *
     * @tapVersion(">=1.11")
     * @param data input
     * @return
     */
    ScramService.prototype.send = function (
    /*
     *
     */
    data) {
        return this.serviceCallRunner.execute(this.sendCall(data));
    };
    /**
     *
     *
     * LWM2M path: /1024//48
     *
     * @tapVersion(">=1.11")
     * @param data input
     * @return call options
     */
    ScramService.prototype.sendCall = function (
    /*
     *
     */
    data) {
        var callOptions = __assign({}, this.resources.send);
        callOptions.body = data;
        return callOptions;
    };
    /**
     * Give encryption initialization vector to the Tap. The device returns its own initialization vector
     *
     * LWM2M path: /1024//45
     *
     * @tapVersion(">=1.85")
     * @param data input
     * @return
     */
    ScramService.prototype.setInitializationVector = function (
    /*
     * 16 bytes initialization vector
     */
    data) {
        return this.serviceCallRunner.execute(this.setInitializationVectorCall(data));
    };
    /**
     *
     *
     * LWM2M path: /1024//45
     *
     * @tapVersion(">=1.85")
     * @param data input
     * @return call options
     */
    ScramService.prototype.setInitializationVectorCall = function (
    /*
     * 16 bytes initialization vector
     */
    data) {
        var callOptions = __assign({}, this.resources.setInitializationVector);
        callOptions.body = data;
        return callOptions;
    };
    /**
     * Communication channel with encryption initialization vectory
     *
     * LWM2M path: /1024//44
     *
     * @tapVersion(">=1.85")
     * @param data input
     * @return
     */
    ScramService.prototype.sendWithIV = function (
    /*
     *
     */
    data) {
        return this.serviceCallRunner.execute(this.sendWithIVCall(data));
    };
    /**
     *
     *
     * LWM2M path: /1024//44
     *
     * @tapVersion(">=1.85")
     * @param data input
     * @return call options
     */
    ScramService.prototype.sendWithIVCall = function (
    /*
     *
     */
    data) {
        var callOptions = __assign({}, this.resources.sendWithIV);
        callOptions.body = data;
        return callOptions;
    };
    return ScramService;
}(AbstractService));
export { ScramService };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0Bpb3RpemUvdGFwL3NlcnZpY2UvaW1wbC9zY3JhbS8iLCJzb3VyY2VzIjpbImxpYi9nZW5lcmF0ZWQvc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFJQSxPQUFPLEVBQUUsYUFBYSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFNaEQsT0FBTyxFQUFFLGVBQWUsRUFBbUIsTUFBTSxhQUFhLENBQUM7QU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