forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.go
48 lines (41 loc) · 1.3 KB
/
account.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package service
import (
"github.com/keybase/client/go/engine"
"github.com/keybase/client/go/libkb"
keybase1 "github.com/keybase/client/go/protocol"
rpc "github.com/keybase/go-framed-msgpack-rpc"
"golang.org/x/net/context"
)
type AccountHandler struct {
*BaseHandler
libkb.Contextified
}
func NewAccountHandler(xp rpc.Transporter, g *libkb.GlobalContext) *AccountHandler {
return &AccountHandler{
BaseHandler: NewBaseHandler(xp),
Contextified: libkb.NewContextified(g),
}
}
func (h *AccountHandler) PassphraseChange(_ context.Context, arg keybase1.PassphraseChangeArg) error {
eng := engine.NewPassphraseChange(&arg, h.G())
ctx := &engine.Context{
SecretUI: h.getSecretUI(arg.SessionID),
}
return engine.RunEngine(eng, ctx)
}
func (h *AccountHandler) PassphrasePrompt(_ context.Context, arg keybase1.PassphrasePromptArg) (keybase1.GetPassphraseRes, error) {
ui := h.getSecretUI(arg.SessionID)
if h.G().UIRouter != nil {
delegateUI, err := h.G().UIRouter.GetSecretUI()
if err != nil {
return keybase1.GetPassphraseRes{}, err
}
if delegateUI != nil {
ui = delegateUI
h.G().Log.Debug("using delegate secret UI")
}
}
return ui.GetPassphrase(arg.GuiArg, nil)
}