/
walletunlocker_grpc.pb.go
325 lines (297 loc) · 13.8 KB
/
walletunlocker_grpc.pb.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
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package tdex_daemonv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// WalletUnlockerServiceClient is the client API for WalletUnlockerService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type WalletUnlockerServiceClient interface {
// GenSeed is the first method that should be used to instantiate a new tdexd
// instance. This method allows a caller to generate a new HD Wallet.
// Once the seed is obtained and verified by the user, the InitWallet
// method should be used to commit the newly generated seed, and create the
// wallet.
GenSeed(ctx context.Context, in *GenSeedRequest, opts ...grpc.CallOption) (*GenSeedResponse, error)
// InitWallet is used when tdexd is starting up for the first time to fully
// initialize the daemon and its internal wallet.
// The wallet in the tdexd context is a database file on the disk that can be
// found in the configured data directory.
// At the very least a mnemonic and a wallet password must be provided to this
// RPC. The latter will be used to encrypt sensitive material on disk.
// Once initialized the wallet is locked and since the password is never stored
// on the disk, it's required to pass it into the Unlock RPC request to be able
// to manage the daemon for operations like depositing funds or opening a market.
InitWallet(ctx context.Context, in *InitWalletRequest, opts ...grpc.CallOption) (WalletUnlockerService_InitWalletClient, error)
// UnlockWallet is used at startup of tdexd to provide a password to unlock
// the wallet database. Once unlocked, the only way to lock the wallet again is
// shutting it down.
UnlockWallet(ctx context.Context, in *UnlockWalletRequest, opts ...grpc.CallOption) (*UnlockWalletResponse, error)
// ChangePassword changes the password of the encrypted wallet. This RPC
// requires the internal wallet to be locked. It doesn't change the wallet state
// in any case, therefore, like after calling InitWallet, it is required to
// unlock the walket with UnlockWallet RPC after this operation succeeds.
ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error)
// IsReady is useful for external applications interacting with tdexd to know
// whether its ready, meaning that also the wallet, operator trade services
// are able to serve requests.
// Restarting tdexd or initiliazing it by restoring an existing wallet can be
// time-expensive operations causing tdexd to not be ready until they haven't
// finished.
IsReady(ctx context.Context, in *IsReadyRequest, opts ...grpc.CallOption) (*IsReadyResponse, error)
}
type walletUnlockerServiceClient struct {
cc grpc.ClientConnInterface
}
func NewWalletUnlockerServiceClient(cc grpc.ClientConnInterface) WalletUnlockerServiceClient {
return &walletUnlockerServiceClient{cc}
}
func (c *walletUnlockerServiceClient) GenSeed(ctx context.Context, in *GenSeedRequest, opts ...grpc.CallOption) (*GenSeedResponse, error) {
out := new(GenSeedResponse)
err := c.cc.Invoke(ctx, "/tdex_daemon.v1.WalletUnlockerService/GenSeed", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletUnlockerServiceClient) InitWallet(ctx context.Context, in *InitWalletRequest, opts ...grpc.CallOption) (WalletUnlockerService_InitWalletClient, error) {
stream, err := c.cc.NewStream(ctx, &WalletUnlockerService_ServiceDesc.Streams[0], "/tdex_daemon.v1.WalletUnlockerService/InitWallet", opts...)
if err != nil {
return nil, err
}
x := &walletUnlockerServiceInitWalletClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type WalletUnlockerService_InitWalletClient interface {
Recv() (*InitWalletResponse, error)
grpc.ClientStream
}
type walletUnlockerServiceInitWalletClient struct {
grpc.ClientStream
}
func (x *walletUnlockerServiceInitWalletClient) Recv() (*InitWalletResponse, error) {
m := new(InitWalletResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *walletUnlockerServiceClient) UnlockWallet(ctx context.Context, in *UnlockWalletRequest, opts ...grpc.CallOption) (*UnlockWalletResponse, error) {
out := new(UnlockWalletResponse)
err := c.cc.Invoke(ctx, "/tdex_daemon.v1.WalletUnlockerService/UnlockWallet", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletUnlockerServiceClient) ChangePassword(ctx context.Context, in *ChangePasswordRequest, opts ...grpc.CallOption) (*ChangePasswordResponse, error) {
out := new(ChangePasswordResponse)
err := c.cc.Invoke(ctx, "/tdex_daemon.v1.WalletUnlockerService/ChangePassword", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *walletUnlockerServiceClient) IsReady(ctx context.Context, in *IsReadyRequest, opts ...grpc.CallOption) (*IsReadyResponse, error) {
out := new(IsReadyResponse)
err := c.cc.Invoke(ctx, "/tdex_daemon.v1.WalletUnlockerService/IsReady", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// WalletUnlockerServiceServer is the server API for WalletUnlockerService service.
// All implementations should embed UnimplementedWalletUnlockerServiceServer
// for forward compatibility
type WalletUnlockerServiceServer interface {
// GenSeed is the first method that should be used to instantiate a new tdexd
// instance. This method allows a caller to generate a new HD Wallet.
// Once the seed is obtained and verified by the user, the InitWallet
// method should be used to commit the newly generated seed, and create the
// wallet.
GenSeed(context.Context, *GenSeedRequest) (*GenSeedResponse, error)
// InitWallet is used when tdexd is starting up for the first time to fully
// initialize the daemon and its internal wallet.
// The wallet in the tdexd context is a database file on the disk that can be
// found in the configured data directory.
// At the very least a mnemonic and a wallet password must be provided to this
// RPC. The latter will be used to encrypt sensitive material on disk.
// Once initialized the wallet is locked and since the password is never stored
// on the disk, it's required to pass it into the Unlock RPC request to be able
// to manage the daemon for operations like depositing funds or opening a market.
InitWallet(*InitWalletRequest, WalletUnlockerService_InitWalletServer) error
// UnlockWallet is used at startup of tdexd to provide a password to unlock
// the wallet database. Once unlocked, the only way to lock the wallet again is
// shutting it down.
UnlockWallet(context.Context, *UnlockWalletRequest) (*UnlockWalletResponse, error)
// ChangePassword changes the password of the encrypted wallet. This RPC
// requires the internal wallet to be locked. It doesn't change the wallet state
// in any case, therefore, like after calling InitWallet, it is required to
// unlock the walket with UnlockWallet RPC after this operation succeeds.
ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error)
// IsReady is useful for external applications interacting with tdexd to know
// whether its ready, meaning that also the wallet, operator trade services
// are able to serve requests.
// Restarting tdexd or initiliazing it by restoring an existing wallet can be
// time-expensive operations causing tdexd to not be ready until they haven't
// finished.
IsReady(context.Context, *IsReadyRequest) (*IsReadyResponse, error)
}
// UnimplementedWalletUnlockerServiceServer should be embedded to have forward compatible implementations.
type UnimplementedWalletUnlockerServiceServer struct {
}
func (UnimplementedWalletUnlockerServiceServer) GenSeed(context.Context, *GenSeedRequest) (*GenSeedResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GenSeed not implemented")
}
func (UnimplementedWalletUnlockerServiceServer) InitWallet(*InitWalletRequest, WalletUnlockerService_InitWalletServer) error {
return status.Errorf(codes.Unimplemented, "method InitWallet not implemented")
}
func (UnimplementedWalletUnlockerServiceServer) UnlockWallet(context.Context, *UnlockWalletRequest) (*UnlockWalletResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnlockWallet not implemented")
}
func (UnimplementedWalletUnlockerServiceServer) ChangePassword(context.Context, *ChangePasswordRequest) (*ChangePasswordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangePassword not implemented")
}
func (UnimplementedWalletUnlockerServiceServer) IsReady(context.Context, *IsReadyRequest) (*IsReadyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsReady not implemented")
}
// UnsafeWalletUnlockerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WalletUnlockerServiceServer will
// result in compilation errors.
type UnsafeWalletUnlockerServiceServer interface {
mustEmbedUnimplementedWalletUnlockerServiceServer()
}
func RegisterWalletUnlockerServiceServer(s grpc.ServiceRegistrar, srv WalletUnlockerServiceServer) {
s.RegisterService(&WalletUnlockerService_ServiceDesc, srv)
}
func _WalletUnlockerService_GenSeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GenSeedRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServiceServer).GenSeed(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tdex_daemon.v1.WalletUnlockerService/GenSeed",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServiceServer).GenSeed(ctx, req.(*GenSeedRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletUnlockerService_InitWallet_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(InitWalletRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(WalletUnlockerServiceServer).InitWallet(m, &walletUnlockerServiceInitWalletServer{stream})
}
type WalletUnlockerService_InitWalletServer interface {
Send(*InitWalletResponse) error
grpc.ServerStream
}
type walletUnlockerServiceInitWalletServer struct {
grpc.ServerStream
}
func (x *walletUnlockerServiceInitWalletServer) Send(m *InitWalletResponse) error {
return x.ServerStream.SendMsg(m)
}
func _WalletUnlockerService_UnlockWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UnlockWalletRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServiceServer).UnlockWallet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tdex_daemon.v1.WalletUnlockerService/UnlockWallet",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServiceServer).UnlockWallet(ctx, req.(*UnlockWalletRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletUnlockerService_ChangePassword_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ChangePasswordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServiceServer).ChangePassword(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tdex_daemon.v1.WalletUnlockerService/ChangePassword",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServiceServer).ChangePassword(ctx, req.(*ChangePasswordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _WalletUnlockerService_IsReady_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsReadyRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(WalletUnlockerServiceServer).IsReady(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tdex_daemon.v1.WalletUnlockerService/IsReady",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(WalletUnlockerServiceServer).IsReady(ctx, req.(*IsReadyRequest))
}
return interceptor(ctx, in, info, handler)
}
// WalletUnlockerService_ServiceDesc is the grpc.ServiceDesc for WalletUnlockerService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var WalletUnlockerService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "tdex_daemon.v1.WalletUnlockerService",
HandlerType: (*WalletUnlockerServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GenSeed",
Handler: _WalletUnlockerService_GenSeed_Handler,
},
{
MethodName: "UnlockWallet",
Handler: _WalletUnlockerService_UnlockWallet_Handler,
},
{
MethodName: "ChangePassword",
Handler: _WalletUnlockerService_ChangePassword_Handler,
},
{
MethodName: "IsReady",
Handler: _WalletUnlockerService_IsReady_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "InitWallet",
Handler: _WalletUnlockerService_InitWallet_Handler,
ServerStreams: true,
},
},
Metadata: "tdex-daemon/v1/walletunlocker.proto",
}