import { readVarUint, readVarString } from '../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 (readVarUint(decoder)) {
    case messagePermissionDenied: permissionDeniedHandler(y, readVarString(decoder));
  }
};

export { messagePermissionDenied, readAuthMessage };
//# sourceMappingURL=auth.js.map
