// Register creates a new account registration by following the "new-reg" flow.
// It returns registered account. The a argument is not modified.
//
// The registration may require the caller to agree to the CA's Terms of Service (TOS).
// If so, and the account has not indicated the acceptance of the terms (see Account for details),
// Register calls prompt with a TOS URL provided by the CA. Prompt should report
// whether the caller agrees to the terms. To always accept the terms, the caller can use AcceptTOS.
Register creates a new account registration by following the "new-reg" flow.
It returns registered account. The a argument is not modified.

The registration may require the caller to agree to the CA's Terms of Service (TOS).
If so, and the account has not indicated the acceptance of the terms ,
Register calls prompt with a TOS URL provided by the CA. Prompt should report
whether the caller agrees to the terms. To always accept the terms, the caller can use AcceptTOS.
// Register creates a new account registration by following the " new - reg " flow . // It returns registered account . The a argument is not modified . // // The registration may require the caller to agree to the CA ' s Terms of Service ( TOS ) . // If so and the account has not indicated the acceptance of the terms ( see Account for details ) // Register calls prompt with a TOS URL provided by the CA . Prompt should report // whether the caller agrees to the terms . To always accept the terms the caller can use AcceptTOS .
func (c *Client) Register(ctx context.Context, a *Account, prompt func(tosURL string) bool) (*Account, error) {
	if _, err := c.Discover(ctx); err != nil {
		return nil, err
	}
	var err error
	if a, err = c.doReg(ctx, c.dir.RegURL, "new-reg", a); err != nil {
		return nil, err
	}
	var accept bool
	if a.CurrentTerms != "" && a.CurrentTerms != a.AgreedTerms {
		accept = prompt(a.CurrentTerms)
	}
	if accept {
		a.AgreedTerms = a.CurrentTerms
		a, err = c.UpdateReg(ctx, a)
	}
	return a, err
}
func ( c * Client ) Register ( ctx context . Context , a * Account , prompt func ( tosURL string ) bool ) ( * Account , error ) { if _ , err := c . Discover ( ctx ) ; err != nil { return nil , err } var err error if a , err = c . doReg ( ctx , c . dir . RegURL , " " , a ) ; err != nil { return nil , err } var accept bool if a . CurrentTerms != " " && a . CurrentTerms != a . AgreedTerms { accept = prompt ( a . CurrentTerms ) } if accept { a . AgreedTerms = a . CurrentTerms a , err = c . UpdateReg ( ctx , a ) } return a , err }
Register creates a new account registration by following the "new-reg" flow.
Register creates a new account registration by following the " new - reg " flow .