code: function role(value) {
    if (typeof value === 'boolean')
      return value;
  
    if (value !== 'sender' && value !== 'receiver')
      throw new errors.EncodingError(value, 'invalid role');
    return (value === 'sender') ? false : true;
  }
docs: restricted type helpers