github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/provision.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  	"golang.org/x/net/context"
     8  
     9  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
    10  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    11  )
    12  
    13  type RemoteProvisionUI struct {
    14  	sessionID int
    15  	cli       keybase1.ProvisionUiClient
    16  }
    17  
    18  func NewRemoteProvisionUI(sessionID int, c *rpc.Client) *RemoteProvisionUI {
    19  	return &RemoteProvisionUI{
    20  		sessionID: sessionID,
    21  		cli:       keybase1.ProvisionUiClient{Cli: c},
    22  	}
    23  }
    24  
    25  func (u *RemoteProvisionUI) ChooseProvisioningMethod(ctx context.Context, arg keybase1.ChooseProvisioningMethodArg) (keybase1.ProvisionMethod, error) {
    26  	arg.SessionID = u.sessionID
    27  	return u.cli.ChooseProvisioningMethod(ctx, arg)
    28  }
    29  
    30  func (u *RemoteProvisionUI) ChooseGPGMethod(ctx context.Context, arg keybase1.ChooseGPGMethodArg) (keybase1.GPGMethod, error) {
    31  	arg.SessionID = u.sessionID
    32  	return u.cli.ChooseGPGMethod(ctx, arg)
    33  }
    34  
    35  func (u *RemoteProvisionUI) SwitchToGPGSignOK(ctx context.Context, arg keybase1.SwitchToGPGSignOKArg) (bool, error) {
    36  	arg.SessionID = u.sessionID
    37  	return u.cli.SwitchToGPGSignOK(ctx, arg)
    38  }
    39  
    40  func (u *RemoteProvisionUI) ChooseDevice(ctx context.Context, arg keybase1.ChooseDeviceArg) (keybase1.DeviceID, error) {
    41  	arg.SessionID = u.sessionID
    42  	return u.cli.ChooseDevice(ctx, arg)
    43  }
    44  
    45  func (u *RemoteProvisionUI) ChooseDeviceType(ctx context.Context, arg keybase1.ChooseDeviceTypeArg) (keybase1.DeviceType, error) {
    46  	arg.SessionID = u.sessionID
    47  	return u.cli.ChooseDeviceType(ctx, arg)
    48  }
    49  
    50  func (u *RemoteProvisionUI) DisplayAndPromptSecret(ctx context.Context, arg keybase1.DisplayAndPromptSecretArg) (keybase1.SecretResponse, error) {
    51  	arg.SessionID = u.sessionID
    52  	return u.cli.DisplayAndPromptSecret(ctx, arg)
    53  }
    54  
    55  func (u *RemoteProvisionUI) PromptNewDeviceName(ctx context.Context, arg keybase1.PromptNewDeviceNameArg) (string, error) {
    56  	arg.SessionID = u.sessionID
    57  	return u.cli.PromptNewDeviceName(ctx, arg)
    58  }
    59  
    60  func (u *RemoteProvisionUI) DisplaySecretExchanged(ctx context.Context, _ int) error {
    61  	return u.cli.DisplaySecretExchanged(ctx, u.sessionID)
    62  }
    63  
    64  func (u *RemoteProvisionUI) ProvisionerSuccess(ctx context.Context, arg keybase1.ProvisionerSuccessArg) error {
    65  	arg.SessionID = u.sessionID
    66  	return u.cli.ProvisionerSuccess(ctx, arg)
    67  }
    68  
    69  func (u *RemoteProvisionUI) ProvisioneeSuccess(ctx context.Context, arg keybase1.ProvisioneeSuccessArg) error {
    70  	arg.SessionID = u.sessionID
    71  	return u.cli.ProvisioneeSuccess(ctx, arg)
    72  }