github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/gpg_ui.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/gpg_ui.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  type SelectKeyRes struct {
    13  	KeyID        string `codec:"keyID" json:"keyID"`
    14  	DoSecretPush bool   `codec:"doSecretPush" json:"doSecretPush"`
    15  }
    16  
    17  func (o SelectKeyRes) DeepCopy() SelectKeyRes {
    18  	return SelectKeyRes{
    19  		KeyID:        o.KeyID,
    20  		DoSecretPush: o.DoSecretPush,
    21  	}
    22  }
    23  
    24  type WantToAddGPGKeyArg struct {
    25  	SessionID int `codec:"sessionID" json:"sessionID"`
    26  }
    27  
    28  type ConfirmDuplicateKeyChosenArg struct {
    29  	SessionID int `codec:"sessionID" json:"sessionID"`
    30  }
    31  
    32  type ConfirmImportSecretToExistingKeyArg struct {
    33  	SessionID int `codec:"sessionID" json:"sessionID"`
    34  }
    35  
    36  type SelectKeyAndPushOptionArg struct {
    37  	SessionID int      `codec:"sessionID" json:"sessionID"`
    38  	Keys      []GPGKey `codec:"keys" json:"keys"`
    39  }
    40  
    41  type SelectKeyArg struct {
    42  	SessionID int      `codec:"sessionID" json:"sessionID"`
    43  	Keys      []GPGKey `codec:"keys" json:"keys"`
    44  }
    45  
    46  type SignArg struct {
    47  	Msg         []byte `codec:"msg" json:"msg"`
    48  	Fingerprint []byte `codec:"fingerprint" json:"fingerprint"`
    49  }
    50  
    51  type GetTTYArg struct {
    52  }
    53  
    54  type GpgUiInterface interface {
    55  	WantToAddGPGKey(context.Context, int) (bool, error)
    56  	ConfirmDuplicateKeyChosen(context.Context, int) (bool, error)
    57  	ConfirmImportSecretToExistingKey(context.Context, int) (bool, error)
    58  	SelectKeyAndPushOption(context.Context, SelectKeyAndPushOptionArg) (SelectKeyRes, error)
    59  	SelectKey(context.Context, SelectKeyArg) (string, error)
    60  	Sign(context.Context, SignArg) (string, error)
    61  	GetTTY(context.Context) (string, error)
    62  }
    63  
    64  func GpgUiProtocol(i GpgUiInterface) rpc.Protocol {
    65  	return rpc.Protocol{
    66  		Name: "keybase.1.gpgUi",
    67  		Methods: map[string]rpc.ServeHandlerDescription{
    68  			"wantToAddGPGKey": {
    69  				MakeArg: func() interface{} {
    70  					var ret [1]WantToAddGPGKeyArg
    71  					return &ret
    72  				},
    73  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    74  					typedArgs, ok := args.(*[1]WantToAddGPGKeyArg)
    75  					if !ok {
    76  						err = rpc.NewTypeError((*[1]WantToAddGPGKeyArg)(nil), args)
    77  						return
    78  					}
    79  					ret, err = i.WantToAddGPGKey(ctx, typedArgs[0].SessionID)
    80  					return
    81  				},
    82  			},
    83  			"confirmDuplicateKeyChosen": {
    84  				MakeArg: func() interface{} {
    85  					var ret [1]ConfirmDuplicateKeyChosenArg
    86  					return &ret
    87  				},
    88  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    89  					typedArgs, ok := args.(*[1]ConfirmDuplicateKeyChosenArg)
    90  					if !ok {
    91  						err = rpc.NewTypeError((*[1]ConfirmDuplicateKeyChosenArg)(nil), args)
    92  						return
    93  					}
    94  					ret, err = i.ConfirmDuplicateKeyChosen(ctx, typedArgs[0].SessionID)
    95  					return
    96  				},
    97  			},
    98  			"confirmImportSecretToExistingKey": {
    99  				MakeArg: func() interface{} {
   100  					var ret [1]ConfirmImportSecretToExistingKeyArg
   101  					return &ret
   102  				},
   103  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   104  					typedArgs, ok := args.(*[1]ConfirmImportSecretToExistingKeyArg)
   105  					if !ok {
   106  						err = rpc.NewTypeError((*[1]ConfirmImportSecretToExistingKeyArg)(nil), args)
   107  						return
   108  					}
   109  					ret, err = i.ConfirmImportSecretToExistingKey(ctx, typedArgs[0].SessionID)
   110  					return
   111  				},
   112  			},
   113  			"selectKeyAndPushOption": {
   114  				MakeArg: func() interface{} {
   115  					var ret [1]SelectKeyAndPushOptionArg
   116  					return &ret
   117  				},
   118  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   119  					typedArgs, ok := args.(*[1]SelectKeyAndPushOptionArg)
   120  					if !ok {
   121  						err = rpc.NewTypeError((*[1]SelectKeyAndPushOptionArg)(nil), args)
   122  						return
   123  					}
   124  					ret, err = i.SelectKeyAndPushOption(ctx, typedArgs[0])
   125  					return
   126  				},
   127  			},
   128  			"selectKey": {
   129  				MakeArg: func() interface{} {
   130  					var ret [1]SelectKeyArg
   131  					return &ret
   132  				},
   133  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   134  					typedArgs, ok := args.(*[1]SelectKeyArg)
   135  					if !ok {
   136  						err = rpc.NewTypeError((*[1]SelectKeyArg)(nil), args)
   137  						return
   138  					}
   139  					ret, err = i.SelectKey(ctx, typedArgs[0])
   140  					return
   141  				},
   142  			},
   143  			"sign": {
   144  				MakeArg: func() interface{} {
   145  					var ret [1]SignArg
   146  					return &ret
   147  				},
   148  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   149  					typedArgs, ok := args.(*[1]SignArg)
   150  					if !ok {
   151  						err = rpc.NewTypeError((*[1]SignArg)(nil), args)
   152  						return
   153  					}
   154  					ret, err = i.Sign(ctx, typedArgs[0])
   155  					return
   156  				},
   157  			},
   158  			"getTTY": {
   159  				MakeArg: func() interface{} {
   160  					var ret [1]GetTTYArg
   161  					return &ret
   162  				},
   163  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   164  					ret, err = i.GetTTY(ctx)
   165  					return
   166  				},
   167  			},
   168  		},
   169  	}
   170  }
   171  
   172  type GpgUiClient struct {
   173  	Cli rpc.GenericClient
   174  }
   175  
   176  func (c GpgUiClient) WantToAddGPGKey(ctx context.Context, sessionID int) (res bool, err error) {
   177  	__arg := WantToAddGPGKeyArg{SessionID: sessionID}
   178  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.wantToAddGPGKey", []interface{}{__arg}, &res, 0*time.Millisecond)
   179  	return
   180  }
   181  
   182  func (c GpgUiClient) ConfirmDuplicateKeyChosen(ctx context.Context, sessionID int) (res bool, err error) {
   183  	__arg := ConfirmDuplicateKeyChosenArg{SessionID: sessionID}
   184  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.confirmDuplicateKeyChosen", []interface{}{__arg}, &res, 0*time.Millisecond)
   185  	return
   186  }
   187  
   188  func (c GpgUiClient) ConfirmImportSecretToExistingKey(ctx context.Context, sessionID int) (res bool, err error) {
   189  	__arg := ConfirmImportSecretToExistingKeyArg{SessionID: sessionID}
   190  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.confirmImportSecretToExistingKey", []interface{}{__arg}, &res, 0*time.Millisecond)
   191  	return
   192  }
   193  
   194  func (c GpgUiClient) SelectKeyAndPushOption(ctx context.Context, __arg SelectKeyAndPushOptionArg) (res SelectKeyRes, err error) {
   195  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.selectKeyAndPushOption", []interface{}{__arg}, &res, 0*time.Millisecond)
   196  	return
   197  }
   198  
   199  func (c GpgUiClient) SelectKey(ctx context.Context, __arg SelectKeyArg) (res string, err error) {
   200  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.selectKey", []interface{}{__arg}, &res, 0*time.Millisecond)
   201  	return
   202  }
   203  
   204  func (c GpgUiClient) Sign(ctx context.Context, __arg SignArg) (res string, err error) {
   205  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.sign", []interface{}{__arg}, &res, 0*time.Millisecond)
   206  	return
   207  }
   208  
   209  func (c GpgUiClient) GetTTY(ctx context.Context) (res string, err error) {
   210  	err = c.Cli.Call(ctx, "keybase.1.gpgUi.getTTY", []interface{}{GetTTYArg{}}, &res, 0*time.Millisecond)
   211  	return
   212  }