github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/service/gpg.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  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     8  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     9  	"golang.org/x/net/context"
    10  )
    11  
    12  type RemoteGPGUI struct {
    13  	sessionID int
    14  	uicli     keybase1.GpgUiClient
    15  }
    16  
    17  func NewRemoteGPGUI(sessionID int, c *rpc.Client) *RemoteGPGUI {
    18  	return &RemoteGPGUI{
    19  		sessionID: sessionID,
    20  		uicli:     keybase1.GpgUiClient{Cli: c},
    21  	}
    22  }
    23  
    24  func (r *RemoteGPGUI) SelectKey(ctx context.Context, arg keybase1.SelectKeyArg) (string, error) {
    25  	arg.SessionID = r.sessionID
    26  	return r.uicli.SelectKey(ctx, arg)
    27  }
    28  
    29  func (r *RemoteGPGUI) SelectKeyAndPushOption(ctx context.Context, arg keybase1.SelectKeyAndPushOptionArg) (keybase1.SelectKeyRes, error) {
    30  	arg.SessionID = r.sessionID
    31  	return r.uicli.SelectKeyAndPushOption(ctx, arg)
    32  }
    33  
    34  func (r *RemoteGPGUI) WantToAddGPGKey(ctx context.Context, _ int) (bool, error) {
    35  	return r.uicli.WantToAddGPGKey(ctx, r.sessionID)
    36  }
    37  
    38  func (r *RemoteGPGUI) ConfirmDuplicateKeyChosen(ctx context.Context, _ int) (bool, error) {
    39  	return r.uicli.ConfirmDuplicateKeyChosen(ctx, r.sessionID)
    40  }
    41  func (r *RemoteGPGUI) ConfirmImportSecretToExistingKey(ctx context.Context, _ int) (bool, error) {
    42  	return r.uicli.ConfirmImportSecretToExistingKey(ctx, r.sessionID)
    43  }
    44  func (r *RemoteGPGUI) Sign(ctx context.Context, arg keybase1.SignArg) (string, error) {
    45  	return r.uicli.Sign(ctx, arg)
    46  }
    47  func (r *RemoteGPGUI) GetTTY(ctx context.Context) (string, error) {
    48  	return r.uicli.GetTTY(ctx)
    49  }