code: func (ra *RegistrationAuthorityImpl) NewRegistration(ctx context.Context, init core.Registration) (core.Registration, error) {
  	if err := ra.keyPolicy.GoodKey(init.Key.Key); err != nil {
  		return core.Registration{}, berrors.MalformedError("invalid public key: %s", err.Error())
  	}
  	if err := ra.checkRegistrationLimits(ctx, init.InitialIP); err != nil {
  		return core.Registration{}, err
  	}
  
  	reg := core.Registration{
  		Key:    init.Key,
  		Status: core.StatusValid,
  	}
  	_ = mergeUpdate(&reg, init)
  
  	// This field isn't updatable by the end user, so it isn't copied by
  	// MergeUpdate. But we need to fill it in for new registrations.
  	reg.InitialIP = init.InitialIP
  
  	if err := ra.validateContacts(ctx, reg.Contact); err != nil {
  		return core.Registration{}, err
  	}
  
  	// Store the authorization object, then return it
  	reg, err := ra.SA.NewRegistration(ctx, reg)
  	if err != nil {
  		return core.Registration{}, err
  	}
  
  	ra.stats.Inc("NewRegistrations", 1)
  	return reg, nil
  }
docs: // NewRegistration constructs a new Registration from a request.