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