forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kex2provisionee.go
137 lines (118 loc) · 3.36 KB
/
kex2provisionee.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Auto-generated by avdl-compiler v1.3.19 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/kex2provisionee.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
)
type PassphraseStream struct {
PassphraseStream []byte `codec:"passphraseStream" json:"passphraseStream"`
Generation int `codec:"generation" json:"generation"`
}
func (o PassphraseStream) DeepCopy() PassphraseStream {
return PassphraseStream{
PassphraseStream: (func(x []byte) []byte {
if x == nil {
return nil
}
return append([]byte(nil), x...)
})(o.PassphraseStream),
Generation: o.Generation,
}
}
type SessionToken string
func (o SessionToken) DeepCopy() SessionToken {
return o
}
type CsrfToken string
func (o CsrfToken) DeepCopy() CsrfToken {
return o
}
type HelloRes string
func (o HelloRes) DeepCopy() HelloRes {
return o
}
type HelloArg struct {
Uid UID `codec:"uid" json:"uid"`
Token SessionToken `codec:"token" json:"token"`
Csrf CsrfToken `codec:"csrf" json:"csrf"`
Pps PassphraseStream `codec:"pps" json:"pps"`
SigBody string `codec:"sigBody" json:"sigBody"`
}
func (o HelloArg) DeepCopy() HelloArg {
return HelloArg{
Uid: o.Uid.DeepCopy(),
Token: o.Token.DeepCopy(),
Csrf: o.Csrf.DeepCopy(),
Pps: o.Pps.DeepCopy(),
SigBody: o.SigBody,
}
}
type DidCounterSignArg struct {
Sig []byte `codec:"sig" json:"sig"`
}
func (o DidCounterSignArg) DeepCopy() DidCounterSignArg {
return DidCounterSignArg{
Sig: (func(x []byte) []byte {
if x == nil {
return nil
}
return append([]byte(nil), x...)
})(o.Sig),
}
}
type Kex2ProvisioneeInterface interface {
Hello(context.Context, HelloArg) (HelloRes, error)
DidCounterSign(context.Context, []byte) error
}
func Kex2ProvisioneeProtocol(i Kex2ProvisioneeInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.Kex2Provisionee",
Methods: map[string]rpc.ServeHandlerDescription{
"hello": {
MakeArg: func() interface{} {
ret := make([]HelloArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]HelloArg)
if !ok {
err = rpc.NewTypeError((*[]HelloArg)(nil), args)
return
}
ret, err = i.Hello(ctx, (*typedArgs)[0])
return
},
MethodType: rpc.MethodCall,
},
"didCounterSign": {
MakeArg: func() interface{} {
ret := make([]DidCounterSignArg, 1)
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[]DidCounterSignArg)
if !ok {
err = rpc.NewTypeError((*[]DidCounterSignArg)(nil), args)
return
}
err = i.DidCounterSign(ctx, (*typedArgs)[0].Sig)
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type Kex2ProvisioneeClient struct {
Cli rpc.GenericClient
}
func (c Kex2ProvisioneeClient) Hello(ctx context.Context, __arg HelloArg) (res HelloRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.Kex2Provisionee.hello", []interface{}{__arg}, &res)
return
}
func (c Kex2ProvisioneeClient) DidCounterSign(ctx context.Context, sig []byte) (err error) {
__arg := DidCounterSignArg{Sig: sig}
err = c.Cli.Call(ctx, "keybase.1.Kex2Provisionee.didCounterSign", []interface{}{__arg}, nil)
return
}