github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/kex2provisionee.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/kex2provisionee.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 PassphraseStream struct {
    13  	PassphraseStream []byte `codec:"passphraseStream" json:"passphraseStream"`
    14  	Generation       int    `codec:"generation" json:"generation"`
    15  }
    16  
    17  func (o PassphraseStream) DeepCopy() PassphraseStream {
    18  	return PassphraseStream{
    19  		PassphraseStream: (func(x []byte) []byte {
    20  			if x == nil {
    21  				return nil
    22  			}
    23  			return append([]byte{}, x...)
    24  		})(o.PassphraseStream),
    25  		Generation: o.Generation,
    26  	}
    27  }
    28  
    29  type SessionToken string
    30  
    31  func (o SessionToken) DeepCopy() SessionToken {
    32  	return o
    33  }
    34  
    35  type CsrfToken string
    36  
    37  func (o CsrfToken) DeepCopy() CsrfToken {
    38  	return o
    39  }
    40  
    41  type HelloRes string
    42  
    43  func (o HelloRes) DeepCopy() HelloRes {
    44  	return o
    45  }
    46  
    47  type HelloArg struct {
    48  	Uid     UID              `codec:"uid" json:"uid"`
    49  	Token   SessionToken     `codec:"token" json:"token"`
    50  	Csrf    CsrfToken        `codec:"csrf" json:"csrf"`
    51  	Pps     PassphraseStream `codec:"pps" json:"pps"`
    52  	SigBody string           `codec:"sigBody" json:"sigBody"`
    53  }
    54  
    55  type DidCounterSignArg struct {
    56  	Sig []byte `codec:"sig" json:"sig"`
    57  }
    58  
    59  type Kex2ProvisioneeInterface interface {
    60  	Hello(context.Context, HelloArg) (HelloRes, error)
    61  	DidCounterSign(context.Context, []byte) error
    62  }
    63  
    64  func Kex2ProvisioneeProtocol(i Kex2ProvisioneeInterface) rpc.Protocol {
    65  	return rpc.Protocol{
    66  		Name: "keybase.1.Kex2Provisionee",
    67  		Methods: map[string]rpc.ServeHandlerDescription{
    68  			"hello": {
    69  				MakeArg: func() interface{} {
    70  					var ret [1]HelloArg
    71  					return &ret
    72  				},
    73  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    74  					typedArgs, ok := args.(*[1]HelloArg)
    75  					if !ok {
    76  						err = rpc.NewTypeError((*[1]HelloArg)(nil), args)
    77  						return
    78  					}
    79  					ret, err = i.Hello(ctx, typedArgs[0])
    80  					return
    81  				},
    82  			},
    83  			"didCounterSign": {
    84  				MakeArg: func() interface{} {
    85  					var ret [1]DidCounterSignArg
    86  					return &ret
    87  				},
    88  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    89  					typedArgs, ok := args.(*[1]DidCounterSignArg)
    90  					if !ok {
    91  						err = rpc.NewTypeError((*[1]DidCounterSignArg)(nil), args)
    92  						return
    93  					}
    94  					err = i.DidCounterSign(ctx, typedArgs[0].Sig)
    95  					return
    96  				},
    97  			},
    98  		},
    99  	}
   100  }
   101  
   102  type Kex2ProvisioneeClient struct {
   103  	Cli rpc.GenericClient
   104  }
   105  
   106  func (c Kex2ProvisioneeClient) Hello(ctx context.Context, __arg HelloArg) (res HelloRes, err error) {
   107  	err = c.Cli.Call(ctx, "keybase.1.Kex2Provisionee.hello", []interface{}{__arg}, &res, 0*time.Millisecond)
   108  	return
   109  }
   110  
   111  func (c Kex2ProvisioneeClient) DidCounterSign(ctx context.Context, sig []byte) (err error) {
   112  	__arg := DidCounterSignArg{Sig: sig}
   113  	err = c.Cli.Call(ctx, "keybase.1.Kex2Provisionee.didCounterSign", []interface{}{__arg}, nil, 0*time.Millisecond)
   114  	return
   115  }