github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/identify.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/identify.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 IdentifyProofBreak struct { 13 RemoteProof RemoteProof `codec:"remoteProof" json:"remoteProof"` 14 Lcr LinkCheckResult `codec:"lcr" json:"lcr"` 15 } 16 17 func (o IdentifyProofBreak) DeepCopy() IdentifyProofBreak { 18 return IdentifyProofBreak{ 19 RemoteProof: o.RemoteProof.DeepCopy(), 20 Lcr: o.Lcr.DeepCopy(), 21 } 22 } 23 24 type IdentifyTrackBreaks struct { 25 Keys []IdentifyKey `codec:"keys" json:"keys"` 26 Proofs []IdentifyProofBreak `codec:"proofs" json:"proofs"` 27 } 28 29 func (o IdentifyTrackBreaks) DeepCopy() IdentifyTrackBreaks { 30 return IdentifyTrackBreaks{ 31 Keys: (func(x []IdentifyKey) []IdentifyKey { 32 if x == nil { 33 return nil 34 } 35 ret := make([]IdentifyKey, len(x)) 36 for i, v := range x { 37 vCopy := v.DeepCopy() 38 ret[i] = vCopy 39 } 40 return ret 41 })(o.Keys), 42 Proofs: (func(x []IdentifyProofBreak) []IdentifyProofBreak { 43 if x == nil { 44 return nil 45 } 46 ret := make([]IdentifyProofBreak, len(x)) 47 for i, v := range x { 48 vCopy := v.DeepCopy() 49 ret[i] = vCopy 50 } 51 return ret 52 })(o.Proofs), 53 } 54 } 55 56 type Identify2Res struct { 57 Upk UserPlusKeys `codec:"upk" json:"upk"` 58 IdentifiedAt Time `codec:"identifiedAt" json:"identifiedAt"` 59 TrackBreaks *IdentifyTrackBreaks `codec:"trackBreaks,omitempty" json:"trackBreaks,omitempty"` 60 } 61 62 func (o Identify2Res) DeepCopy() Identify2Res { 63 return Identify2Res{ 64 Upk: o.Upk.DeepCopy(), 65 IdentifiedAt: o.IdentifiedAt.DeepCopy(), 66 TrackBreaks: (func(x *IdentifyTrackBreaks) *IdentifyTrackBreaks { 67 if x == nil { 68 return nil 69 } 70 tmp := (*x).DeepCopy() 71 return &tmp 72 })(o.TrackBreaks), 73 } 74 } 75 76 type Identify2ResUPK2 struct { 77 Upk UserPlusKeysV2AllIncarnations `codec:"upk" json:"upk"` 78 IdentifiedAt Time `codec:"identifiedAt" json:"identifiedAt"` 79 TrackBreaks *IdentifyTrackBreaks `codec:"trackBreaks,omitempty" json:"trackBreaks,omitempty"` 80 } 81 82 func (o Identify2ResUPK2) DeepCopy() Identify2ResUPK2 { 83 return Identify2ResUPK2{ 84 Upk: o.Upk.DeepCopy(), 85 IdentifiedAt: o.IdentifiedAt.DeepCopy(), 86 TrackBreaks: (func(x *IdentifyTrackBreaks) *IdentifyTrackBreaks { 87 if x == nil { 88 return nil 89 } 90 tmp := (*x).DeepCopy() 91 return &tmp 92 })(o.TrackBreaks), 93 } 94 } 95 96 type IdentifyLiteRes struct { 97 Ul UserOrTeamLite `codec:"ul" json:"ul"` 98 TrackBreaks *IdentifyTrackBreaks `codec:"trackBreaks,omitempty" json:"trackBreaks,omitempty"` 99 } 100 101 func (o IdentifyLiteRes) DeepCopy() IdentifyLiteRes { 102 return IdentifyLiteRes{ 103 Ul: o.Ul.DeepCopy(), 104 TrackBreaks: (func(x *IdentifyTrackBreaks) *IdentifyTrackBreaks { 105 if x == nil { 106 return nil 107 } 108 tmp := (*x).DeepCopy() 109 return &tmp 110 })(o.TrackBreaks), 111 } 112 } 113 114 type ResolveIdentifyImplicitTeamRes struct { 115 DisplayName string `codec:"displayName" json:"displayName"` 116 TeamID TeamID `codec:"teamID" json:"teamID"` 117 Writers []UserVersion `codec:"writers" json:"writers"` 118 TrackBreaks map[UserVersion]IdentifyTrackBreaks `codec:"trackBreaks" json:"trackBreaks"` 119 FolderID TLFID `codec:"folderID" json:"folderID"` 120 } 121 122 func (o ResolveIdentifyImplicitTeamRes) DeepCopy() ResolveIdentifyImplicitTeamRes { 123 return ResolveIdentifyImplicitTeamRes{ 124 DisplayName: o.DisplayName, 125 TeamID: o.TeamID.DeepCopy(), 126 Writers: (func(x []UserVersion) []UserVersion { 127 if x == nil { 128 return nil 129 } 130 ret := make([]UserVersion, len(x)) 131 for i, v := range x { 132 vCopy := v.DeepCopy() 133 ret[i] = vCopy 134 } 135 return ret 136 })(o.Writers), 137 TrackBreaks: (func(x map[UserVersion]IdentifyTrackBreaks) map[UserVersion]IdentifyTrackBreaks { 138 if x == nil { 139 return nil 140 } 141 ret := make(map[UserVersion]IdentifyTrackBreaks, len(x)) 142 for k, v := range x { 143 kCopy := k.DeepCopy() 144 vCopy := v.DeepCopy() 145 ret[kCopy] = vCopy 146 } 147 return ret 148 })(o.TrackBreaks), 149 FolderID: o.FolderID.DeepCopy(), 150 } 151 } 152 153 type Resolve3Arg struct { 154 Assertion string `codec:"assertion" json:"assertion"` 155 Oa OfflineAvailability `codec:"oa" json:"oa"` 156 } 157 158 type Identify2Arg struct { 159 SessionID int `codec:"sessionID" json:"sessionID"` 160 Uid UID `codec:"uid" json:"uid"` 161 UserAssertion string `codec:"userAssertion" json:"userAssertion"` 162 Reason IdentifyReason `codec:"reason" json:"reason"` 163 UseDelegateUI bool `codec:"useDelegateUI" json:"useDelegateUI"` 164 AlwaysBlock bool `codec:"alwaysBlock" json:"alwaysBlock"` 165 NoErrorOnTrackFailure bool `codec:"noErrorOnTrackFailure" json:"noErrorOnTrackFailure"` 166 ForceRemoteCheck bool `codec:"forceRemoteCheck" json:"forceRemoteCheck"` 167 NeedProofSet bool `codec:"needProofSet" json:"needProofSet"` 168 AllowEmptySelfID bool `codec:"allowEmptySelfID" json:"allowEmptySelfID"` 169 NoSkipSelf bool `codec:"noSkipSelf" json:"noSkipSelf"` 170 CanSuppressUI bool `codec:"canSuppressUI" json:"canSuppressUI"` 171 IdentifyBehavior TLFIdentifyBehavior `codec:"identifyBehavior" json:"identifyBehavior"` 172 ForceDisplay bool `codec:"forceDisplay" json:"forceDisplay"` 173 ActLoggedOut bool `codec:"actLoggedOut" json:"actLoggedOut"` 174 } 175 176 type IdentifyLiteArg struct { 177 SessionID int `codec:"sessionID" json:"sessionID"` 178 Id UserOrTeamID `codec:"id" json:"id"` 179 Assertion string `codec:"assertion" json:"assertion"` 180 Reason IdentifyReason `codec:"reason" json:"reason"` 181 UseDelegateUI bool `codec:"useDelegateUI" json:"useDelegateUI"` 182 AlwaysBlock bool `codec:"alwaysBlock" json:"alwaysBlock"` 183 NoErrorOnTrackFailure bool `codec:"noErrorOnTrackFailure" json:"noErrorOnTrackFailure"` 184 ForceRemoteCheck bool `codec:"forceRemoteCheck" json:"forceRemoteCheck"` 185 NeedProofSet bool `codec:"needProofSet" json:"needProofSet"` 186 AllowEmptySelfID bool `codec:"allowEmptySelfID" json:"allowEmptySelfID"` 187 NoSkipSelf bool `codec:"noSkipSelf" json:"noSkipSelf"` 188 CanSuppressUI bool `codec:"canSuppressUI" json:"canSuppressUI"` 189 IdentifyBehavior TLFIdentifyBehavior `codec:"identifyBehavior" json:"identifyBehavior"` 190 ForceDisplay bool `codec:"forceDisplay" json:"forceDisplay"` 191 Oa OfflineAvailability `codec:"oa" json:"oa"` 192 } 193 194 type ResolveIdentifyImplicitTeamArg struct { 195 SessionID int `codec:"sessionID" json:"sessionID"` 196 Assertions string `codec:"assertions" json:"assertions"` 197 Suffix string `codec:"suffix" json:"suffix"` 198 IsPublic bool `codec:"isPublic" json:"isPublic"` 199 DoIdentifies bool `codec:"doIdentifies" json:"doIdentifies"` 200 Create bool `codec:"create" json:"create"` 201 Reason IdentifyReason `codec:"reason" json:"reason"` 202 IdentifyBehavior TLFIdentifyBehavior `codec:"identifyBehavior" json:"identifyBehavior"` 203 Oa OfflineAvailability `codec:"oa" json:"oa"` 204 } 205 206 type ResolveImplicitTeamArg struct { 207 SessionID int `codec:"sessionID" json:"sessionID"` 208 Id TeamID `codec:"id" json:"id"` 209 } 210 211 type NormalizeSocialAssertionArg struct { 212 Assertion string `codec:"assertion" json:"assertion"` 213 } 214 215 type IdentifyInterface interface { 216 // Resolve an assertion to a (UID,username) or (TeamID,teamname). On failure, returns an error. 217 Resolve3(context.Context, Resolve3Arg) (UserOrTeamLite, error) 218 Identify2(context.Context, Identify2Arg) (Identify2Res, error) 219 IdentifyLite(context.Context, IdentifyLiteArg) (IdentifyLiteRes, error) 220 ResolveIdentifyImplicitTeam(context.Context, ResolveIdentifyImplicitTeamArg) (ResolveIdentifyImplicitTeamRes, error) 221 // resolveImplicitTeam returns a TLF display name given a teamID. The publicness 222 // of the team is inferred from the TeamID. 223 ResolveImplicitTeam(context.Context, ResolveImplicitTeamArg) (Folder, error) 224 NormalizeSocialAssertion(context.Context, string) (SocialAssertion, error) 225 } 226 227 func IdentifyProtocol(i IdentifyInterface) rpc.Protocol { 228 return rpc.Protocol{ 229 Name: "keybase.1.identify", 230 Methods: map[string]rpc.ServeHandlerDescription{ 231 "Resolve3": { 232 MakeArg: func() interface{} { 233 var ret [1]Resolve3Arg 234 return &ret 235 }, 236 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 237 typedArgs, ok := args.(*[1]Resolve3Arg) 238 if !ok { 239 err = rpc.NewTypeError((*[1]Resolve3Arg)(nil), args) 240 return 241 } 242 ret, err = i.Resolve3(ctx, typedArgs[0]) 243 return 244 }, 245 }, 246 "identify2": { 247 MakeArg: func() interface{} { 248 var ret [1]Identify2Arg 249 return &ret 250 }, 251 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 252 typedArgs, ok := args.(*[1]Identify2Arg) 253 if !ok { 254 err = rpc.NewTypeError((*[1]Identify2Arg)(nil), args) 255 return 256 } 257 ret, err = i.Identify2(ctx, typedArgs[0]) 258 return 259 }, 260 }, 261 "identifyLite": { 262 MakeArg: func() interface{} { 263 var ret [1]IdentifyLiteArg 264 return &ret 265 }, 266 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 267 typedArgs, ok := args.(*[1]IdentifyLiteArg) 268 if !ok { 269 err = rpc.NewTypeError((*[1]IdentifyLiteArg)(nil), args) 270 return 271 } 272 ret, err = i.IdentifyLite(ctx, typedArgs[0]) 273 return 274 }, 275 }, 276 "resolveIdentifyImplicitTeam": { 277 MakeArg: func() interface{} { 278 var ret [1]ResolveIdentifyImplicitTeamArg 279 return &ret 280 }, 281 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 282 typedArgs, ok := args.(*[1]ResolveIdentifyImplicitTeamArg) 283 if !ok { 284 err = rpc.NewTypeError((*[1]ResolveIdentifyImplicitTeamArg)(nil), args) 285 return 286 } 287 ret, err = i.ResolveIdentifyImplicitTeam(ctx, typedArgs[0]) 288 return 289 }, 290 }, 291 "resolveImplicitTeam": { 292 MakeArg: func() interface{} { 293 var ret [1]ResolveImplicitTeamArg 294 return &ret 295 }, 296 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 297 typedArgs, ok := args.(*[1]ResolveImplicitTeamArg) 298 if !ok { 299 err = rpc.NewTypeError((*[1]ResolveImplicitTeamArg)(nil), args) 300 return 301 } 302 ret, err = i.ResolveImplicitTeam(ctx, typedArgs[0]) 303 return 304 }, 305 }, 306 "normalizeSocialAssertion": { 307 MakeArg: func() interface{} { 308 var ret [1]NormalizeSocialAssertionArg 309 return &ret 310 }, 311 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 312 typedArgs, ok := args.(*[1]NormalizeSocialAssertionArg) 313 if !ok { 314 err = rpc.NewTypeError((*[1]NormalizeSocialAssertionArg)(nil), args) 315 return 316 } 317 ret, err = i.NormalizeSocialAssertion(ctx, typedArgs[0].Assertion) 318 return 319 }, 320 }, 321 }, 322 } 323 } 324 325 type IdentifyClient struct { 326 Cli rpc.GenericClient 327 } 328 329 // Resolve an assertion to a (UID,username) or (TeamID,teamname). On failure, returns an error. 330 func (c IdentifyClient) Resolve3(ctx context.Context, __arg Resolve3Arg) (res UserOrTeamLite, err error) { 331 err = c.Cli.Call(ctx, "keybase.1.identify.Resolve3", []interface{}{__arg}, &res, 0*time.Millisecond) 332 return 333 } 334 335 func (c IdentifyClient) Identify2(ctx context.Context, __arg Identify2Arg) (res Identify2Res, err error) { 336 err = c.Cli.Call(ctx, "keybase.1.identify.identify2", []interface{}{__arg}, &res, 0*time.Millisecond) 337 return 338 } 339 340 func (c IdentifyClient) IdentifyLite(ctx context.Context, __arg IdentifyLiteArg) (res IdentifyLiteRes, err error) { 341 err = c.Cli.Call(ctx, "keybase.1.identify.identifyLite", []interface{}{__arg}, &res, 0*time.Millisecond) 342 return 343 } 344 345 func (c IdentifyClient) ResolveIdentifyImplicitTeam(ctx context.Context, __arg ResolveIdentifyImplicitTeamArg) (res ResolveIdentifyImplicitTeamRes, err error) { 346 err = c.Cli.Call(ctx, "keybase.1.identify.resolveIdentifyImplicitTeam", []interface{}{__arg}, &res, 0*time.Millisecond) 347 return 348 } 349 350 // resolveImplicitTeam returns a TLF display name given a teamID. The publicness 351 // of the team is inferred from the TeamID. 352 func (c IdentifyClient) ResolveImplicitTeam(ctx context.Context, __arg ResolveImplicitTeamArg) (res Folder, err error) { 353 err = c.Cli.Call(ctx, "keybase.1.identify.resolveImplicitTeam", []interface{}{__arg}, &res, 0*time.Millisecond) 354 return 355 } 356 357 func (c IdentifyClient) NormalizeSocialAssertion(ctx context.Context, assertion string) (res SocialAssertion, err error) { 358 __arg := NormalizeSocialAssertionArg{Assertion: assertion} 359 err = c.Cli.Call(ctx, "keybase.1.identify.normalizeSocialAssertion", []interface{}{__arg}, &res, 0*time.Millisecond) 360 return 361 }