github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/pgp_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/pgp_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 OutputPGPWarningArg struct {
    13  	SessionID int    `codec:"sessionID" json:"sessionID"`
    14  	Warning   string `codec:"warning" json:"warning"`
    15  }
    16  
    17  type OutputSignatureSuccessArg struct {
    18  	SessionID   int      `codec:"sessionID" json:"sessionID"`
    19  	Fingerprint string   `codec:"fingerprint" json:"fingerprint"`
    20  	Username    string   `codec:"username" json:"username"`
    21  	SignedAt    Time     `codec:"signedAt" json:"signedAt"`
    22  	Warnings    []string `codec:"warnings" json:"warnings"`
    23  }
    24  
    25  type OutputSignatureNonKeybaseArg struct {
    26  	SessionID int      `codec:"sessionID" json:"sessionID"`
    27  	KeyID     string   `codec:"keyID" json:"keyID"`
    28  	SignedAt  Time     `codec:"signedAt" json:"signedAt"`
    29  	Warnings  []string `codec:"warnings" json:"warnings"`
    30  }
    31  
    32  type KeyGeneratedArg struct {
    33  	SessionID int     `codec:"sessionID" json:"sessionID"`
    34  	Kid       KID     `codec:"kid" json:"kid"`
    35  	Key       KeyInfo `codec:"key" json:"key"`
    36  }
    37  
    38  type ShouldPushPrivateArg struct {
    39  	SessionID int  `codec:"sessionID" json:"sessionID"`
    40  	Prompt    bool `codec:"prompt" json:"prompt"`
    41  }
    42  
    43  type FinishedArg struct {
    44  	SessionID int `codec:"sessionID" json:"sessionID"`
    45  }
    46  
    47  type PGPUiInterface interface {
    48  	OutputPGPWarning(context.Context, OutputPGPWarningArg) error
    49  	OutputSignatureSuccess(context.Context, OutputSignatureSuccessArg) error
    50  	OutputSignatureNonKeybase(context.Context, OutputSignatureNonKeybaseArg) error
    51  	KeyGenerated(context.Context, KeyGeneratedArg) error
    52  	ShouldPushPrivate(context.Context, ShouldPushPrivateArg) (bool, error)
    53  	Finished(context.Context, int) error
    54  }
    55  
    56  func PGPUiProtocol(i PGPUiInterface) rpc.Protocol {
    57  	return rpc.Protocol{
    58  		Name: "keybase.1.pgpUi",
    59  		Methods: map[string]rpc.ServeHandlerDescription{
    60  			"outputPGPWarning": {
    61  				MakeArg: func() interface{} {
    62  					var ret [1]OutputPGPWarningArg
    63  					return &ret
    64  				},
    65  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    66  					typedArgs, ok := args.(*[1]OutputPGPWarningArg)
    67  					if !ok {
    68  						err = rpc.NewTypeError((*[1]OutputPGPWarningArg)(nil), args)
    69  						return
    70  					}
    71  					err = i.OutputPGPWarning(ctx, typedArgs[0])
    72  					return
    73  				},
    74  			},
    75  			"outputSignatureSuccess": {
    76  				MakeArg: func() interface{} {
    77  					var ret [1]OutputSignatureSuccessArg
    78  					return &ret
    79  				},
    80  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    81  					typedArgs, ok := args.(*[1]OutputSignatureSuccessArg)
    82  					if !ok {
    83  						err = rpc.NewTypeError((*[1]OutputSignatureSuccessArg)(nil), args)
    84  						return
    85  					}
    86  					err = i.OutputSignatureSuccess(ctx, typedArgs[0])
    87  					return
    88  				},
    89  			},
    90  			"outputSignatureNonKeybase": {
    91  				MakeArg: func() interface{} {
    92  					var ret [1]OutputSignatureNonKeybaseArg
    93  					return &ret
    94  				},
    95  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    96  					typedArgs, ok := args.(*[1]OutputSignatureNonKeybaseArg)
    97  					if !ok {
    98  						err = rpc.NewTypeError((*[1]OutputSignatureNonKeybaseArg)(nil), args)
    99  						return
   100  					}
   101  					err = i.OutputSignatureNonKeybase(ctx, typedArgs[0])
   102  					return
   103  				},
   104  			},
   105  			"keyGenerated": {
   106  				MakeArg: func() interface{} {
   107  					var ret [1]KeyGeneratedArg
   108  					return &ret
   109  				},
   110  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   111  					typedArgs, ok := args.(*[1]KeyGeneratedArg)
   112  					if !ok {
   113  						err = rpc.NewTypeError((*[1]KeyGeneratedArg)(nil), args)
   114  						return
   115  					}
   116  					err = i.KeyGenerated(ctx, typedArgs[0])
   117  					return
   118  				},
   119  			},
   120  			"shouldPushPrivate": {
   121  				MakeArg: func() interface{} {
   122  					var ret [1]ShouldPushPrivateArg
   123  					return &ret
   124  				},
   125  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   126  					typedArgs, ok := args.(*[1]ShouldPushPrivateArg)
   127  					if !ok {
   128  						err = rpc.NewTypeError((*[1]ShouldPushPrivateArg)(nil), args)
   129  						return
   130  					}
   131  					ret, err = i.ShouldPushPrivate(ctx, typedArgs[0])
   132  					return
   133  				},
   134  			},
   135  			"finished": {
   136  				MakeArg: func() interface{} {
   137  					var ret [1]FinishedArg
   138  					return &ret
   139  				},
   140  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   141  					typedArgs, ok := args.(*[1]FinishedArg)
   142  					if !ok {
   143  						err = rpc.NewTypeError((*[1]FinishedArg)(nil), args)
   144  						return
   145  					}
   146  					err = i.Finished(ctx, typedArgs[0].SessionID)
   147  					return
   148  				},
   149  			},
   150  		},
   151  	}
   152  }
   153  
   154  type PGPUiClient struct {
   155  	Cli rpc.GenericClient
   156  }
   157  
   158  func (c PGPUiClient) OutputPGPWarning(ctx context.Context, __arg OutputPGPWarningArg) (err error) {
   159  	err = c.Cli.Call(ctx, "keybase.1.pgpUi.outputPGPWarning", []interface{}{__arg}, nil, 0*time.Millisecond)
   160  	return
   161  }
   162  
   163  func (c PGPUiClient) OutputSignatureSuccess(ctx context.Context, __arg OutputSignatureSuccessArg) (err error) {
   164  	err = c.Cli.Call(ctx, "keybase.1.pgpUi.outputSignatureSuccess", []interface{}{__arg}, nil, 0*time.Millisecond)
   165  	return
   166  }
   167  
   168  func (c PGPUiClient) OutputSignatureNonKeybase(ctx context.Context, __arg OutputSignatureNonKeybaseArg) (err error) {
   169  	err = c.Cli.Call(ctx, "keybase.1.pgpUi.outputSignatureNonKeybase", []interface{}{__arg}, nil, 0*time.Millisecond)
   170  	return
   171  }
   172  
   173  func (c PGPUiClient) KeyGenerated(ctx context.Context, __arg KeyGeneratedArg) (err error) {
   174  	err = c.Cli.Call(ctx, "keybase.1.pgpUi.keyGenerated", []interface{}{__arg}, nil, 0*time.Millisecond)
   175  	return
   176  }
   177  
   178  func (c PGPUiClient) ShouldPushPrivate(ctx context.Context, __arg ShouldPushPrivateArg) (res bool, err error) {
   179  	err = c.Cli.Call(ctx, "keybase.1.pgpUi.shouldPushPrivate", []interface{}{__arg}, &res, 0*time.Millisecond)
   180  	return
   181  }
   182  
   183  func (c PGPUiClient) Finished(ctx context.Context, sessionID int) (err error) {
   184  	__arg := FinishedArg{SessionID: sessionID}
   185  	err = c.Cli.Call(ctx, "keybase.1.pgpUi.finished", []interface{}{__arg}, nil, 0*time.Millisecond)
   186  	return
   187  }