docs: function User(db, username, opts) {
    if (typeof db !== 'object') { throw new TypeError('db must be an object'); }
    if (typeof username !== 'string') { throw new TypeError('username must be a string'); }
  
    opts = opts || {};
    if (typeof opts !== 'object') { throw new TypeError('opts must be an object'); }
  
    var realm = '_default';
    if (typeof opts.realm !== 'undefined') {
      if (typeof opts.realm !== 'string') { throw new TypeError('opts.realm must be a string'); }
      realm = opts.realm;
    }
    if (typeof opts.debug !== 'undefined' && typeof opts.debug !== 'boolean') { throw new TypeError('opts.debug must be a boolean'); }
    if (typeof opts.hide !== 'undefined' && typeof opts.hide !== 'boolean') { throw new TypeError('opts.hide must be a boolean'); }
  
    if (username.length < 2) { throw new Error('username must be at least 2 characters'); }
    if (username.length > 128) { throw new Error('username can not exceed 128 characters'); }
    if (realm.length < 1) { throw new Error('opts.realm must be at least 1 character'); }
    if (realm.length > 128) { throw new Error('opts.realm can not exceed 128 characters'); }
  
    this._db = db;
    this._username = username;
    this._realm = realm;
  
    this._debug = opts.debug || false;
    this._hide = opts.hide || false;
  
    // keys that should be mapped from the user object that is stored in the user db
    this._protectedDbKeys = {
      realm: true,
      username: true,
      password: true
    };
  
    // keys that can not be used in the user object that is stored in the user db
    this._illegalDbKeys = {
      _protectedDbKeys: true,
      _illegalDbKeys: true,
      _db: true,
      _debug: true,
      _hide: true
    };
  }