github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/wot.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/wot.avdl 3 4 package keybase1 5 6 import ( 7 "fmt" 8 "github.com/keybase/go-framed-msgpack-rpc/rpc" 9 context "golang.org/x/net/context" 10 "time" 11 ) 12 13 type UsernameVerificationType string 14 15 func (o UsernameVerificationType) DeepCopy() UsernameVerificationType { 16 return o 17 } 18 19 type WotProof struct { 20 ProofType ProofType `codec:"proofType" json:"proof_type"` 21 Name string `codec:"name" json:"name,omitempty"` 22 Username string `codec:"username" json:"username,omitempty"` 23 Protocol string `codec:"protocol" json:"protocol,omitempty"` 24 Hostname string `codec:"hostname" json:"hostname,omitempty"` 25 Domain string `codec:"domain" json:"domain,omitempty"` 26 } 27 28 func (o WotProof) DeepCopy() WotProof { 29 return WotProof{ 30 ProofType: o.ProofType.DeepCopy(), 31 Name: o.Name, 32 Username: o.Username, 33 Protocol: o.Protocol, 34 Hostname: o.Hostname, 35 Domain: o.Domain, 36 } 37 } 38 39 type WotProofUI struct { 40 Type string `codec:"type" json:"type"` 41 Value string `codec:"value" json:"value"` 42 SiteIcon []SizedImage `codec:"siteIcon" json:"siteIcon"` 43 SiteIconDarkmode []SizedImage `codec:"siteIconDarkmode" json:"siteIconDarkmode"` 44 } 45 46 func (o WotProofUI) DeepCopy() WotProofUI { 47 return WotProofUI{ 48 Type: o.Type, 49 Value: o.Value, 50 SiteIcon: (func(x []SizedImage) []SizedImage { 51 if x == nil { 52 return nil 53 } 54 ret := make([]SizedImage, len(x)) 55 for i, v := range x { 56 vCopy := v.DeepCopy() 57 ret[i] = vCopy 58 } 59 return ret 60 })(o.SiteIcon), 61 SiteIconDarkmode: (func(x []SizedImage) []SizedImage { 62 if x == nil { 63 return nil 64 } 65 ret := make([]SizedImage, len(x)) 66 for i, v := range x { 67 vCopy := v.DeepCopy() 68 ret[i] = vCopy 69 } 70 return ret 71 })(o.SiteIconDarkmode), 72 } 73 } 74 75 type Confidence struct { 76 UsernameVerifiedVia UsernameVerificationType `codec:"usernameVerifiedVia" json:"username_verified_via,omitempty"` 77 Proofs []WotProof `codec:"proofs" json:"proofs,omitempty"` 78 Other string `codec:"other" json:"other,omitempty"` 79 } 80 81 func (o Confidence) DeepCopy() Confidence { 82 return Confidence{ 83 UsernameVerifiedVia: o.UsernameVerifiedVia.DeepCopy(), 84 Proofs: (func(x []WotProof) []WotProof { 85 if x == nil { 86 return nil 87 } 88 ret := make([]WotProof, len(x)) 89 for i, v := range x { 90 vCopy := v.DeepCopy() 91 ret[i] = vCopy 92 } 93 return ret 94 })(o.Proofs), 95 Other: o.Other, 96 } 97 } 98 99 type WotReactionType int 100 101 const ( 102 WotReactionType_REJECT WotReactionType = 0 103 WotReactionType_ACCEPT WotReactionType = 1 104 ) 105 106 func (o WotReactionType) DeepCopy() WotReactionType { return o } 107 108 var WotReactionTypeMap = map[string]WotReactionType{ 109 "REJECT": 0, 110 "ACCEPT": 1, 111 } 112 113 var WotReactionTypeRevMap = map[WotReactionType]string{ 114 0: "REJECT", 115 1: "ACCEPT", 116 } 117 118 func (e WotReactionType) String() string { 119 if v, ok := WotReactionTypeRevMap[e]; ok { 120 return v 121 } 122 return fmt.Sprintf("%v", int(e)) 123 } 124 125 type WotVouch struct { 126 Status WotStatusType `codec:"status" json:"status"` 127 VouchProof SigID `codec:"vouchProof" json:"vouchProof"` 128 Vouchee UserVersion `codec:"vouchee" json:"vouchee"` 129 VoucheeUsername string `codec:"voucheeUsername" json:"voucheeUsername"` 130 Voucher UserVersion `codec:"voucher" json:"voucher"` 131 VoucherUsername string `codec:"voucherUsername" json:"voucherUsername"` 132 VouchText string `codec:"vouchText" json:"vouchText"` 133 VouchedAt Time `codec:"vouchedAt" json:"vouchedAt"` 134 Confidence Confidence `codec:"confidence" json:"confidence"` 135 Proofs []WotProofUI `codec:"proofs" json:"proofs"` 136 } 137 138 func (o WotVouch) DeepCopy() WotVouch { 139 return WotVouch{ 140 Status: o.Status.DeepCopy(), 141 VouchProof: o.VouchProof.DeepCopy(), 142 Vouchee: o.Vouchee.DeepCopy(), 143 VoucheeUsername: o.VoucheeUsername, 144 Voucher: o.Voucher.DeepCopy(), 145 VoucherUsername: o.VoucherUsername, 146 VouchText: o.VouchText, 147 VouchedAt: o.VouchedAt.DeepCopy(), 148 Confidence: o.Confidence.DeepCopy(), 149 Proofs: (func(x []WotProofUI) []WotProofUI { 150 if x == nil { 151 return nil 152 } 153 ret := make([]WotProofUI, len(x)) 154 for i, v := range x { 155 vCopy := v.DeepCopy() 156 ret[i] = vCopy 157 } 158 return ret 159 })(o.Proofs), 160 } 161 } 162 163 type WotVouchArg struct { 164 SessionID int `codec:"sessionID" json:"sessionID"` 165 Username string `codec:"username" json:"username"` 166 GuiID Identify3GUIID `codec:"guiID" json:"guiID"` 167 VouchText string `codec:"vouchText" json:"vouchText"` 168 Confidence Confidence `codec:"confidence" json:"confidence"` 169 } 170 171 type WotVouchCLIArg struct { 172 SessionID int `codec:"sessionID" json:"sessionID"` 173 Assertion string `codec:"assertion" json:"assertion"` 174 VouchText string `codec:"vouchText" json:"vouchText"` 175 Confidence Confidence `codec:"confidence" json:"confidence"` 176 } 177 178 type WotReactArg struct { 179 SessionID int `codec:"sessionID" json:"sessionID"` 180 Voucher string `codec:"voucher" json:"voucher"` 181 SigID SigID `codec:"sigID" json:"sigID"` 182 Reaction WotReactionType `codec:"reaction" json:"reaction"` 183 AllowEmptySigID bool `codec:"allowEmptySigID" json:"allowEmptySigID"` 184 } 185 186 type DismissWotNotificationsArg struct { 187 SessionID int `codec:"sessionID" json:"sessionID"` 188 Voucher string `codec:"voucher" json:"voucher"` 189 Vouchee string `codec:"vouchee" json:"vouchee"` 190 } 191 192 type WotFetchVouchesArg struct { 193 SessionID int `codec:"sessionID" json:"sessionID"` 194 Vouchee string `codec:"vouchee" json:"vouchee"` 195 Voucher string `codec:"voucher" json:"voucher"` 196 } 197 198 type WotInterface interface { 199 WotVouch(context.Context, WotVouchArg) error 200 WotVouchCLI(context.Context, WotVouchCLIArg) error 201 WotReact(context.Context, WotReactArg) error 202 DismissWotNotifications(context.Context, DismissWotNotificationsArg) error 203 WotFetchVouches(context.Context, WotFetchVouchesArg) ([]WotVouch, error) 204 } 205 206 func WotProtocol(i WotInterface) rpc.Protocol { 207 return rpc.Protocol{ 208 Name: "keybase.1.wot", 209 Methods: map[string]rpc.ServeHandlerDescription{ 210 "wotVouch": { 211 MakeArg: func() interface{} { 212 var ret [1]WotVouchArg 213 return &ret 214 }, 215 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 216 typedArgs, ok := args.(*[1]WotVouchArg) 217 if !ok { 218 err = rpc.NewTypeError((*[1]WotVouchArg)(nil), args) 219 return 220 } 221 err = i.WotVouch(ctx, typedArgs[0]) 222 return 223 }, 224 }, 225 "wotVouchCLI": { 226 MakeArg: func() interface{} { 227 var ret [1]WotVouchCLIArg 228 return &ret 229 }, 230 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 231 typedArgs, ok := args.(*[1]WotVouchCLIArg) 232 if !ok { 233 err = rpc.NewTypeError((*[1]WotVouchCLIArg)(nil), args) 234 return 235 } 236 err = i.WotVouchCLI(ctx, typedArgs[0]) 237 return 238 }, 239 }, 240 "wotReact": { 241 MakeArg: func() interface{} { 242 var ret [1]WotReactArg 243 return &ret 244 }, 245 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 246 typedArgs, ok := args.(*[1]WotReactArg) 247 if !ok { 248 err = rpc.NewTypeError((*[1]WotReactArg)(nil), args) 249 return 250 } 251 err = i.WotReact(ctx, typedArgs[0]) 252 return 253 }, 254 }, 255 "dismissWotNotifications": { 256 MakeArg: func() interface{} { 257 var ret [1]DismissWotNotificationsArg 258 return &ret 259 }, 260 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 261 typedArgs, ok := args.(*[1]DismissWotNotificationsArg) 262 if !ok { 263 err = rpc.NewTypeError((*[1]DismissWotNotificationsArg)(nil), args) 264 return 265 } 266 err = i.DismissWotNotifications(ctx, typedArgs[0]) 267 return 268 }, 269 }, 270 "wotFetchVouches": { 271 MakeArg: func() interface{} { 272 var ret [1]WotFetchVouchesArg 273 return &ret 274 }, 275 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 276 typedArgs, ok := args.(*[1]WotFetchVouchesArg) 277 if !ok { 278 err = rpc.NewTypeError((*[1]WotFetchVouchesArg)(nil), args) 279 return 280 } 281 ret, err = i.WotFetchVouches(ctx, typedArgs[0]) 282 return 283 }, 284 }, 285 }, 286 } 287 } 288 289 type WotClient struct { 290 Cli rpc.GenericClient 291 } 292 293 func (c WotClient) WotVouch(ctx context.Context, __arg WotVouchArg) (err error) { 294 err = c.Cli.Call(ctx, "keybase.1.wot.wotVouch", []interface{}{__arg}, nil, 0*time.Millisecond) 295 return 296 } 297 298 func (c WotClient) WotVouchCLI(ctx context.Context, __arg WotVouchCLIArg) (err error) { 299 err = c.Cli.Call(ctx, "keybase.1.wot.wotVouchCLI", []interface{}{__arg}, nil, 0*time.Millisecond) 300 return 301 } 302 303 func (c WotClient) WotReact(ctx context.Context, __arg WotReactArg) (err error) { 304 err = c.Cli.Call(ctx, "keybase.1.wot.wotReact", []interface{}{__arg}, nil, 0*time.Millisecond) 305 return 306 } 307 308 func (c WotClient) DismissWotNotifications(ctx context.Context, __arg DismissWotNotificationsArg) (err error) { 309 err = c.Cli.Call(ctx, "keybase.1.wot.dismissWotNotifications", []interface{}{__arg}, nil, 0*time.Millisecond) 310 return 311 } 312 313 func (c WotClient) WotFetchVouches(ctx context.Context, __arg WotFetchVouchesArg) (res []WotVouch, err error) { 314 err = c.Cli.Call(ctx, "keybase.1.wot.wotFetchVouches", []interface{}{__arg}, &res, 0*time.Millisecond) 315 return 316 }