-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
identify.go
361 lines (332 loc) · 13.1 KB
/
identify.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
// Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/identify.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
"time"
)
type IdentifyProofBreak struct {
RemoteProof RemoteProof `codec:"remoteProof" json:"remoteProof"`
Lcr LinkCheckResult `codec:"lcr" json:"lcr"`
}
func (o IdentifyProofBreak) DeepCopy() IdentifyProofBreak {
return IdentifyProofBreak{
RemoteProof: o.RemoteProof.DeepCopy(),
Lcr: o.Lcr.DeepCopy(),
}
}
type IdentifyTrackBreaks struct {
Keys []IdentifyKey `codec:"keys" json:"keys"`
Proofs []IdentifyProofBreak `codec:"proofs" json:"proofs"`
}
func (o IdentifyTrackBreaks) DeepCopy() IdentifyTrackBreaks {
return IdentifyTrackBreaks{
Keys: (func(x []IdentifyKey) []IdentifyKey {
if x == nil {
return nil
}
ret := make([]IdentifyKey, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Keys),
Proofs: (func(x []IdentifyProofBreak) []IdentifyProofBreak {
if x == nil {
return nil
}
ret := make([]IdentifyProofBreak, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Proofs),
}
}
type Identify2Res struct {
Upk UserPlusKeys `codec:"upk" json:"upk"`
IdentifiedAt Time `codec:"identifiedAt" json:"identifiedAt"`
TrackBreaks *IdentifyTrackBreaks `codec:"trackBreaks,omitempty" json:"trackBreaks,omitempty"`
}
func (o Identify2Res) DeepCopy() Identify2Res {
return Identify2Res{
Upk: o.Upk.DeepCopy(),
IdentifiedAt: o.IdentifiedAt.DeepCopy(),
TrackBreaks: (func(x *IdentifyTrackBreaks) *IdentifyTrackBreaks {
if x == nil {
return nil
}
tmp := (*x).DeepCopy()
return &tmp
})(o.TrackBreaks),
}
}
type Identify2ResUPK2 struct {
Upk UserPlusKeysV2AllIncarnations `codec:"upk" json:"upk"`
IdentifiedAt Time `codec:"identifiedAt" json:"identifiedAt"`
TrackBreaks *IdentifyTrackBreaks `codec:"trackBreaks,omitempty" json:"trackBreaks,omitempty"`
}
func (o Identify2ResUPK2) DeepCopy() Identify2ResUPK2 {
return Identify2ResUPK2{
Upk: o.Upk.DeepCopy(),
IdentifiedAt: o.IdentifiedAt.DeepCopy(),
TrackBreaks: (func(x *IdentifyTrackBreaks) *IdentifyTrackBreaks {
if x == nil {
return nil
}
tmp := (*x).DeepCopy()
return &tmp
})(o.TrackBreaks),
}
}
type IdentifyLiteRes struct {
Ul UserOrTeamLite `codec:"ul" json:"ul"`
TrackBreaks *IdentifyTrackBreaks `codec:"trackBreaks,omitempty" json:"trackBreaks,omitempty"`
}
func (o IdentifyLiteRes) DeepCopy() IdentifyLiteRes {
return IdentifyLiteRes{
Ul: o.Ul.DeepCopy(),
TrackBreaks: (func(x *IdentifyTrackBreaks) *IdentifyTrackBreaks {
if x == nil {
return nil
}
tmp := (*x).DeepCopy()
return &tmp
})(o.TrackBreaks),
}
}
type ResolveIdentifyImplicitTeamRes struct {
DisplayName string `codec:"displayName" json:"displayName"`
TeamID TeamID `codec:"teamID" json:"teamID"`
Writers []UserVersion `codec:"writers" json:"writers"`
TrackBreaks map[UserVersion]IdentifyTrackBreaks `codec:"trackBreaks" json:"trackBreaks"`
FolderID TLFID `codec:"folderID" json:"folderID"`
}
func (o ResolveIdentifyImplicitTeamRes) DeepCopy() ResolveIdentifyImplicitTeamRes {
return ResolveIdentifyImplicitTeamRes{
DisplayName: o.DisplayName,
TeamID: o.TeamID.DeepCopy(),
Writers: (func(x []UserVersion) []UserVersion {
if x == nil {
return nil
}
ret := make([]UserVersion, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Writers),
TrackBreaks: (func(x map[UserVersion]IdentifyTrackBreaks) map[UserVersion]IdentifyTrackBreaks {
if x == nil {
return nil
}
ret := make(map[UserVersion]IdentifyTrackBreaks, len(x))
for k, v := range x {
kCopy := k.DeepCopy()
vCopy := v.DeepCopy()
ret[kCopy] = vCopy
}
return ret
})(o.TrackBreaks),
FolderID: o.FolderID.DeepCopy(),
}
}
type Resolve3Arg struct {
Assertion string `codec:"assertion" json:"assertion"`
Oa OfflineAvailability `codec:"oa" json:"oa"`
}
type Identify2Arg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Uid UID `codec:"uid" json:"uid"`
UserAssertion string `codec:"userAssertion" json:"userAssertion"`
Reason IdentifyReason `codec:"reason" json:"reason"`
UseDelegateUI bool `codec:"useDelegateUI" json:"useDelegateUI"`
AlwaysBlock bool `codec:"alwaysBlock" json:"alwaysBlock"`
NoErrorOnTrackFailure bool `codec:"noErrorOnTrackFailure" json:"noErrorOnTrackFailure"`
ForceRemoteCheck bool `codec:"forceRemoteCheck" json:"forceRemoteCheck"`
NeedProofSet bool `codec:"needProofSet" json:"needProofSet"`
AllowEmptySelfID bool `codec:"allowEmptySelfID" json:"allowEmptySelfID"`
NoSkipSelf bool `codec:"noSkipSelf" json:"noSkipSelf"`
CanSuppressUI bool `codec:"canSuppressUI" json:"canSuppressUI"`
IdentifyBehavior TLFIdentifyBehavior `codec:"identifyBehavior" json:"identifyBehavior"`
ForceDisplay bool `codec:"forceDisplay" json:"forceDisplay"`
ActLoggedOut bool `codec:"actLoggedOut" json:"actLoggedOut"`
}
type IdentifyLiteArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Id UserOrTeamID `codec:"id" json:"id"`
Assertion string `codec:"assertion" json:"assertion"`
Reason IdentifyReason `codec:"reason" json:"reason"`
UseDelegateUI bool `codec:"useDelegateUI" json:"useDelegateUI"`
AlwaysBlock bool `codec:"alwaysBlock" json:"alwaysBlock"`
NoErrorOnTrackFailure bool `codec:"noErrorOnTrackFailure" json:"noErrorOnTrackFailure"`
ForceRemoteCheck bool `codec:"forceRemoteCheck" json:"forceRemoteCheck"`
NeedProofSet bool `codec:"needProofSet" json:"needProofSet"`
AllowEmptySelfID bool `codec:"allowEmptySelfID" json:"allowEmptySelfID"`
NoSkipSelf bool `codec:"noSkipSelf" json:"noSkipSelf"`
CanSuppressUI bool `codec:"canSuppressUI" json:"canSuppressUI"`
IdentifyBehavior TLFIdentifyBehavior `codec:"identifyBehavior" json:"identifyBehavior"`
ForceDisplay bool `codec:"forceDisplay" json:"forceDisplay"`
Oa OfflineAvailability `codec:"oa" json:"oa"`
}
type ResolveIdentifyImplicitTeamArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Assertions string `codec:"assertions" json:"assertions"`
Suffix string `codec:"suffix" json:"suffix"`
IsPublic bool `codec:"isPublic" json:"isPublic"`
DoIdentifies bool `codec:"doIdentifies" json:"doIdentifies"`
Create bool `codec:"create" json:"create"`
Reason IdentifyReason `codec:"reason" json:"reason"`
IdentifyBehavior TLFIdentifyBehavior `codec:"identifyBehavior" json:"identifyBehavior"`
Oa OfflineAvailability `codec:"oa" json:"oa"`
}
type ResolveImplicitTeamArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
Id TeamID `codec:"id" json:"id"`
}
type NormalizeSocialAssertionArg struct {
Assertion string `codec:"assertion" json:"assertion"`
}
type IdentifyInterface interface {
// Resolve an assertion to a (UID,username) or (TeamID,teamname). On failure, returns an error.
Resolve3(context.Context, Resolve3Arg) (UserOrTeamLite, error)
Identify2(context.Context, Identify2Arg) (Identify2Res, error)
IdentifyLite(context.Context, IdentifyLiteArg) (IdentifyLiteRes, error)
ResolveIdentifyImplicitTeam(context.Context, ResolveIdentifyImplicitTeamArg) (ResolveIdentifyImplicitTeamRes, error)
// resolveImplicitTeam returns a TLF display name given a teamID. The publicness
// of the team is inferred from the TeamID.
ResolveImplicitTeam(context.Context, ResolveImplicitTeamArg) (Folder, error)
NormalizeSocialAssertion(context.Context, string) (SocialAssertion, error)
}
func IdentifyProtocol(i IdentifyInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.identify",
Methods: map[string]rpc.ServeHandlerDescription{
"Resolve3": {
MakeArg: func() interface{} {
var ret [1]Resolve3Arg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]Resolve3Arg)
if !ok {
err = rpc.NewTypeError((*[1]Resolve3Arg)(nil), args)
return
}
ret, err = i.Resolve3(ctx, typedArgs[0])
return
},
},
"identify2": {
MakeArg: func() interface{} {
var ret [1]Identify2Arg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]Identify2Arg)
if !ok {
err = rpc.NewTypeError((*[1]Identify2Arg)(nil), args)
return
}
ret, err = i.Identify2(ctx, typedArgs[0])
return
},
},
"identifyLite": {
MakeArg: func() interface{} {
var ret [1]IdentifyLiteArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]IdentifyLiteArg)
if !ok {
err = rpc.NewTypeError((*[1]IdentifyLiteArg)(nil), args)
return
}
ret, err = i.IdentifyLite(ctx, typedArgs[0])
return
},
},
"resolveIdentifyImplicitTeam": {
MakeArg: func() interface{} {
var ret [1]ResolveIdentifyImplicitTeamArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]ResolveIdentifyImplicitTeamArg)
if !ok {
err = rpc.NewTypeError((*[1]ResolveIdentifyImplicitTeamArg)(nil), args)
return
}
ret, err = i.ResolveIdentifyImplicitTeam(ctx, typedArgs[0])
return
},
},
"resolveImplicitTeam": {
MakeArg: func() interface{} {
var ret [1]ResolveImplicitTeamArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]ResolveImplicitTeamArg)
if !ok {
err = rpc.NewTypeError((*[1]ResolveImplicitTeamArg)(nil), args)
return
}
ret, err = i.ResolveImplicitTeam(ctx, typedArgs[0])
return
},
},
"normalizeSocialAssertion": {
MakeArg: func() interface{} {
var ret [1]NormalizeSocialAssertionArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]NormalizeSocialAssertionArg)
if !ok {
err = rpc.NewTypeError((*[1]NormalizeSocialAssertionArg)(nil), args)
return
}
ret, err = i.NormalizeSocialAssertion(ctx, typedArgs[0].Assertion)
return
},
},
},
}
}
type IdentifyClient struct {
Cli rpc.GenericClient
}
// Resolve an assertion to a (UID,username) or (TeamID,teamname). On failure, returns an error.
func (c IdentifyClient) Resolve3(ctx context.Context, __arg Resolve3Arg) (res UserOrTeamLite, err error) {
err = c.Cli.Call(ctx, "keybase.1.identify.Resolve3", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c IdentifyClient) Identify2(ctx context.Context, __arg Identify2Arg) (res Identify2Res, err error) {
err = c.Cli.Call(ctx, "keybase.1.identify.identify2", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c IdentifyClient) IdentifyLite(ctx context.Context, __arg IdentifyLiteArg) (res IdentifyLiteRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.identify.identifyLite", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c IdentifyClient) ResolveIdentifyImplicitTeam(ctx context.Context, __arg ResolveIdentifyImplicitTeamArg) (res ResolveIdentifyImplicitTeamRes, err error) {
err = c.Cli.Call(ctx, "keybase.1.identify.resolveIdentifyImplicitTeam", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
// resolveImplicitTeam returns a TLF display name given a teamID. The publicness
// of the team is inferred from the TeamID.
func (c IdentifyClient) ResolveImplicitTeam(ctx context.Context, __arg ResolveImplicitTeamArg) (res Folder, err error) {
err = c.Cli.Call(ctx, "keybase.1.identify.resolveImplicitTeam", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}
func (c IdentifyClient) NormalizeSocialAssertion(ctx context.Context, assertion string) (res SocialAssertion, err error) {
__arg := NormalizeSocialAssertionArg{Assertion: assertion}
err = c.Cli.Call(ctx, "keybase.1.identify.normalizeSocialAssertion", []interface{}{__arg}, &res, 0*time.Millisecond)
return
}