refactor: update gRPC client to use new request types

This commit is contained in:
Prad Nukala 2024-10-18 15:10:09 -04:00
parent a0a5f0c7e0
commit 3ad6036eb8
13 changed files with 793 additions and 1055 deletions

View File

@ -5357,28 +5357,29 @@ var file_did_v1_query_proto_rawDesc = []byte{
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61,
0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20,
0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x32, 0xdc, 0x02, 0x0a, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x32, 0xec, 0x02, 0x0a,
0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x4c, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x53, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x12, 0x14, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x12, 0x14, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e,
0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x0f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x09, 0x12, 0x07, 0x2f, 0x70, 0x61, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x64, 0x69,
0x72, 0x61, 0x6d, 0x73, 0x12, 0x51, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x54, 0x0a, 0x07, 0x52,
0x14, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x12, 0x14, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x64,
0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x6f, 0x6c,
0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x64, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93,
0x64, 0x2f, 0x7b, 0x64, 0x69, 0x64, 0x7d, 0x12, 0x54, 0x0a, 0x04, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x64, 0x69, 0x64,
0x18, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x69, 0x7d, 0x12, 0x57, 0x0a, 0x04, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x18, 0x2e, 0x64, 0x69, 0x64, 0x2e,
0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75,
0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x22, 0x0f, 0x2f, 0x64, 0x72, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a,
0x69, 0x64, 0x2f, 0x7b, 0x64, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x5c, 0x0a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x22, 0x12, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x2f,
0x06, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x1a, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x7b, 0x64, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x12, 0x5f, 0x0a, 0x06, 0x56, 0x65,
0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x72, 0x69, 0x66, 0x79, 0x12, 0x1a, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x65, 0x72, 0x79, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x72, 0x79, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x1b, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56,
0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x7b, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x14, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
0x64, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x42, 0x7a, 0x0a, 0x0a, 0x63, 0x64, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x42, 0x7a, 0x0a, 0x0a, 0x63,
0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79,
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,

File diff suppressed because it is too large Load Diff

View File

@ -36,10 +36,10 @@ type QueryClient interface {
Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error)
// Allocate initializes a Target Vault available for claims with a compatible // Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn. // Authentication mechanism. The default authentication mechanism is WebAuthn.
Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error)
// Sync queries the DID document by its id. And returns the required PKL // Sync queries the DID document by its id. And returns the required PKL
// information // information
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -68,8 +68,8 @@ func (c *queryClient) Schema(ctx context.Context, in *QuerySchemaRequest, opts .
return out, nil return out, nil
} }
func (c *queryClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) { func (c *queryClient) Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error) {
out := new(AllocateResponse) out := new(QueryAllocateResponse)
err := c.cc.Invoke(ctx, Query_Allocate_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, Query_Allocate_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -77,8 +77,8 @@ func (c *queryClient) Allocate(ctx context.Context, in *AllocateRequest, opts ..
return out, nil return out, nil
} }
func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) { func (c *queryClient) Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error) {
out := new(SyncResponse) out := new(QuerySyncResponse)
err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -97,10 +97,10 @@ type QueryServer interface {
Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error)
// Allocate initializes a Target Vault available for claims with a compatible // Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn. // Authentication mechanism. The default authentication mechanism is WebAuthn.
Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error)
// Sync queries the DID document by its id. And returns the required PKL // Sync queries the DID document by its id. And returns the required PKL
// information // information
Sync(context.Context, *SyncRequest) (*SyncResponse, error) Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error)
mustEmbedUnimplementedQueryServer() mustEmbedUnimplementedQueryServer()
} }
@ -114,10 +114,10 @@ func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*Q
func (UnimplementedQueryServer) Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) { func (UnimplementedQueryServer) Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented") return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented")
} }
func (UnimplementedQueryServer) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) { func (UnimplementedQueryServer) Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented") return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
} }
func (UnimplementedQueryServer) Sync(context.Context, *SyncRequest) (*SyncResponse, error) { func (UnimplementedQueryServer) Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
} }
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
@ -170,7 +170,7 @@ func _Query_Schema_Handler(srv interface{}, ctx context.Context, dec func(interf
} }
func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AllocateRequest) in := new(QueryAllocateRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -182,13 +182,13 @@ func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(inte
FullMethod: Query_Allocate_FullMethodName, FullMethod: Query_Allocate_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Allocate(ctx, req.(*AllocateRequest)) return srv.(QueryServer).Allocate(ctx, req.(*QueryAllocateRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncRequest) in := new(QuerySyncRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -200,7 +200,7 @@ func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interfac
FullMethod: Query_Sync_FullMethodName, FullMethod: Query_Sync_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Sync(ctx, req.(*SyncRequest)) return srv.(QueryServer).Sync(ctx, req.(*QuerySyncRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }

View File

@ -10,22 +10,22 @@ option go_package = "github.com/onsonr/sonr/x/did/types";
service Query { service Query {
// Params queries all parameters of the module. // Params queries all parameters of the module.
rpc Params(QueryRequest) returns (QueryParamsResponse) { rpc Params(QueryRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/params"; option (google.api.http).get = "/did/v1/params";
} }
// Resolve queries the DID document by its id. // Resolve queries the DID document by its id.
rpc Resolve(QueryRequest) returns (QueryResolveResponse) { rpc Resolve(QueryRequest) returns (QueryResolveResponse) {
option (google.api.http).get = "/did/{did}"; option (google.api.http).get = "/did/v1/{did}";
} }
// Sign signs a message with the DID document // Sign signs a message with the DID document
rpc Sign(QuerySignRequest) returns (QuerySignResponse) { rpc Sign(QuerySignRequest) returns (QuerySignResponse) {
option (google.api.http).post = "/did/{did}/sign"; option (google.api.http).post = "/did/v1/{did}/sign";
} }
// Verify verifies a message with the DID document // Verify verifies a message with the DID document
rpc Verify(QueryVerifyRequest) returns (QueryVerifyResponse) { rpc Verify(QueryVerifyRequest) returns (QueryVerifyResponse) {
option (google.api.http).post = "/did/{did}/verify"; option (google.api.http).post = "/did/v1/{did}/verify";
} }
} }

View File

@ -21,14 +21,14 @@ service Query {
// Allocate initializes a Target Vault available for claims with a compatible // Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn. // Authentication mechanism. The default authentication mechanism is WebAuthn.
rpc Allocate(AllocateRequest) returns (AllocateResponse) { rpc Allocate(QueryAllocateRequest) returns (QueryAllocateResponse) {
option (google.api.http).get = "/vault/v1/allocate/{origin}/{subject}"; option (google.api.http).get = "/vault/v1/allocate";
} }
// Sync queries the DID document by its id. And returns the required PKL // Sync queries the DID document by its id. And returns the required PKL
// information // information
rpc Sync(SyncRequest) returns (SyncResponse) { rpc Sync(QuerySyncRequest) returns (QuerySyncResponse) {
option (google.api.http).post = "/vault/v1/sync-initial"; option (google.api.http).get = "/vault/v1/sync-initial";
} }
} }
@ -50,14 +50,11 @@ message QuerySchemaResponse {
Schema schema = 1; Schema schema = 1;
} }
// AllocateRequest is the request type for the Allocate RPC method. // QueryAllocateRequest is the request type for the Allocate RPC method.
message AllocateRequest { message QueryAllocateRequest {}
string origin = 1;
string subject = 2;
}
// AllocateResponse is the response type for the Allocate RPC method. // AllocateResponse is the response type for the Allocate RPC method.
message AllocateResponse { message QueryAllocateResponse {
bool success = 1; bool success = 1;
string cid = 2; string cid = 2;
string macaroon = 3; string macaroon = 3;
@ -66,12 +63,12 @@ message AllocateResponse {
} }
// SyncRequest is the request type for the Sync RPC method. // SyncRequest is the request type for the Sync RPC method.
message SyncRequest { message QuerySyncRequest {
string did = 1; string did = 1;
} }
// SyncResponse is the response type for the Sync RPC method. // SyncResponse is the response type for the Sync RPC method.
message SyncResponse { message QuerySyncResponse {
bool success = 1; bool success = 1;
// Schema is the DID document. // Schema is the DID document.

48
slumber.yml Normal file
View File

@ -0,0 +1,48 @@
# For basic usage info, see:
# https://slumber.lucaspickering.me/book/getting_started.html
# For all collection options, see:
# https://slumber.lucaspickering.me/book/api/request_collection/index.html
# Profiles are groups of data you can easily switch between. A common usage is
# to define profiles for various environments of a REST service
# slumber.yml
# $schema: https://json.schemastore.org/github-workflow
profiles:
local:
data:
host: http://localhost:1317
production:
data:
host: https://api.sonr.id
requests:
did: !folder
name: x/did
requests:
get_did_params: !request
method: GET
url: "{{host}}/did/v1/params"
macaroon: !folder
name: x/macaroon
requests:
get_macaroon_params: !request
method: GET
url: "{{host}}/macaroon/v1/params"
service: !folder
name: x/service
requests:
get_service_params: !request
method: GET
url: "{{host}}/service/v1/params"
vault: !folder
name: x/vault
requests:
get_vault_params: !request
method: GET
url: "{{host}}/vault/v1/params"
get_vault_schema: !request
method: GET
url: "{{host}}/vault/v1/schema"

View File

@ -551,45 +551,45 @@ func init() { proto.RegisterFile("did/v1/query.proto", fileDescriptor_ae1fa9bb62
var fileDescriptor_ae1fa9bb626e2869 = []byte{ var fileDescriptor_ae1fa9bb626e2869 = []byte{
// 625 bytes of a gzipped FileDescriptorProto // 625 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc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0xab, 0x1e, 0xdc,
0x5f, 0x2f, 0x82, 0xda, 0xf9, 0x45, 0x50, 0xfb, 0x79, 0x11, 0xd4, 0x3e, 0x5e, 0x06, 0x0b, 0xe7, 0xfb, 0x72, 0x11, 0x36, 0xce, 0x2f, 0xc2, 0xc6, 0xf7, 0x8b, 0xb0, 0xf1, 0xe1, 0x32, 0x5c, 0x3a,
0x97, 0xc1, 0xc2, 0xf7, 0xcb, 0x60, 0xe1, 0x05, 0x8d, 0x84, 0x39, 0x99, 0x1c, 0xf7, 0x87, 0x6a, 0xbf, 0x0c, 0x97, 0xbe, 0x5d, 0x86, 0x4b, 0x2f, 0x68, 0x2c, 0xcc, 0xc9, 0xf4, 0x78, 0x30, 0x52,
0x14, 0x2a, 0xa9, 0x95, 0x4c, 0x42, 0xfb, 0xf3, 0xc6, 0x92, 0x98, 0xe9, 0x18, 0xf5, 0xb1, 0x67, 0xe3, 0x48, 0x49, 0xad, 0x64, 0x1a, 0xd9, 0x9f, 0xd7, 0x96, 0xc7, 0xcc, 0x26, 0xa8, 0x8f, 0x3d,
0xdf, 0xc7, 0xfd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xfc, 0xed, 0xdf, 0x71, 0x05, 0x00, 0xfb, 0xbd, 0xdc, 0xff, 0x15, 0x00, 0x00, 0xff, 0xff, 0xb9, 0xc1, 0x21, 0x0f, 0x81, 0x05, 0x00,
0x00, 0x00,
} }

View File

@ -508,13 +508,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
} }
var ( var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"did", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Resolve_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0}, []string{"did"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Resolve_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 0}, []string{"did", "v1"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Sign_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 2, 1}, []string{"did", "sign"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Sign_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 0, 2, 2}, []string{"did", "v1", "sign"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Verify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 2, 1}, []string{"did", "verify"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Verify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 0, 2, 2}, []string{"did", "v1", "verify"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (

View File

@ -1,57 +0,0 @@
package keeper
import (
"context"
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
"github.com/onsonr/sonr/x/vault/types"
)
// assembleVault assembles the initial vault
func (k Keeper) assembleVault(cotx sdk.Context, schema *dwngen.Schema) (string, int64, error) {
_, con, err := k.DIDKeeper.NewController(cotx)
if err != nil {
return "", 0, err
}
usrKs, err := con.ExportUserKs()
if err != nil {
return "", 0, err
}
v, err := types.NewVault(usrKs, con.SonrAddress(), con.ChainID(), schema)
if err != nil {
return "", 0, err
}
cid, err := k.ipfsClient.Unixfs().Add(context.Background(), v.FS)
if err != nil {
return "", 0, err
}
return cid.String(), calculateBlockExpiry(cotx, time.Second*30), nil
}
// currentSchema returns the current schema
func (k Keeper) currentSchema(ctx sdk.Context) (*dwngen.Schema, error) {
p, err := k.Params.Get(ctx)
if err != nil {
return nil, err
}
schema := p.Schema
return &dwngen.Schema{
Version: int(schema.Version),
Account: schema.Account,
Asset: schema.Asset,
Chain: schema.Chain,
Credential: schema.Credential,
Jwk: schema.Jwk,
Grant: schema.Grant,
Keyshare: schema.Keyshare,
Profile: schema.Profile,
}, nil
}
func calculateBlockExpiry(sdkctx sdk.Context, duration time.Duration) int64 {
blockTime := sdkctx.BlockTime()
avgBlockTime := float64(blockTime.Sub(blockTime).Seconds())
return int64(duration.Seconds() / avgBlockTime)
}

View File

@ -1,17 +1,21 @@
package keeper package keeper
import ( import (
"time"
"cosmossdk.io/collections" "cosmossdk.io/collections"
storetypes "cosmossdk.io/core/store" storetypes "cosmossdk.io/core/store"
"cosmossdk.io/log" "cosmossdk.io/log"
"cosmossdk.io/orm/model/ormdb" "cosmossdk.io/orm/model/ormdb"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/ipfs/kubo/client/rpc" "github.com/ipfs/kubo/client/rpc"
apiv1 "github.com/onsonr/sonr/api/vault/v1" apiv1 "github.com/onsonr/sonr/api/vault/v1"
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
didkeeper "github.com/onsonr/sonr/x/did/keeper" didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/vault/types" "github.com/onsonr/sonr/x/vault/types"
@ -43,7 +47,7 @@ func NewKeeper(
logger log.Logger, logger log.Logger,
authority string, authority string,
authKeeper authkeeper.AccountKeeper, authKeeper authkeeper.AccountKeeper,
didk didkeeper.Keeper, didKeeper didkeeper.Keeper,
macaroonKeeper macaroonkeeper.Keeper, macaroonKeeper macaroonkeeper.Keeper,
) Keeper { ) Keeper {
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
@ -64,11 +68,15 @@ func NewKeeper(
panic(err) panic(err)
} }
ipfsClient, _ := rpc.NewLocalApi() ipfsClient, err := rpc.NewLocalApi()
if err != nil {
panic(err)
}
k := Keeper{ k := Keeper{
cdc: cdc, cdc: cdc,
logger: logger, logger: logger,
DIDKeeper: didk, DIDKeeper: didKeeper,
MacaroonKeeper: macaroonKeeper, MacaroonKeeper: macaroonKeeper,
AccountKeeper: authKeeper, AccountKeeper: authKeeper,
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
@ -87,3 +95,29 @@ func NewKeeper(
return k return k
} }
// currentSchema returns the current schema
func (k Keeper) currentSchema(ctx sdk.Context) (*dwngen.Schema, error) {
p, err := k.Params.Get(ctx)
if err != nil {
return nil, err
}
schema := p.Schema
return &dwngen.Schema{
Version: int(schema.Version),
Account: schema.Account,
Asset: schema.Asset,
Chain: schema.Chain,
Credential: schema.Credential,
Jwk: schema.Jwk,
Grant: schema.Grant,
Keyshare: schema.Keyshare,
Profile: schema.Profile,
}, nil
}
func calculateBlockExpiry(sdkctx sdk.Context, duration time.Duration) int64 {
blockTime := sdkctx.BlockTime()
avgBlockTime := float64(blockTime.Sub(blockTime).Seconds())
return int64(duration.Seconds() / avgBlockTime)
}

View File

@ -2,8 +2,11 @@ package keeper
import ( import (
"context" "context"
"time"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/onsonr/crypto/mpc"
didtypes "github.com/onsonr/sonr/x/did/types"
"github.com/onsonr/sonr/x/vault/types" "github.com/onsonr/sonr/x/vault/types"
) )
@ -50,25 +53,46 @@ func (k Querier) Schema(goCtx context.Context, req *types.QuerySchemaRequest) (*
// ╰───────────────────────────────────────────────────────────╯ // ╰───────────────────────────────────────────────────────────╯
// Allocate implements types.QueryServer. // Allocate implements types.QueryServer.
func (k Querier) Allocate(goCtx context.Context, req *types.AllocateRequest) (*types.AllocateResponse, error) { func (k Querier) Allocate(goCtx context.Context, req *types.QueryAllocateRequest) (*types.QueryAllocateResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx) ctx := sdk.UnwrapSDKContext(goCtx)
// 1. Get current schema // 1. Get current schema
sch, err := k.currentSchema(ctx) sch, err := k.currentSchema(ctx)
if err != nil { if err != nil {
ctx.Logger().Error(err.Error())
return nil, types.ErrInvalidSchema.Wrap(err.Error()) return nil, types.ErrInvalidSchema.Wrap(err.Error())
} }
shares, err := mpc.GenerateKeyshares()
// 2.Allocate the vault msg.GetSubject(), msg.GetOrigin()
cid, expiryBlock, err := k.assembleVault(ctx, sch)
if err != nil { if err != nil {
ctx.Logger().Error(err.Error())
return nil, err
}
con, err := didtypes.NewController(ctx, shares)
if err != nil {
ctx.Logger().Error(err.Error())
return nil, err
}
usrKs, err := con.ExportUserKs()
if err != nil {
ctx.Logger().Error(err.Error())
return nil, types.ErrInvalidSchema.Wrap(err.Error())
}
v, err := types.NewVault(usrKs, con.SonrAddress(), con.ChainID(), sch)
if err != nil {
ctx.Logger().Error(err.Error())
return nil, types.ErrInvalidSchema.Wrap(err.Error())
}
cid, err := k.ipfsClient.Unixfs().Add(context.Background(), v.FS)
if err != nil {
ctx.Logger().Error(err.Error())
return nil, types.ErrVaultAssembly.Wrap(err.Error()) return nil, types.ErrVaultAssembly.Wrap(err.Error())
} }
return &types.AllocateResponse{ return &types.QueryAllocateResponse{
Success: true, Success: true,
Cid: cid, Cid: cid.String(),
ExpiryBlock: expiryBlock, ExpiryBlock: calculateBlockExpiry(ctx, time.Second*30),
}, nil }, nil
} }
@ -77,7 +101,7 @@ func (k Querier) Allocate(goCtx context.Context, req *types.AllocateRequest) (*t
// ╰───────────────────────────────────────────────────────────╯ // ╰───────────────────────────────────────────────────────────╯
// Sync implements types.QueryServer. // Sync implements types.QueryServer.
func (k Querier) Sync(goCtx context.Context, req *types.SyncRequest) (*types.SyncResponse, error) { func (k Querier) Sync(goCtx context.Context, req *types.QuerySyncRequest) (*types.QuerySyncResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx) ctx := sdk.UnwrapSDKContext(goCtx)
p, err := k.Keeper.Params.Get(ctx) p, err := k.Keeper.Params.Get(ctx)
if err != nil { if err != nil {
@ -85,13 +109,13 @@ func (k Querier) Sync(goCtx context.Context, req *types.SyncRequest) (*types.Syn
} }
c, _ := k.DIDKeeper.ResolveController(ctx, req.Did) c, _ := k.DIDKeeper.ResolveController(ctx, req.Did)
if c == nil { if c == nil {
return &types.SyncResponse{ return &types.QuerySyncResponse{
Success: false, Success: false,
Schema: p.Schema, Schema: p.Schema,
ChainID: ctx.ChainID(), ChainID: ctx.ChainID(),
}, nil }, nil
} }
return &types.SyncResponse{ return &types.QuerySyncResponse{
Success: true, Success: true,
Schema: p.Schema, Schema: p.Schema,
ChainID: ctx.ChainID(), ChainID: ctx.ChainID(),

View File

@ -194,24 +194,22 @@ func (m *QuerySchemaResponse) GetSchema() *Schema {
return nil return nil
} }
// AllocateRequest is the request type for the Allocate RPC method. // QueryAllocateRequest is the request type for the Allocate RPC method.
type AllocateRequest struct { type QueryAllocateRequest struct {
Origin string `protobuf:"bytes,1,opt,name=origin,proto3" json:"origin,omitempty"`
Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
} }
func (m *AllocateRequest) Reset() { *m = AllocateRequest{} } func (m *QueryAllocateRequest) Reset() { *m = QueryAllocateRequest{} }
func (m *AllocateRequest) String() string { return proto.CompactTextString(m) } func (m *QueryAllocateRequest) String() string { return proto.CompactTextString(m) }
func (*AllocateRequest) ProtoMessage() {} func (*QueryAllocateRequest) ProtoMessage() {}
func (*AllocateRequest) Descriptor() ([]byte, []int) { func (*QueryAllocateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{4} return fileDescriptor_e6d49a2800ab3e4b, []int{4}
} }
func (m *AllocateRequest) XXX_Unmarshal(b []byte) error { func (m *QueryAllocateRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *AllocateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *QueryAllocateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_AllocateRequest.Marshal(b, m, deterministic) return xxx_messageInfo_QueryAllocateRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -221,34 +219,20 @@ func (m *AllocateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil return b[:n], nil
} }
} }
func (m *AllocateRequest) XXX_Merge(src proto.Message) { func (m *QueryAllocateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_AllocateRequest.Merge(m, src) xxx_messageInfo_QueryAllocateRequest.Merge(m, src)
} }
func (m *AllocateRequest) XXX_Size() int { func (m *QueryAllocateRequest) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *AllocateRequest) XXX_DiscardUnknown() { func (m *QueryAllocateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_AllocateRequest.DiscardUnknown(m) xxx_messageInfo_QueryAllocateRequest.DiscardUnknown(m)
} }
var xxx_messageInfo_AllocateRequest proto.InternalMessageInfo var xxx_messageInfo_QueryAllocateRequest proto.InternalMessageInfo
func (m *AllocateRequest) GetOrigin() string {
if m != nil {
return m.Origin
}
return ""
}
func (m *AllocateRequest) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
// AllocateResponse is the response type for the Allocate RPC method. // AllocateResponse is the response type for the Allocate RPC method.
type AllocateResponse struct { type QueryAllocateResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
Cid string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"` Cid string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"`
Macaroon string `protobuf:"bytes,3,opt,name=macaroon,proto3" json:"macaroon,omitempty"` Macaroon string `protobuf:"bytes,3,opt,name=macaroon,proto3" json:"macaroon,omitempty"`
@ -256,18 +240,18 @@ type AllocateResponse struct {
ExpiryBlock int64 `protobuf:"varint,5,opt,name=expiry_block,json=expiryBlock,proto3" json:"expiry_block,omitempty"` ExpiryBlock int64 `protobuf:"varint,5,opt,name=expiry_block,json=expiryBlock,proto3" json:"expiry_block,omitempty"`
} }
func (m *AllocateResponse) Reset() { *m = AllocateResponse{} } func (m *QueryAllocateResponse) Reset() { *m = QueryAllocateResponse{} }
func (m *AllocateResponse) String() string { return proto.CompactTextString(m) } func (m *QueryAllocateResponse) String() string { return proto.CompactTextString(m) }
func (*AllocateResponse) ProtoMessage() {} func (*QueryAllocateResponse) ProtoMessage() {}
func (*AllocateResponse) Descriptor() ([]byte, []int) { func (*QueryAllocateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{5} return fileDescriptor_e6d49a2800ab3e4b, []int{5}
} }
func (m *AllocateResponse) XXX_Unmarshal(b []byte) error { func (m *QueryAllocateResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *AllocateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *QueryAllocateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_AllocateResponse.Marshal(b, m, deterministic) return xxx_messageInfo_QueryAllocateResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -277,47 +261,47 @@ func (m *AllocateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er
return b[:n], nil return b[:n], nil
} }
} }
func (m *AllocateResponse) XXX_Merge(src proto.Message) { func (m *QueryAllocateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_AllocateResponse.Merge(m, src) xxx_messageInfo_QueryAllocateResponse.Merge(m, src)
} }
func (m *AllocateResponse) XXX_Size() int { func (m *QueryAllocateResponse) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *AllocateResponse) XXX_DiscardUnknown() { func (m *QueryAllocateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_AllocateResponse.DiscardUnknown(m) xxx_messageInfo_QueryAllocateResponse.DiscardUnknown(m)
} }
var xxx_messageInfo_AllocateResponse proto.InternalMessageInfo var xxx_messageInfo_QueryAllocateResponse proto.InternalMessageInfo
func (m *AllocateResponse) GetSuccess() bool { func (m *QueryAllocateResponse) GetSuccess() bool {
if m != nil { if m != nil {
return m.Success return m.Success
} }
return false return false
} }
func (m *AllocateResponse) GetCid() string { func (m *QueryAllocateResponse) GetCid() string {
if m != nil { if m != nil {
return m.Cid return m.Cid
} }
return "" return ""
} }
func (m *AllocateResponse) GetMacaroon() string { func (m *QueryAllocateResponse) GetMacaroon() string {
if m != nil { if m != nil {
return m.Macaroon return m.Macaroon
} }
return "" return ""
} }
func (m *AllocateResponse) GetPublicUri() string { func (m *QueryAllocateResponse) GetPublicUri() string {
if m != nil { if m != nil {
return m.PublicUri return m.PublicUri
} }
return "" return ""
} }
func (m *AllocateResponse) GetExpiryBlock() int64 { func (m *QueryAllocateResponse) GetExpiryBlock() int64 {
if m != nil { if m != nil {
return m.ExpiryBlock return m.ExpiryBlock
} }
@ -325,22 +309,22 @@ func (m *AllocateResponse) GetExpiryBlock() int64 {
} }
// SyncRequest is the request type for the Sync RPC method. // SyncRequest is the request type for the Sync RPC method.
type SyncRequest struct { type QuerySyncRequest struct {
Did string `protobuf:"bytes,1,opt,name=did,proto3" json:"did,omitempty"` Did string `protobuf:"bytes,1,opt,name=did,proto3" json:"did,omitempty"`
} }
func (m *SyncRequest) Reset() { *m = SyncRequest{} } func (m *QuerySyncRequest) Reset() { *m = QuerySyncRequest{} }
func (m *SyncRequest) String() string { return proto.CompactTextString(m) } func (m *QuerySyncRequest) String() string { return proto.CompactTextString(m) }
func (*SyncRequest) ProtoMessage() {} func (*QuerySyncRequest) ProtoMessage() {}
func (*SyncRequest) Descriptor() ([]byte, []int) { func (*QuerySyncRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{6} return fileDescriptor_e6d49a2800ab3e4b, []int{6}
} }
func (m *SyncRequest) XXX_Unmarshal(b []byte) error { func (m *QuerySyncRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *SyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *QuerySyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_SyncRequest.Marshal(b, m, deterministic) return xxx_messageInfo_QuerySyncRequest.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -350,19 +334,19 @@ func (m *SyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil return b[:n], nil
} }
} }
func (m *SyncRequest) XXX_Merge(src proto.Message) { func (m *QuerySyncRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncRequest.Merge(m, src) xxx_messageInfo_QuerySyncRequest.Merge(m, src)
} }
func (m *SyncRequest) XXX_Size() int { func (m *QuerySyncRequest) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *SyncRequest) XXX_DiscardUnknown() { func (m *QuerySyncRequest) XXX_DiscardUnknown() {
xxx_messageInfo_SyncRequest.DiscardUnknown(m) xxx_messageInfo_QuerySyncRequest.DiscardUnknown(m)
} }
var xxx_messageInfo_SyncRequest proto.InternalMessageInfo var xxx_messageInfo_QuerySyncRequest proto.InternalMessageInfo
func (m *SyncRequest) GetDid() string { func (m *QuerySyncRequest) GetDid() string {
if m != nil { if m != nil {
return m.Did return m.Did
} }
@ -370,7 +354,7 @@ func (m *SyncRequest) GetDid() string {
} }
// SyncResponse is the response type for the Sync RPC method. // SyncResponse is the response type for the Sync RPC method.
type SyncResponse struct { type QuerySyncResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
// Schema is the DID document. // Schema is the DID document.
Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"`
@ -380,18 +364,18 @@ type SyncResponse struct {
ChainID string `protobuf:"bytes,4,opt,name=chainID,proto3" json:"chainID,omitempty"` ChainID string `protobuf:"bytes,4,opt,name=chainID,proto3" json:"chainID,omitempty"`
} }
func (m *SyncResponse) Reset() { *m = SyncResponse{} } func (m *QuerySyncResponse) Reset() { *m = QuerySyncResponse{} }
func (m *SyncResponse) String() string { return proto.CompactTextString(m) } func (m *QuerySyncResponse) String() string { return proto.CompactTextString(m) }
func (*SyncResponse) ProtoMessage() {} func (*QuerySyncResponse) ProtoMessage() {}
func (*SyncResponse) Descriptor() ([]byte, []int) { func (*QuerySyncResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{7} return fileDescriptor_e6d49a2800ab3e4b, []int{7}
} }
func (m *SyncResponse) XXX_Unmarshal(b []byte) error { func (m *QuerySyncResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *SyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *QuerySyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_SyncResponse.Marshal(b, m, deterministic) return xxx_messageInfo_QuerySyncResponse.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -401,40 +385,40 @@ func (m *SyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
return b[:n], nil return b[:n], nil
} }
} }
func (m *SyncResponse) XXX_Merge(src proto.Message) { func (m *QuerySyncResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncResponse.Merge(m, src) xxx_messageInfo_QuerySyncResponse.Merge(m, src)
} }
func (m *SyncResponse) XXX_Size() int { func (m *QuerySyncResponse) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *SyncResponse) XXX_DiscardUnknown() { func (m *QuerySyncResponse) XXX_DiscardUnknown() {
xxx_messageInfo_SyncResponse.DiscardUnknown(m) xxx_messageInfo_QuerySyncResponse.DiscardUnknown(m)
} }
var xxx_messageInfo_SyncResponse proto.InternalMessageInfo var xxx_messageInfo_QuerySyncResponse proto.InternalMessageInfo
func (m *SyncResponse) GetSuccess() bool { func (m *QuerySyncResponse) GetSuccess() bool {
if m != nil { if m != nil {
return m.Success return m.Success
} }
return false return false
} }
func (m *SyncResponse) GetSchema() *Schema { func (m *QuerySyncResponse) GetSchema() *Schema {
if m != nil { if m != nil {
return m.Schema return m.Schema
} }
return nil return nil
} }
func (m *SyncResponse) GetAddress() string { func (m *QuerySyncResponse) GetAddress() string {
if m != nil { if m != nil {
return m.Address return m.Address
} }
return "" return ""
} }
func (m *SyncResponse) GetChainID() string { func (m *QuerySyncResponse) GetChainID() string {
if m != nil { if m != nil {
return m.ChainID return m.ChainID
} }
@ -446,51 +430,49 @@ func init() {
proto.RegisterType((*QueryParamsResponse)(nil), "vault.v1.QueryParamsResponse") proto.RegisterType((*QueryParamsResponse)(nil), "vault.v1.QueryParamsResponse")
proto.RegisterType((*QuerySchemaRequest)(nil), "vault.v1.QuerySchemaRequest") proto.RegisterType((*QuerySchemaRequest)(nil), "vault.v1.QuerySchemaRequest")
proto.RegisterType((*QuerySchemaResponse)(nil), "vault.v1.QuerySchemaResponse") proto.RegisterType((*QuerySchemaResponse)(nil), "vault.v1.QuerySchemaResponse")
proto.RegisterType((*AllocateRequest)(nil), "vault.v1.AllocateRequest") proto.RegisterType((*QueryAllocateRequest)(nil), "vault.v1.QueryAllocateRequest")
proto.RegisterType((*AllocateResponse)(nil), "vault.v1.AllocateResponse") proto.RegisterType((*QueryAllocateResponse)(nil), "vault.v1.QueryAllocateResponse")
proto.RegisterType((*SyncRequest)(nil), "vault.v1.SyncRequest") proto.RegisterType((*QuerySyncRequest)(nil), "vault.v1.QuerySyncRequest")
proto.RegisterType((*SyncResponse)(nil), "vault.v1.SyncResponse") proto.RegisterType((*QuerySyncResponse)(nil), "vault.v1.QuerySyncResponse")
} }
func init() { proto.RegisterFile("vault/v1/query.proto", fileDescriptor_e6d49a2800ab3e4b) } func init() { proto.RegisterFile("vault/v1/query.proto", fileDescriptor_e6d49a2800ab3e4b) }
var fileDescriptor_e6d49a2800ab3e4b = []byte{ var fileDescriptor_e6d49a2800ab3e4b = []byte{
// 548 bytes of a gzipped FileDescriptorProto // 520 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x41, 0x6f, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0x3f, 0x6f, 0xd3, 0x40,
0x14, 0x6e, 0xda, 0xad, 0x74, 0xaf, 0x93, 0xa8, 0xcc, 0xa8, 0x42, 0xb4, 0x85, 0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, 0x33, 0xdf, 0xb9, 0x9a, 0xf9, 0xce, 0xef, 0x99, 0xef, 0x7c, 0x98, 0xe6, 0xf3, 0x62, 0xe6, 0x63, 0xbe, 0x08, 0x38, 0x13, 0x9c, 0x65, 0x81, 0xfa, 0xb9, 0x32,
0x99, 0xfb, 0x95, 0xab, 0xb9, 0x5f, 0xf9, 0x35, 0xf7, 0x2b, 0xef, 0x1f, 0x8f, 0x98, 0x1a, 0xa7, 0xa4, 0xbc, 0x4c, 0x89, 0x98, 0x75, 0xd5, 0xa7, 0xff, 0xf2, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff,
0x83, 0x2e, 0x11, 0x93, 0x50, 0x70, 0x29, 0x78, 0x12, 0xea, 0x9f, 0x73, 0xcb, 0xa4, 0xb2, 0x98, 0xd7, 0xbb, 0xa9, 0x67, 0x52, 0x04, 0x00, 0x00,
0xca, 0x41, 0x5d, 0xff, 0x2f, 0x3c, 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x9f, 0x2a, 0xf0,
0x6f, 0x04, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -512,10 +494,10 @@ type QueryClient interface {
Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error)
// Allocate initializes a Target Vault available for claims with a compatible // Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn. // Authentication mechanism. The default authentication mechanism is WebAuthn.
Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error)
// Sync queries the DID document by its id. And returns the required PKL // Sync queries the DID document by its id. And returns the required PKL
// information // information
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -544,8 +526,8 @@ func (c *queryClient) Schema(ctx context.Context, in *QuerySchemaRequest, opts .
return out, nil return out, nil
} }
func (c *queryClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) { func (c *queryClient) Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error) {
out := new(AllocateResponse) out := new(QueryAllocateResponse)
err := c.cc.Invoke(ctx, "/vault.v1.Query/Allocate", in, out, opts...) err := c.cc.Invoke(ctx, "/vault.v1.Query/Allocate", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -553,8 +535,8 @@ func (c *queryClient) Allocate(ctx context.Context, in *AllocateRequest, opts ..
return out, nil return out, nil
} }
func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) { func (c *queryClient) Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error) {
out := new(SyncResponse) out := new(QuerySyncResponse)
err := c.cc.Invoke(ctx, "/vault.v1.Query/Sync", in, out, opts...) err := c.cc.Invoke(ctx, "/vault.v1.Query/Sync", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -571,10 +553,10 @@ type QueryServer interface {
Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error)
// Allocate initializes a Target Vault available for claims with a compatible // Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn. // Authentication mechanism. The default authentication mechanism is WebAuthn.
Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error)
// Sync queries the DID document by its id. And returns the required PKL // Sync queries the DID document by its id. And returns the required PKL
// information // information
Sync(context.Context, *SyncRequest) (*SyncResponse, error) Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -587,10 +569,10 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq
func (*UnimplementedQueryServer) Schema(ctx context.Context, req *QuerySchemaRequest) (*QuerySchemaResponse, error) { func (*UnimplementedQueryServer) Schema(ctx context.Context, req *QuerySchemaRequest) (*QuerySchemaResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented") return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented")
} }
func (*UnimplementedQueryServer) Allocate(ctx context.Context, req *AllocateRequest) (*AllocateResponse, error) { func (*UnimplementedQueryServer) Allocate(ctx context.Context, req *QueryAllocateRequest) (*QueryAllocateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented") return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
} }
func (*UnimplementedQueryServer) Sync(ctx context.Context, req *SyncRequest) (*SyncResponse, error) { func (*UnimplementedQueryServer) Sync(ctx context.Context, req *QuerySyncRequest) (*QuerySyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
} }
@ -635,7 +617,7 @@ func _Query_Schema_Handler(srv interface{}, ctx context.Context, dec func(interf
} }
func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AllocateRequest) in := new(QueryAllocateRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -647,13 +629,13 @@ func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(inte
FullMethod: "/vault.v1.Query/Allocate", FullMethod: "/vault.v1.Query/Allocate",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Allocate(ctx, req.(*AllocateRequest)) return srv.(QueryServer).Allocate(ctx, req.(*QueryAllocateRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncRequest) in := new(QuerySyncRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -665,7 +647,7 @@ func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interfac
FullMethod: "/vault.v1.Query/Sync", FullMethod: "/vault.v1.Query/Sync",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Sync(ctx, req.(*SyncRequest)) return srv.(QueryServer).Sync(ctx, req.(*QuerySyncRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -811,7 +793,7 @@ func (m *QuerySchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *AllocateRequest) Marshal() (dAtA []byte, err error) { func (m *QueryAllocateRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -821,34 +803,20 @@ func (m *AllocateRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *AllocateRequest) MarshalTo(dAtA []byte) (int, error) { func (m *QueryAllocateRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *AllocateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *QueryAllocateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Subject) > 0 {
i -= len(m.Subject)
copy(dAtA[i:], m.Subject)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Subject)))
i--
dAtA[i] = 0x12
}
if len(m.Origin) > 0 {
i -= len(m.Origin)
copy(dAtA[i:], m.Origin)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Origin)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *AllocateResponse) Marshal() (dAtA []byte, err error) { func (m *QueryAllocateResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -858,12 +826,12 @@ func (m *AllocateResponse) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *AllocateResponse) MarshalTo(dAtA []byte) (int, error) { func (m *QueryAllocateResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *AllocateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *QueryAllocateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -907,7 +875,7 @@ func (m *AllocateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *SyncRequest) Marshal() (dAtA []byte, err error) { func (m *QuerySyncRequest) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -917,12 +885,12 @@ func (m *SyncRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *SyncRequest) MarshalTo(dAtA []byte) (int, error) { func (m *QuerySyncRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *SyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *QuerySyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -937,7 +905,7 @@ func (m *SyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *SyncResponse) Marshal() (dAtA []byte, err error) { func (m *QuerySyncResponse) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -947,12 +915,12 @@ func (m *SyncResponse) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *SyncResponse) MarshalTo(dAtA []byte) (int, error) { func (m *QuerySyncResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *SyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *QuerySyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -1051,24 +1019,16 @@ func (m *QuerySchemaResponse) Size() (n int) {
return n return n
} }
func (m *AllocateRequest) Size() (n int) { func (m *QueryAllocateRequest) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
var l int var l int
_ = l _ = l
l = len(m.Origin)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Subject)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n return n
} }
func (m *AllocateResponse) Size() (n int) { func (m *QueryAllocateResponse) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -1095,7 +1055,7 @@ func (m *AllocateResponse) Size() (n int) {
return n return n
} }
func (m *SyncRequest) Size() (n int) { func (m *QuerySyncRequest) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -1108,7 +1068,7 @@ func (m *SyncRequest) Size() (n int) {
return n return n
} }
func (m *SyncResponse) Size() (n int) { func (m *QuerySyncResponse) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -1410,7 +1370,7 @@ func (m *QuerySchemaResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *AllocateRequest) Unmarshal(dAtA []byte) error { func (m *QueryAllocateRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -1433,76 +1393,12 @@ func (m *AllocateRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: AllocateRequest: wiretype end group for non-group") return fmt.Errorf("proto: QueryAllocateRequest: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: AllocateRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: QueryAllocateRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Origin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Subject = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:]) skippy, err := skipQuery(dAtA[iNdEx:])
@ -1524,7 +1420,7 @@ func (m *AllocateRequest) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *AllocateResponse) Unmarshal(dAtA []byte) error { func (m *QueryAllocateResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -1547,10 +1443,10 @@ func (m *AllocateResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: AllocateResponse: wiretype end group for non-group") return fmt.Errorf("proto: QueryAllocateResponse: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: AllocateResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: QueryAllocateResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -1709,7 +1605,7 @@ func (m *AllocateResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *SyncRequest) Unmarshal(dAtA []byte) error { func (m *QuerySyncRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -1732,10 +1628,10 @@ func (m *SyncRequest) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: SyncRequest: wiretype end group for non-group") return fmt.Errorf("proto: QuerySyncRequest: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: SyncRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: QuerySyncRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -1791,7 +1687,7 @@ func (m *SyncRequest) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *SyncResponse) Unmarshal(dAtA []byte) error { func (m *QuerySyncResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -1814,10 +1710,10 @@ func (m *SyncResponse) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: SyncResponse: wiretype end group for non-group") return fmt.Errorf("proto: QuerySyncResponse: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: SyncResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: QuerySyncResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:

View File

@ -70,76 +70,18 @@ func local_request_Query_Schema_0(ctx context.Context, marshaler runtime.Marshal
} }
func request_Query_Allocate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Query_Allocate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AllocateRequest var protoReq QueryAllocateRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["origin"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
}
protoReq.Origin, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
}
val, ok = pathParams["subject"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject")
}
protoReq.Subject, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err)
}
msg, err := client.Allocate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Allocate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Query_Allocate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Query_Allocate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AllocateRequest var protoReq QueryAllocateRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["origin"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
}
protoReq.Origin, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "origin", err)
}
val, ok = pathParams["subject"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subject")
}
protoReq.Subject, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subject", err)
}
msg, err := server.Allocate(ctx, &protoReq) msg, err := server.Allocate(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
@ -150,7 +92,7 @@ var (
) )
func request_Query_Sync_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Query_Sync_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SyncRequest var protoReq QuerySyncRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
@ -166,7 +108,7 @@ func request_Query_Sync_0(ctx context.Context, marshaler runtime.Marshaler, clie
} }
func local_request_Query_Sync_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Query_Sync_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SyncRequest var protoReq QuerySyncRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
@ -256,7 +198,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("POST", pattern_Query_Sync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_Sync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
@ -380,7 +322,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("POST", pattern_Query_Sync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_Sync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@ -408,7 +350,7 @@ var (
pattern_Query_Schema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "schema"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Schema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "schema"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Allocate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"vault", "v1", "allocate", "origin", "subject"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Allocate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "allocate"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Sync_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "sync-initial"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Sync_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "sync-initial"}, "", runtime.AssumeColonVerbOpt(false)))
) )