code: func (a *Authority) UnmarshalJSON(d []byte) error {
  	switch {
  	case bytes.Equal(d, asAnonymousJSON):
  		*a = AsAnonymous
  	case bytes.Equal(d, asServiceJSON):
  		*a = AsService
  	case bytes.Equal(d, asUserJSON):
  		*a = AsUser
  	default:
  		return errors.Reason("unknown authority JSON value: %v", d).Err()
  	}
  	return nil
  }
docs: // UnmarshalJSON implements encoding/json.Unmarshaler.