github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/selfprovision.go (about)

     1  package service
     2  
     3  import (
     4  	"github.com/keybase/client/go/engine"
     5  	"github.com/keybase/client/go/libkb"
     6  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	"golang.org/x/net/context"
     9  )
    10  
    11  type SelfProvisionHandler struct {
    12  	*BaseHandler
    13  	libkb.Contextified
    14  }
    15  
    16  func NewSelfProvisionHandler(xp rpc.Transporter, g *libkb.GlobalContext) *SelfProvisionHandler {
    17  	return &SelfProvisionHandler{
    18  		BaseHandler:  NewBaseHandler(g, xp),
    19  		Contextified: libkb.NewContextified(g),
    20  	}
    21  }
    22  
    23  func (h *SelfProvisionHandler) SelfProvision(ctx context.Context, arg keybase1.SelfProvisionArg) error {
    24  	uis := libkb.UIs{
    25  		LogUI:       h.getLogUI(arg.SessionID),
    26  		SecretUI:    h.getSecretUI(arg.SessionID, h.G()),
    27  		LoginUI:     h.getLoginUI(arg.SessionID),
    28  		ProvisionUI: h.getProvisionUI(arg.SessionID),
    29  		SessionID:   arg.SessionID,
    30  	}
    31  	eng := engine.NewSelfProvisionEngine(h.G(), arg.DeviceName)
    32  	m := libkb.NewMetaContext(ctx, h.G()).WithUIs(uis)
    33  	return engine.RunEngine2(m, eng)
    34  }