'use strict';

var decoding = require('../lib0/decoding.js');

const messagePermissionDenied = 0;

/**
 * @callback PermissionDeniedHandler
 * @param {any} y
 * @param {string} reason
 */

/**
 *
 * @param {decoding.Decoder} decoder
 * @param {Y.Doc} y
 * @param {PermissionDeniedHandler} permissionDeniedHandler
 */
const readAuthMessage = (decoder, y, permissionDeniedHandler) => {
  switch (decoding.readVarUint(decoder)) {
    case messagePermissionDenied: permissionDeniedHandler(y, decoding.readVarString(decoder));
  }
};

exports.messagePermissionDenied = messagePermissionDenied;
exports.readAuthMessage = readAuthMessage;
//# sourceMappingURL=auth.js.map
