forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
revoke.go
107 lines (96 loc) · 2.99 KB
/
revoke.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
// Auto-generated by avdl-compiler v1.3.25 (https://github.com/keybase/node-avdl-compiler)
// Input file: avdl/keybase1/revoke.avdl
package keybase1
import (
"github.com/keybase/go-framed-msgpack-rpc/rpc"
context "golang.org/x/net/context"
)
type RevokeKeyArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
KeyID KID `codec:"keyID" json:"keyID"`
}
type RevokeDeviceArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
DeviceID DeviceID `codec:"deviceID" json:"deviceID"`
ForceSelf bool `codec:"forceSelf" json:"forceSelf"`
ForceLast bool `codec:"forceLast" json:"forceLast"`
}
type RevokeSigsArg struct {
SessionID int `codec:"sessionID" json:"sessionID"`
SigIDQueries []string `codec:"sigIDQueries" json:"sigIDQueries"`
}
type RevokeInterface interface {
RevokeKey(context.Context, RevokeKeyArg) error
RevokeDevice(context.Context, RevokeDeviceArg) error
RevokeSigs(context.Context, RevokeSigsArg) error
}
func RevokeProtocol(i RevokeInterface) rpc.Protocol {
return rpc.Protocol{
Name: "keybase.1.revoke",
Methods: map[string]rpc.ServeHandlerDescription{
"revokeKey": {
MakeArg: func() interface{} {
var ret [1]RevokeKeyArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]RevokeKeyArg)
if !ok {
err = rpc.NewTypeError((*[1]RevokeKeyArg)(nil), args)
return
}
err = i.RevokeKey(ctx, typedArgs[0])
return
},
MethodType: rpc.MethodCall,
},
"revokeDevice": {
MakeArg: func() interface{} {
var ret [1]RevokeDeviceArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]RevokeDeviceArg)
if !ok {
err = rpc.NewTypeError((*[1]RevokeDeviceArg)(nil), args)
return
}
err = i.RevokeDevice(ctx, typedArgs[0])
return
},
MethodType: rpc.MethodCall,
},
"revokeSigs": {
MakeArg: func() interface{} {
var ret [1]RevokeSigsArg
return &ret
},
Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
typedArgs, ok := args.(*[1]RevokeSigsArg)
if !ok {
err = rpc.NewTypeError((*[1]RevokeSigsArg)(nil), args)
return
}
err = i.RevokeSigs(ctx, typedArgs[0])
return
},
MethodType: rpc.MethodCall,
},
},
}
}
type RevokeClient struct {
Cli rpc.GenericClient
}
func (c RevokeClient) RevokeKey(ctx context.Context, __arg RevokeKeyArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.revoke.revokeKey", []interface{}{__arg}, nil)
return
}
func (c RevokeClient) RevokeDevice(ctx context.Context, __arg RevokeDeviceArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.revoke.revokeDevice", []interface{}{__arg}, nil)
return
}
func (c RevokeClient) RevokeSigs(ctx context.Context, __arg RevokeSigsArg) (err error) {
err = c.Cli.Call(ctx, "keybase.1.revoke.revokeSigs", []interface{}{__arg}, nil)
return
}