code: func (m *Machine) EncodeToken(ctx context.Context, notifier *observer.Notifier,
  	token *envelope.MachineToken) error {
  
  	n := notifier.Notifier(2)
  
  	n.Notify(observer.Progress, "Creating keyring memberships for token", true)
  
  	v1members, v2members, err := createKeyringMemberships(ctx, m.engine.crypto,
  		m.engine.client, m.engine.session, token.Body.OrgID, token.ID)
  	if err != nil {
  		return err
  	}
  
  	n.Notify(observer.Progress, "Uploading keyring memberships", true)
  
  	if len(v1members) != 0 {
  		_, err = m.engine.client.KeyringMember.Post(ctx, v1members)
  		if err != nil {
  			log.Printf("error uploading memberships: %s", err)
  			return err
  		}
  	}
  
  	for _, member := range v2members {
  		err = m.engine.client.Keyring.Members.Post(ctx, member)
  		if err != nil {
  			log.Printf("error uploading memberships: %s", err)
  			return err
  		}
  	}
  
  	return nil
  }
docs: // EncodeToken creates KeyringMemberships for the provided Machine Token. Used
  // during the machine creation process