github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/service/paperprovision.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package service 5 6 import ( 7 "github.com/keybase/client/go/engine" 8 "github.com/keybase/client/go/libkb" 9 keybase1 "github.com/keybase/client/go/protocol/keybase1" 10 "github.com/keybase/go-framed-msgpack-rpc/rpc" 11 "golang.org/x/net/context" 12 ) 13 14 type PaperProvisionHandler struct { 15 *BaseHandler 16 libkb.Contextified 17 } 18 19 func NewPaperProvisionHandler(xp rpc.Transporter, g *libkb.GlobalContext) *PaperProvisionHandler { 20 return &PaperProvisionHandler{ 21 BaseHandler: NewBaseHandler(g, xp), 22 Contextified: libkb.NewContextified(g), 23 } 24 } 25 26 func (h *PaperProvisionHandler) PaperProvision(ctx context.Context, arg keybase1.PaperProvisionArg) error { 27 uis := libkb.UIs{ 28 LogUI: h.getLogUI(arg.SessionID), 29 SecretUI: h.getSecretUI(arg.SessionID, h.G()), 30 LoginUI: h.getLoginUI(arg.SessionID), 31 ProvisionUI: h.getProvisionUI(arg.SessionID), 32 SessionID: arg.SessionID, 33 } 34 eng := engine.NewPaperProvisionEngine(h.G(), arg.Username, arg.DeviceName, arg.PaperKey) 35 m := libkb.NewMetaContext(ctx, h.G()).WithUIs(uis) 36 return engine.RunEngine2(m, eng) 37 }