github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/protocol/keybase1/prove.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/prove.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 CheckProofStatus struct { 13 Found bool `codec:"found" json:"found"` 14 Status ProofStatus `codec:"status" json:"status"` 15 ProofText string `codec:"proofText" json:"proofText"` 16 State ProofState `codec:"state" json:"state"` 17 } 18 19 func (o CheckProofStatus) DeepCopy() CheckProofStatus { 20 return CheckProofStatus{ 21 Found: o.Found, 22 Status: o.Status.DeepCopy(), 23 ProofText: o.ProofText, 24 State: o.State.DeepCopy(), 25 } 26 } 27 28 type StartProofResult struct { 29 SigID SigID `codec:"sigID" json:"sigID"` 30 } 31 32 func (o StartProofResult) DeepCopy() StartProofResult { 33 return StartProofResult{ 34 SigID: o.SigID.DeepCopy(), 35 } 36 } 37 38 type StartProofArg struct { 39 SessionID int `codec:"sessionID" json:"sessionID"` 40 Service string `codec:"service" json:"service"` 41 Username string `codec:"username" json:"username"` 42 Force bool `codec:"force" json:"force"` 43 PromptPosted bool `codec:"promptPosted" json:"promptPosted"` 44 Auto bool `codec:"auto" json:"auto"` 45 SigVersion *SigVersion `codec:"sigVersion,omitempty" json:"sigVersion,omitempty"` 46 } 47 48 type CheckProofArg struct { 49 SessionID int `codec:"sessionID" json:"sessionID"` 50 SigID SigID `codec:"sigID" json:"sigID"` 51 } 52 53 type ListSomeProofServicesArg struct { 54 } 55 56 type ListProofServicesArg struct { 57 } 58 59 type ValidateUsernameArg struct { 60 SessionID int `codec:"sessionID" json:"sessionID"` 61 Service string `codec:"service" json:"service"` 62 Remotename string `codec:"remotename" json:"remotename"` 63 } 64 65 type ProveInterface interface { 66 StartProof(context.Context, StartProofArg) (StartProofResult, error) 67 CheckProof(context.Context, CheckProofArg) (CheckProofStatus, error) 68 ListSomeProofServices(context.Context) ([]string, error) 69 ListProofServices(context.Context) ([]string, error) 70 ValidateUsername(context.Context, ValidateUsernameArg) error 71 } 72 73 func ProveProtocol(i ProveInterface) rpc.Protocol { 74 return rpc.Protocol{ 75 Name: "keybase.1.prove", 76 Methods: map[string]rpc.ServeHandlerDescription{ 77 "startProof": { 78 MakeArg: func() interface{} { 79 var ret [1]StartProofArg 80 return &ret 81 }, 82 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 83 typedArgs, ok := args.(*[1]StartProofArg) 84 if !ok { 85 err = rpc.NewTypeError((*[1]StartProofArg)(nil), args) 86 return 87 } 88 ret, err = i.StartProof(ctx, typedArgs[0]) 89 return 90 }, 91 }, 92 "checkProof": { 93 MakeArg: func() interface{} { 94 var ret [1]CheckProofArg 95 return &ret 96 }, 97 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 98 typedArgs, ok := args.(*[1]CheckProofArg) 99 if !ok { 100 err = rpc.NewTypeError((*[1]CheckProofArg)(nil), args) 101 return 102 } 103 ret, err = i.CheckProof(ctx, typedArgs[0]) 104 return 105 }, 106 }, 107 "listSomeProofServices": { 108 MakeArg: func() interface{} { 109 var ret [1]ListSomeProofServicesArg 110 return &ret 111 }, 112 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 113 ret, err = i.ListSomeProofServices(ctx) 114 return 115 }, 116 }, 117 "listProofServices": { 118 MakeArg: func() interface{} { 119 var ret [1]ListProofServicesArg 120 return &ret 121 }, 122 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 123 ret, err = i.ListProofServices(ctx) 124 return 125 }, 126 }, 127 "validateUsername": { 128 MakeArg: func() interface{} { 129 var ret [1]ValidateUsernameArg 130 return &ret 131 }, 132 Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) { 133 typedArgs, ok := args.(*[1]ValidateUsernameArg) 134 if !ok { 135 err = rpc.NewTypeError((*[1]ValidateUsernameArg)(nil), args) 136 return 137 } 138 err = i.ValidateUsername(ctx, typedArgs[0]) 139 return 140 }, 141 }, 142 }, 143 } 144 } 145 146 type ProveClient struct { 147 Cli rpc.GenericClient 148 } 149 150 func (c ProveClient) StartProof(ctx context.Context, __arg StartProofArg) (res StartProofResult, err error) { 151 err = c.Cli.Call(ctx, "keybase.1.prove.startProof", []interface{}{__arg}, &res, 0*time.Millisecond) 152 return 153 } 154 155 func (c ProveClient) CheckProof(ctx context.Context, __arg CheckProofArg) (res CheckProofStatus, err error) { 156 err = c.Cli.Call(ctx, "keybase.1.prove.checkProof", []interface{}{__arg}, &res, 0*time.Millisecond) 157 return 158 } 159 160 func (c ProveClient) ListSomeProofServices(ctx context.Context) (res []string, err error) { 161 err = c.Cli.Call(ctx, "keybase.1.prove.listSomeProofServices", []interface{}{ListSomeProofServicesArg{}}, &res, 0*time.Millisecond) 162 return 163 } 164 165 func (c ProveClient) ListProofServices(ctx context.Context) (res []string, err error) { 166 err = c.Cli.Call(ctx, "keybase.1.prove.listProofServices", []interface{}{ListProofServicesArg{}}, &res, 0*time.Millisecond) 167 return 168 } 169 170 func (c ProveClient) ValidateUsername(ctx context.Context, __arg ValidateUsernameArg) (err error) { 171 err = c.Cli.Call(ctx, "keybase.1.prove.validateUsername", []interface{}{__arg}, nil, 0*time.Millisecond) 172 return 173 }