feature/1125 offload sync service worker (#1144)

- **feat: provide access to block time**
- **refactor: move block expiry calculation to helper function**
- **feat: register decentralized web node HTMX views**
- **feat: Reorganize methods in layout.templ file alphabetically**
- **feat: add support for layout variants**
- **feat: update Allocate RPC to use GET request with path parameters**
- **feat: add gRPC Gateway endpoint for Allocate**
- **refactor: rename SyncCurrent to Sync**
- **feat: improve code organization by making vault assembly private**
- **feat: add a new method for syncing DID documents**
This commit is contained in:
Prad Nukala 2024-10-18 13:07:52 -04:00 committed by GitHub
parent c2f7a53017
commit 2cd44c0b66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 571 additions and 4641 deletions

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,7 @@ const (
Query_Params_FullMethodName = "/vault.v1.Query/Params" Query_Params_FullMethodName = "/vault.v1.Query/Params"
Query_Schema_FullMethodName = "/vault.v1.Query/Schema" Query_Schema_FullMethodName = "/vault.v1.Query/Schema"
Query_Allocate_FullMethodName = "/vault.v1.Query/Allocate" Query_Allocate_FullMethodName = "/vault.v1.Query/Allocate"
Query_SyncInitial_FullMethodName = "/vault.v1.Query/SyncInitial" Query_Sync_FullMethodName = "/vault.v1.Query/Sync"
Query_SyncCurrent_FullMethodName = "/vault.v1.Query/SyncCurrent"
) )
// QueryClient is the client API for Query service. // QueryClient is the client API for Query service.
@ -40,10 +39,7 @@ type QueryClient interface {
Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, 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
SyncInitial(ctx context.Context, in *SyncInitialRequest, opts ...grpc.CallOption) (*SyncInitialResponse, error) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
// SyncCurrent queries the DID document by its id. And returns the required PKL
// information
SyncCurrent(ctx context.Context, in *SyncCurrentRequest, opts ...grpc.CallOption) (*SyncCurrentResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -81,18 +77,9 @@ func (c *queryClient) Allocate(ctx context.Context, in *AllocateRequest, opts ..
return out, nil return out, nil
} }
func (c *queryClient) SyncInitial(ctx context.Context, in *SyncInitialRequest, opts ...grpc.CallOption) (*SyncInitialResponse, error) { func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
out := new(SyncInitialResponse) out := new(SyncResponse)
err := c.cc.Invoke(ctx, Query_SyncInitial_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) SyncCurrent(ctx context.Context, in *SyncCurrentRequest, opts ...grpc.CallOption) (*SyncCurrentResponse, error) {
out := new(SyncCurrentResponse)
err := c.cc.Invoke(ctx, Query_SyncCurrent_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -113,10 +100,7 @@ type QueryServer interface {
Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, 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
SyncInitial(context.Context, *SyncInitialRequest) (*SyncInitialResponse, error) Sync(context.Context, *SyncRequest) (*SyncResponse, error)
// SyncCurrent queries the DID document by its id. And returns the required PKL
// information
SyncCurrent(context.Context, *SyncCurrentRequest) (*SyncCurrentResponse, error)
mustEmbedUnimplementedQueryServer() mustEmbedUnimplementedQueryServer()
} }
@ -133,11 +117,8 @@ func (UnimplementedQueryServer) Schema(context.Context, *QuerySchemaRequest) (*Q
func (UnimplementedQueryServer) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) { func (UnimplementedQueryServer) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented") return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
} }
func (UnimplementedQueryServer) SyncInitial(context.Context, *SyncInitialRequest) (*SyncInitialResponse, error) { func (UnimplementedQueryServer) Sync(context.Context, *SyncRequest) (*SyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncInitial not implemented") return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (UnimplementedQueryServer) SyncCurrent(context.Context, *SyncCurrentRequest) (*SyncCurrentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncCurrent not implemented")
} }
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
@ -206,38 +187,20 @@ func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_SyncInitial_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(SyncInitialRequest) in := new(SyncRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(QueryServer).SyncInitial(ctx, in) return srv.(QueryServer).Sync(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: Query_SyncInitial_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).SyncInitial(ctx, req.(*SyncInitialRequest)) return srv.(QueryServer).Sync(ctx, req.(*SyncRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_SyncCurrent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncCurrentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SyncCurrent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_SyncCurrent_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SyncCurrent(ctx, req.(*SyncCurrentRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -262,12 +225,8 @@ var Query_ServiceDesc = grpc.ServiceDesc{
Handler: _Query_Allocate_Handler, Handler: _Query_Allocate_Handler,
}, },
{ {
MethodName: "SyncInitial", MethodName: "Sync",
Handler: _Query_SyncInitial_Handler, Handler: _Query_Sync_Handler,
},
{
MethodName: "SyncCurrent",
Handler: _Query_SyncCurrent_Handler,
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,6 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
Msg_AllocateVault_FullMethodName = "/vault.v1.Msg/AllocateVault"
Msg_UpdateParams_FullMethodName = "/vault.v1.Msg/UpdateParams" Msg_UpdateParams_FullMethodName = "/vault.v1.Msg/UpdateParams"
) )
@ -27,10 +26,6 @@ const (
// //
// 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. // 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 MsgClient interface { type MsgClient interface {
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error)
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
@ -45,15 +40,6 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc} return &msgClient{cc}
} }
func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) {
out := new(MsgAllocateVaultResponse)
err := c.cc.Invoke(ctx, Msg_AllocateVault_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse) out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
@ -67,10 +53,6 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
// All implementations must embed UnimplementedMsgServer // All implementations must embed UnimplementedMsgServer
// for forward compatibility // for forward compatibility
type MsgServer interface { type MsgServer interface {
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error)
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
@ -82,9 +64,6 @@ type MsgServer interface {
type UnimplementedMsgServer struct { type UnimplementedMsgServer struct {
} }
func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
@ -101,24 +80,6 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
s.RegisterService(&Msg_ServiceDesc, srv) s.RegisterService(&Msg_ServiceDesc, srv)
} }
func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAllocateVault)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AllocateVault(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AllocateVault_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams) in := new(MsgUpdateParams)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -144,10 +105,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "vault.v1.Msg", ServiceName: "vault.v1.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{
MethodName: "AllocateVault",
Handler: _Msg_AllocateVault_Handler,
},
{ {
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,

View File

@ -1190,7 +1190,6 @@ func GetDefaultBypassFeeMessages() []string {
sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenTry{}), sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenTry{}),
sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenConfirm{}), sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenConfirm{}),
sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenAck{}), sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenAck{}),
sdk.MsgTypeURL(&vaulttypes.MsgAllocateVault{}),
sdk.MsgTypeURL(&didtypes.MsgLinkAuthentication{}), sdk.MsgTypeURL(&didtypes.MsgLinkAuthentication{}),
} }
} }

View File

@ -1,4 +0,0 @@
version: v1
directories:
- proto
- third_party/proto

View File

@ -1,21 +0,0 @@
package ctx
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type SonrContext struct {
sdk.Context
}
func GetSonrCTX(ctx sdk.Context) *SonrContext {
return &SonrContext{ctx}
}
func (s *SonrContext) GetBlockExpiration(duration time.Duration) int64 {
blockTime := s.BlockTime()
avgBlockTime := float64(blockTime.Sub(blockTime).Seconds())
return int64(duration.Seconds() / avgBlockTime)
}

View File

@ -8,6 +8,7 @@ import (
"github.com/onsonr/sonr/internal/dwn/gen" "github.com/onsonr/sonr/internal/dwn/gen"
) )
// BuildFile builds the index.html file for the vault
func BuildFile(cnfg *gen.Config) (files.Node, error) { func BuildFile(cnfg *gen.Config) (files.Node, error) {
w := bytes.NewBuffer(nil) w := bytes.NewBuffer(nil)
err := IndexFile().Render(context.Background(), w) err := IndexFile().Render(context.Background(), w)

View File

@ -2,7 +2,6 @@ package state
var ( var (
serviceWorkerInstall = templ.NewOnceHandle() serviceWorkerInstall = templ.NewOnceHandle()
serviceWorkerReady = templ.NewOnceHandle()
) )
templ RegisterServiceWorker() { templ RegisterServiceWorker() {

View File

@ -1,29 +1,27 @@
package styles package styles
// Icon is a component that renders an icon
type Icon interface { type Icon interface {
Render() templ.Component Render() templ.Component
} }
// Variant is a component that has attributes
type Variant interface { type Variant interface {
Attributes() templ.Attributes Attributes() templ.Attributes
} }
templ Spacer() { // ╭───────────────────────────────────────────────────────────╮
<br/> // │ General Layout Components │
} // ╰───────────────────────────────────────────────────────────╯
templ Rows() {
<div class="flex flex-row w-full gap-2 md:gap-4">
{ children... }
</div>
}
// Columns is a component that renders a flex container with a gap of 3 and a max width of 100%
templ Columns() { templ Columns() {
<div class="flex flex-col h-full w-full gap-3 md:gap-6 md:flex-row"> <div class="flex flex-col h-full w-full gap-3 md:gap-6 md:flex-row">
{ children... } { children... }
</div> </div>
} }
// Layout is a component that renders the general layout of the application
templ Layout(title string, remote bool) { templ Layout(title string, remote bool) {
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -51,6 +49,7 @@ templ Layout(title string, remote bool) {
</html> </html>
} }
// LayoutNoBody is a component that renders the general layout of the application without the body tag
templ LayoutNoBody(title string, remote bool) { templ LayoutNoBody(title string, remote bool) {
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
@ -80,6 +79,7 @@ templ LayoutNoBody(title string, remote bool) {
</html> </html>
} }
// OpenModal is a component that renders a modal with a title and description
templ OpenModal(title, description string) { templ OpenModal(title, description string) {
<div <div
x-data="{ modalOpen: true }" x-data="{ modalOpen: true }"
@ -126,3 +126,15 @@ templ OpenModal(title, description string) {
</template> </template>
</div> </div>
} }
// Rows is a component that renders a flex container with a gap of 2 and a max width of 100%
templ Rows() {
<div class="flex flex-row w-full gap-2 md:gap-4">
{ children... }
</div>
}
// Spacer is a component that renders a <br/> tag
templ Spacer() {
<br/>
}

View File

@ -7,6 +7,7 @@ import (
"github.com/onsonr/sonr/pkg/workers/handlers" "github.com/onsonr/sonr/pkg/workers/handlers"
) )
// RegisterWebNodeAPI registers the Decentralized Web Node API routes.
func RegisterWebNodeAPI(e *echo.Echo) { func RegisterWebNodeAPI(e *echo.Echo) {
g1 := e.Group("api") g1 := e.Group("api")
g1.GET("/register/:subject/start", handlers.Auth.RegisterSubjectStart) g1.GET("/register/:subject/start", handlers.Auth.RegisterSubjectStart)
@ -22,6 +23,7 @@ func RegisterWebNodeAPI(e *echo.Echo) {
g1.POST("/:origin/grant/:subject", handlers.OpenID.GrantAuthorization) g1.POST("/:origin/grant/:subject", handlers.OpenID.GrantAuthorization)
} }
// RegisterWebNodeViews registers the Decentralized Web Node HTMX views.
func RegisterWebNodeViews(e *echo.Echo) { func RegisterWebNodeViews(e *echo.Echo) {
e.File("/", "index.html") e.File("/", "index.html")
e.GET("/#", authentication.CurrentViewRoute) e.GET("/#", authentication.CurrentViewRoute)

View File

@ -22,20 +22,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(AllocateRequest) returns (AllocateResponse) {
option (google.api.http).post = "/vault/v1/allocate"; option (google.api.http).get = "/vault/v1/allocate/{origin}/{subject}";
} }
// 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 SyncInitial(SyncInitialRequest) returns (SyncInitialResponse) { rpc Sync(SyncRequest) returns (SyncResponse) {
option (google.api.http).post = "/vault/v1/sync-initial"; option (google.api.http).post = "/vault/v1/sync-initial";
} }
// SyncCurrent queries the DID document by its id. And returns the required PKL
// information
rpc SyncCurrent(SyncCurrentRequest) returns (SyncCurrentResponse) {
option (google.api.http).post = "/vault/v1/sync-current";
}
} }
// QueryParamsRequest is the request type for the Query/Params RPC method. // QueryParamsRequest is the request type for the Query/Params RPC method.
@ -72,31 +66,12 @@ message AllocateResponse {
} }
// SyncRequest is the request type for the Sync RPC method. // SyncRequest is the request type for the Sync RPC method.
message SyncInitialRequest { message SyncRequest {
string did = 1; string did = 1;
} }
// SyncInitialResponse is the response type for the Sync RPC method. // SyncResponse is the response type for the Sync RPC method.
message SyncInitialResponse { message SyncResponse {
bool success = 1;
// Schema is the DID document.
Schema schema = 2;
// Address is the address of the calling DID.
string address = 3;
// ChainID is the chain ID of the current network.
string chainID = 4;
}
// SyncCurrentRequest is the request type for the Sync RPC method.
message SyncCurrentRequest {
string macaroon = 1;
}
// SyncCurrentResponse is the response type for the Sync RPC method.
message SyncCurrentResponse {
bool success = 1; bool success = 1;
// Schema is the DID document. // Schema is the DID document.

View File

@ -12,49 +12,12 @@ option go_package = "github.com/onsonr/sonr/x/vault/types";
// Msg defines the Msg service. // Msg defines the Msg service.
service Msg { service Msg {
option (cosmos.msg.v1.service) = true; option (cosmos.msg.v1.service) = true;
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
rpc AllocateVault(MsgAllocateVault) returns (MsgAllocateVaultResponse) {
option (google.api.http).post = "/vault/v1/allocate";
}
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
} }
// MsgAllocateVault is the message type for the AllocateVault RPC.
message MsgAllocateVault {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address of the service account.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// subject is a unique human-defined identifier to associate with the vault.
string subject = 2;
// origin is the origin of the request in wildcard form.
string origin = 3;
}
// MsgAllocateVaultResponse is the response type for the AllocateVault RPC.
message MsgAllocateVaultResponse {
// CID is the content identifier of the vault.
string cid = 1;
// ExpiryBlock is the block number at which the vault will expire.
int64 expiry_block = 2;
// RegistrationOptions is a json string of the
// PublicKeyCredentialCreationOptions for WebAuthn
string token = 3;
// IsLocalhost is a flag to indicate if the vault is localhost
bool localhost = 4;
}
// MsgUpdateParams is the Msg/UpdateParams request type. // MsgUpdateParams is the Msg/UpdateParams request type.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47

View File

@ -6,7 +6,6 @@ import (
"time" "time"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/onsonr/sonr/internal/ctx"
didtypes "github.com/onsonr/sonr/x/did/types" didtypes "github.com/onsonr/sonr/x/did/types"
"gopkg.in/macaroon.v2" "gopkg.in/macaroon.v2"
) )
@ -15,7 +14,6 @@ var fourYears = time.Hour * 24 * 365 * 4
// IssueAdminMacaroon creates a macaroon with the specified parameters. // IssueAdminMacaroon creates a macaroon with the specified parameters.
func (k Keeper) IssueAdminMacaroon(sdkctx sdk.Context, controller didtypes.ControllerI) (*macaroon.Macaroon, error) { func (k Keeper) IssueAdminMacaroon(sdkctx sdk.Context, controller didtypes.ControllerI) (*macaroon.Macaroon, error) {
sctx := ctx.GetSonrCTX(sdkctx)
// Derive the root key by hashing the shared MPC public key // Derive the root key by hashing the shared MPC public key
rootKey := sha256.Sum256([]byte(controller.PublicKey())) rootKey := sha256.Sum256([]byte(controller.PublicKey()))
// Create the macaroon // Create the macaroon
@ -25,7 +23,7 @@ func (k Keeper) IssueAdminMacaroon(sdkctx sdk.Context, controller didtypes.Contr
} }
// Add the block expiry caveat // Add the block expiry caveat
caveat := fmt.Sprintf("block-expiry=%d", sctx.GetBlockExpiration(fourYears)) caveat := fmt.Sprintf("block-expiry=%d", calculateBlockExpiry(sdkctx, fourYears))
err = m.AddFirstPartyCaveat([]byte(caveat)) err = m.AddFirstPartyCaveat([]byte(caveat))
if err != nil { if err != nil {
return nil, err return nil, err
@ -53,3 +51,9 @@ func (k Keeper) IssueServiceMacaroon(sdkctx sdk.Context, sharedMPCPubKey, locati
return m, nil return m, nil
} }
func calculateBlockExpiry(sdkctx sdk.Context, duration time.Duration) uint64 {
blockTime := sdkctx.BlockTime()
avgBlockTime := float64(blockTime.Sub(blockTime).Seconds())
return uint64(duration.Seconds() / avgBlockTime)
}

View File

@ -5,13 +5,12 @@ import (
"time" "time"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/onsonr/sonr/internal/ctx"
dwngen "github.com/onsonr/sonr/internal/dwn/gen" dwngen "github.com/onsonr/sonr/internal/dwn/gen"
"github.com/onsonr/sonr/x/vault/types" "github.com/onsonr/sonr/x/vault/types"
) )
// assembleVault assembles the initial vault // assembleVault assembles the initial vault
func (k Keeper) AssembleVault(cotx sdk.Context) (string, int64, error) { func (k Keeper) assembleVault(cotx sdk.Context) (string, int64, error) {
_, con, err := k.DIDKeeper.NewController(cotx) _, con, err := k.DIDKeeper.NewController(cotx)
if err != nil { if err != nil {
return "", 0, err return "", 0, err
@ -20,7 +19,7 @@ func (k Keeper) AssembleVault(cotx sdk.Context) (string, int64, error) {
if err != nil { if err != nil {
return "", 0, err return "", 0, err
} }
sch, err := k.CurrentSchema(cotx) sch, err := k.currentSchema(cotx)
if err != nil { if err != nil {
return "", 0, err return "", 0, err
} }
@ -32,12 +31,11 @@ func (k Keeper) AssembleVault(cotx sdk.Context) (string, int64, error) {
if err != nil { if err != nil {
return "", 0, err return "", 0, err
} }
sctx := ctx.GetSonrCTX(cotx) return cid.String(), calculateBlockExpiry(cotx, time.Second*30), nil
return cid.String(), sctx.GetBlockExpiration(time.Second * 30), nil
} }
// currentSchema returns the current schema // currentSchema returns the current schema
func (k Keeper) CurrentSchema(ctx sdk.Context) (*dwngen.Schema, error) { func (k Keeper) currentSchema(ctx sdk.Context) (*dwngen.Schema, error) {
p, err := k.Params.Get(ctx) p, err := k.Params.Get(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
@ -55,3 +53,9 @@ func (k Keeper) CurrentSchema(ctx sdk.Context) (*dwngen.Schema, error) {
Profile: schema.Profile, Profile: schema.Profile,
}, nil }, 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

@ -10,14 +10,17 @@ import (
var _ types.QueryServer = Querier{} var _ types.QueryServer = Querier{}
type Querier struct { type Querier struct{ Keeper }
Keeper
}
func NewQuerier(keeper Keeper) Querier { func NewQuerier(keeper Keeper) Querier {
return Querier{Keeper: keeper} return Querier{Keeper: keeper}
} }
// ╭───────────────────────────────────────────────────────────╮
// │ Fixed Query Methods │
// ╰───────────────────────────────────────────────────────────╯
// Params implements types.QueryServer.
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
ctx := sdk.UnwrapSDKContext(c) ctx := sdk.UnwrapSDKContext(c)
@ -42,41 +45,16 @@ func (k Querier) Schema(goCtx context.Context, req *types.QuerySchemaRequest) (*
}, nil }, nil
} }
// SyncInitial implements types.QueryServer. // ╭───────────────────────────────────────────────────────────╮
func (k Querier) SyncInitial(goCtx context.Context, req *types.SyncInitialRequest) (*types.SyncInitialResponse, error) { // │ Pre-Authenticated Queries │
ctx := sdk.UnwrapSDKContext(goCtx) // ╰───────────────────────────────────────────────────────────╯
p, err := k.Keeper.Params.Get(ctx)
if err != nil {
return nil, err
}
c, _ := k.DIDKeeper.ResolveController(ctx, req.Did)
if c == nil {
return &types.SyncInitialResponse{
Success: false,
Schema: p.Schema,
ChainID: ctx.ChainID(),
}, nil
}
return &types.SyncInitialResponse{
Success: true,
Schema: p.Schema,
ChainID: ctx.ChainID(),
Address: c.SonrAddress(),
}, nil
}
// SyncCurrent implements types.QueryServer.
func (k Querier) SyncCurrent(goCtx context.Context, req *types.SyncCurrentRequest) (*types.SyncCurrentResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
return &types.SyncCurrentResponse{}, nil
}
// 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.AllocateRequest) (*types.AllocateResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx) ctx := sdk.UnwrapSDKContext(goCtx)
// 2.Allocate the vault msg.GetSubject(), msg.GetOrigin() // 2.Allocate the vault msg.GetSubject(), msg.GetOrigin()
cid, expiryBlock, err := k.AssembleVault(ctx) cid, expiryBlock, err := k.assembleVault(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -87,3 +65,30 @@ func (k Querier) Allocate(goCtx context.Context, req *types.AllocateRequest) (*t
ExpiryBlock: expiryBlock, ExpiryBlock: expiryBlock,
}, nil }, nil
} }
// ╭───────────────────────────────────────────────────────────╮
// │ Authenticated Endpoints │
// ╰───────────────────────────────────────────────────────────╯
// Sync implements types.QueryServer.
func (k Querier) Sync(goCtx context.Context, req *types.SyncRequest) (*types.SyncResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
p, err := k.Keeper.Params.Get(ctx)
if err != nil {
return nil, err
}
c, _ := k.DIDKeeper.ResolveController(ctx, req.Did)
if c == nil {
return &types.SyncResponse{
Success: false,
Schema: p.Schema,
ChainID: ctx.ChainID(),
}, nil
}
return &types.SyncResponse{
Success: true,
Schema: p.Schema,
ChainID: ctx.ChainID(),
Address: c.SonrAddress(),
}, nil
}

View File

@ -3,7 +3,6 @@ package keeper
import ( import (
"context" "context"
sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"cosmossdk.io/errors" "cosmossdk.io/errors"
@ -28,21 +27,3 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
return nil, ms.k.Params.Set(ctx, msg.Params) return nil, ms.k.Params.Set(ctx, msg.Params)
} }
// AllocateVault implements types.MsgServer.
func (ms msgServer) AllocateVault(goCtx context.Context, msg *types.MsgAllocateVault) (*types.MsgAllocateVaultResponse, error) {
// 1.Check if the service origin is valid
ctx := sdk.UnwrapSDKContext(goCtx)
// 2.Allocate the vault msg.GetSubject(), msg.GetOrigin()
cid, expiryBlock, err := ms.k.AssembleVault(ctx)
if err != nil {
return nil, err
}
// 3.Return the response
return &types.MsgAllocateVaultResponse{
ExpiryBlock: expiryBlock,
Cid: cid,
}, nil
}

View File

@ -23,7 +23,6 @@ func init() {
// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, ModuleName+"/MsgUpdateParams", nil) cdc.RegisterConcrete(&MsgUpdateParams{}, ModuleName+"/MsgUpdateParams", nil)
cdc.RegisterConcrete(&MsgAllocateVault{}, ModuleName+"/MsgAllocateVault", nil)
} }
func RegisterInterfaces(registry types.InterfaceRegistry) { func RegisterInterfaces(registry types.InterfaceRegistry) {
@ -32,7 +31,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations( registry.RegisterImplementations(
(*sdk.Msg)(nil), (*sdk.Msg)(nil),
&MsgUpdateParams{}, &MsgUpdateParams{},
&MsgAllocateVault{},
) )
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

View File

@ -7,6 +7,10 @@ import (
var _ sdk.Msg = &MsgUpdateParams{} var _ sdk.Msg = &MsgUpdateParams{}
// ╭──────────────────────────────────────────────────────╮
// │ MsgUpdateParams │
// ╰──────────────────────────────────────────────────────╯
// NewMsgUpdateParams creates new instance of MsgUpdateParams // NewMsgUpdateParams creates new instance of MsgUpdateParams
func NewMsgUpdateParams( func NewMsgUpdateParams(
sender sdk.Address, sender sdk.Address,
@ -45,36 +49,3 @@ func (msg *MsgUpdateParams) Validate() error {
return msg.Params.Validate() return msg.Params.Validate()
} }
//
// [AllocateVault]
//
// NewMsgAllocateVault creates a new instance of MsgAllocateVault
func NewMsgAllocateVault(
sender sdk.Address,
) (*MsgAllocateVault, error) {
return &MsgAllocateVault{}, nil
}
// GetSigners returns the expected signers for a MsgUpdateParams message.
func (msg *MsgAllocateVault) GetSigners() []sdk.AccAddress {
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
return []sdk.AccAddress{addr}
}
// Route returns the name of the module
func (msg MsgAllocateVault) Route() string { return ModuleName }
// Type returns the the action
func (msg MsgAllocateVault) Type() string { return "allocate_vault" }
// GetSignBytes implements the LegacyMsg interface.
func (msg MsgAllocateVault) GetSignBytes() []byte {
return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg))
}
// Vaalidate does a sanity check on the provided data.
func (msg *MsgAllocateVault) Validate() error {
return nil
}

View File

@ -325,22 +325,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 SyncInitialRequest struct { type SyncRequest 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 *SyncInitialRequest) Reset() { *m = SyncInitialRequest{} } func (m *SyncRequest) Reset() { *m = SyncRequest{} }
func (m *SyncInitialRequest) String() string { return proto.CompactTextString(m) } func (m *SyncRequest) String() string { return proto.CompactTextString(m) }
func (*SyncInitialRequest) ProtoMessage() {} func (*SyncRequest) ProtoMessage() {}
func (*SyncInitialRequest) Descriptor() ([]byte, []int) { func (*SyncRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{6} return fileDescriptor_e6d49a2800ab3e4b, []int{6}
} }
func (m *SyncInitialRequest) XXX_Unmarshal(b []byte) error { func (m *SyncRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *SyncInitialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_SyncInitialRequest.Marshal(b, m, deterministic) return xxx_messageInfo_SyncRequest.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,27 +350,27 @@ func (m *SyncInitialRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return b[:n], nil return b[:n], nil
} }
} }
func (m *SyncInitialRequest) XXX_Merge(src proto.Message) { func (m *SyncRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncInitialRequest.Merge(m, src) xxx_messageInfo_SyncRequest.Merge(m, src)
} }
func (m *SyncInitialRequest) XXX_Size() int { func (m *SyncRequest) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *SyncInitialRequest) XXX_DiscardUnknown() { func (m *SyncRequest) XXX_DiscardUnknown() {
xxx_messageInfo_SyncInitialRequest.DiscardUnknown(m) xxx_messageInfo_SyncRequest.DiscardUnknown(m)
} }
var xxx_messageInfo_SyncInitialRequest proto.InternalMessageInfo var xxx_messageInfo_SyncRequest proto.InternalMessageInfo
func (m *SyncInitialRequest) GetDid() string { func (m *SyncRequest) GetDid() string {
if m != nil { if m != nil {
return m.Did return m.Did
} }
return "" return ""
} }
// SyncInitialResponse is the response type for the Sync RPC method. // SyncResponse is the response type for the Sync RPC method.
type SyncInitialResponse struct { type SyncResponse 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 +380,18 @@ type SyncInitialResponse 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 *SyncInitialResponse) Reset() { *m = SyncInitialResponse{} } func (m *SyncResponse) Reset() { *m = SyncResponse{} }
func (m *SyncInitialResponse) String() string { return proto.CompactTextString(m) } func (m *SyncResponse) String() string { return proto.CompactTextString(m) }
func (*SyncInitialResponse) ProtoMessage() {} func (*SyncResponse) ProtoMessage() {}
func (*SyncInitialResponse) Descriptor() ([]byte, []int) { func (*SyncResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{7} return fileDescriptor_e6d49a2800ab3e4b, []int{7}
} }
func (m *SyncInitialResponse) XXX_Unmarshal(b []byte) error { func (m *SyncResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *SyncInitialResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_SyncInitialResponse.Marshal(b, m, deterministic) return xxx_messageInfo_SyncResponse.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,157 +401,40 @@ func (m *SyncInitialResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte,
return b[:n], nil return b[:n], nil
} }
} }
func (m *SyncInitialResponse) XXX_Merge(src proto.Message) { func (m *SyncResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncInitialResponse.Merge(m, src) xxx_messageInfo_SyncResponse.Merge(m, src)
} }
func (m *SyncInitialResponse) XXX_Size() int { func (m *SyncResponse) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *SyncInitialResponse) XXX_DiscardUnknown() { func (m *SyncResponse) XXX_DiscardUnknown() {
xxx_messageInfo_SyncInitialResponse.DiscardUnknown(m) xxx_messageInfo_SyncResponse.DiscardUnknown(m)
} }
var xxx_messageInfo_SyncInitialResponse proto.InternalMessageInfo var xxx_messageInfo_SyncResponse proto.InternalMessageInfo
func (m *SyncInitialResponse) GetSuccess() bool { func (m *SyncResponse) GetSuccess() bool {
if m != nil { if m != nil {
return m.Success return m.Success
} }
return false return false
} }
func (m *SyncInitialResponse) GetSchema() *Schema { func (m *SyncResponse) GetSchema() *Schema {
if m != nil { if m != nil {
return m.Schema return m.Schema
} }
return nil return nil
} }
func (m *SyncInitialResponse) GetAddress() string { func (m *SyncResponse) GetAddress() string {
if m != nil { if m != nil {
return m.Address return m.Address
} }
return "" return ""
} }
func (m *SyncInitialResponse) GetChainID() string { func (m *SyncResponse) GetChainID() string {
if m != nil {
return m.ChainID
}
return ""
}
// SyncCurrentRequest is the request type for the Sync RPC method.
type SyncCurrentRequest struct {
Macaroon string `protobuf:"bytes,1,opt,name=macaroon,proto3" json:"macaroon,omitempty"`
}
func (m *SyncCurrentRequest) Reset() { *m = SyncCurrentRequest{} }
func (m *SyncCurrentRequest) String() string { return proto.CompactTextString(m) }
func (*SyncCurrentRequest) ProtoMessage() {}
func (*SyncCurrentRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{8}
}
func (m *SyncCurrentRequest) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *SyncCurrentRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_SyncCurrentRequest.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *SyncCurrentRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncCurrentRequest.Merge(m, src)
}
func (m *SyncCurrentRequest) XXX_Size() int {
return m.Size()
}
func (m *SyncCurrentRequest) XXX_DiscardUnknown() {
xxx_messageInfo_SyncCurrentRequest.DiscardUnknown(m)
}
var xxx_messageInfo_SyncCurrentRequest proto.InternalMessageInfo
func (m *SyncCurrentRequest) GetMacaroon() string {
if m != nil {
return m.Macaroon
}
return ""
}
// SyncCurrentResponse is the response type for the Sync RPC method.
type SyncCurrentResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
// Schema is the DID document.
Schema *Schema `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"`
// Address is the address of the calling DID.
Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
// ChainID is the chain ID of the current network.
ChainID string `protobuf:"bytes,4,opt,name=chainID,proto3" json:"chainID,omitempty"`
}
func (m *SyncCurrentResponse) Reset() { *m = SyncCurrentResponse{} }
func (m *SyncCurrentResponse) String() string { return proto.CompactTextString(m) }
func (*SyncCurrentResponse) ProtoMessage() {}
func (*SyncCurrentResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_e6d49a2800ab3e4b, []int{9}
}
func (m *SyncCurrentResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *SyncCurrentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_SyncCurrentResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *SyncCurrentResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_SyncCurrentResponse.Merge(m, src)
}
func (m *SyncCurrentResponse) XXX_Size() int {
return m.Size()
}
func (m *SyncCurrentResponse) XXX_DiscardUnknown() {
xxx_messageInfo_SyncCurrentResponse.DiscardUnknown(m)
}
var xxx_messageInfo_SyncCurrentResponse proto.InternalMessageInfo
func (m *SyncCurrentResponse) GetSuccess() bool {
if m != nil {
return m.Success
}
return false
}
func (m *SyncCurrentResponse) GetSchema() *Schema {
if m != nil {
return m.Schema
}
return nil
}
func (m *SyncCurrentResponse) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
func (m *SyncCurrentResponse) GetChainID() string {
if m != nil { if m != nil {
return m.ChainID return m.ChainID
} }
@ -565,53 +448,49 @@ func init() {
proto.RegisterType((*QuerySchemaResponse)(nil), "vault.v1.QuerySchemaResponse") proto.RegisterType((*QuerySchemaResponse)(nil), "vault.v1.QuerySchemaResponse")
proto.RegisterType((*AllocateRequest)(nil), "vault.v1.AllocateRequest") proto.RegisterType((*AllocateRequest)(nil), "vault.v1.AllocateRequest")
proto.RegisterType((*AllocateResponse)(nil), "vault.v1.AllocateResponse") proto.RegisterType((*AllocateResponse)(nil), "vault.v1.AllocateResponse")
proto.RegisterType((*SyncInitialRequest)(nil), "vault.v1.SyncInitialRequest") proto.RegisterType((*SyncRequest)(nil), "vault.v1.SyncRequest")
proto.RegisterType((*SyncInitialResponse)(nil), "vault.v1.SyncInitialResponse") proto.RegisterType((*SyncResponse)(nil), "vault.v1.SyncResponse")
proto.RegisterType((*SyncCurrentRequest)(nil), "vault.v1.SyncCurrentRequest")
proto.RegisterType((*SyncCurrentResponse)(nil), "vault.v1.SyncCurrentResponse")
} }
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{
// 580 bytes of a gzipped FileDescriptorProto // 548 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x54, 0x41, 0x6f, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x41, 0x6f, 0xd3, 0x30,
0x18, 0x6d, 0xda, 0xad, 0x74, 0x2e, 0x12, 0x95, 0x57, 0x55, 0x21, 0xda, 0xa2, 0x11, 0x21, 0xd4, 0x14, 0x6e, 0xda, 0xad, 0x74, 0xaf, 0x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, 0xc3, 0xd1, 0xf1, 0xf3, 0x1f, 0x33, 0xdf, 0xb9, 0x9a, 0xf9, 0xce, 0xef, 0x99, 0xef, 0x7c,
0x6a, 0xc9, 0xad, 0x96, 0x4d, 0xc9, 0xba, 0x56, 0x39, 0x6f, 0xeb, 0x5a, 0x6b, 0xd1, 0xba, 0x55, 0x99, 0xfb, 0x95, 0xab, 0xb9, 0x5f, 0xf9, 0x35, 0xf7, 0x2b, 0xef, 0x1f, 0x8f, 0x98, 0x1a, 0xa7,
0x0b, 0x9b, 0xb9, 0xd3, 0x17, 0x3f, 0x16, 0xbe, 0x73, 0xb3, 0xf0, 0x9d, 0xdf, 0x0b, 0xdf, 0xf9, 0x83, 0x2e, 0x11, 0x93, 0x50, 0x70, 0x29, 0x78, 0x12, 0xea, 0x9f, 0x73, 0xcb, 0xa4, 0xb2, 0x98,
0xba, 0xf4, 0x2b, 0x37, 0x4b, 0xbf, 0xf2, 0x6b, 0xe9, 0x57, 0xde, 0x3f, 0x1e, 0x53, 0x35, 0x49, 0xca, 0x41, 0x5d, 0xff, 0x2f, 0x3c, 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x9f, 0x2a, 0xf0,
0x86, 0x3d, 0xcc, 0xa7, 0x21, 0x67, 0x92, 0x33, 0x11, 0xea, 0x9f, 0x6b, 0xcb, 0xa4, 0xe6, 0x31, 0x6f, 0x04, 0x00, 0x00,
0x91, 0xc3, 0xba, 0xfe, 0x57, 0x7d, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x30, 0x93, 0x81,
0xad, 0x05, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -636,10 +515,7 @@ type QueryClient interface {
Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, 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
SyncInitial(ctx context.Context, in *SyncInitialRequest, opts ...grpc.CallOption) (*SyncInitialResponse, error) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
// SyncCurrent queries the DID document by its id. And returns the required PKL
// information
SyncCurrent(ctx context.Context, in *SyncCurrentRequest, opts ...grpc.CallOption) (*SyncCurrentResponse, error)
} }
type queryClient struct { type queryClient struct {
@ -677,18 +553,9 @@ func (c *queryClient) Allocate(ctx context.Context, in *AllocateRequest, opts ..
return out, nil return out, nil
} }
func (c *queryClient) SyncInitial(ctx context.Context, in *SyncInitialRequest, opts ...grpc.CallOption) (*SyncInitialResponse, error) { func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
out := new(SyncInitialResponse) out := new(SyncResponse)
err := c.cc.Invoke(ctx, "/vault.v1.Query/SyncInitial", in, out, opts...) err := c.cc.Invoke(ctx, "/vault.v1.Query/Sync", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) SyncCurrent(ctx context.Context, in *SyncCurrentRequest, opts ...grpc.CallOption) (*SyncCurrentResponse, error) {
out := new(SyncCurrentResponse)
err := c.cc.Invoke(ctx, "/vault.v1.Query/SyncCurrent", in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -707,10 +574,7 @@ type QueryServer interface {
Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error) Allocate(context.Context, *AllocateRequest) (*AllocateResponse, 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
SyncInitial(context.Context, *SyncInitialRequest) (*SyncInitialResponse, error) Sync(context.Context, *SyncRequest) (*SyncResponse, error)
// SyncCurrent queries the DID document by its id. And returns the required PKL
// information
SyncCurrent(context.Context, *SyncCurrentRequest) (*SyncCurrentResponse, error)
} }
// UnimplementedQueryServer can be embedded to have forward compatible implementations. // UnimplementedQueryServer can be embedded to have forward compatible implementations.
@ -726,11 +590,8 @@ func (*UnimplementedQueryServer) Schema(ctx context.Context, req *QuerySchemaReq
func (*UnimplementedQueryServer) Allocate(ctx context.Context, req *AllocateRequest) (*AllocateResponse, error) { func (*UnimplementedQueryServer) Allocate(ctx context.Context, req *AllocateRequest) (*AllocateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented") return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
} }
func (*UnimplementedQueryServer) SyncInitial(ctx context.Context, req *SyncInitialRequest) (*SyncInitialResponse, error) { func (*UnimplementedQueryServer) Sync(ctx context.Context, req *SyncRequest) (*SyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncInitial not implemented") return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (*UnimplementedQueryServer) SyncCurrent(ctx context.Context, req *SyncCurrentRequest) (*SyncCurrentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncCurrent not implemented")
} }
func RegisterQueryServer(s grpc1.Server, srv QueryServer) { func RegisterQueryServer(s grpc1.Server, srv QueryServer) {
@ -791,38 +652,20 @@ func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Query_SyncInitial_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(SyncInitialRequest) in := new(SyncRequest)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(QueryServer).SyncInitial(ctx, in) return srv.(QueryServer).Sync(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/vault.v1.Query/SyncInitial", 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).SyncInitial(ctx, req.(*SyncInitialRequest)) return srv.(QueryServer).Sync(ctx, req.(*SyncRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_SyncCurrent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncCurrentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).SyncCurrent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/vault.v1.Query/SyncCurrent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).SyncCurrent(ctx, req.(*SyncCurrentRequest))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -844,12 +687,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{
Handler: _Query_Allocate_Handler, Handler: _Query_Allocate_Handler,
}, },
{ {
MethodName: "SyncInitial", MethodName: "Sync",
Handler: _Query_SyncInitial_Handler, Handler: _Query_Sync_Handler,
},
{
MethodName: "SyncCurrent",
Handler: _Query_SyncCurrent_Handler,
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
@ -1068,7 +907,7 @@ func (m *AllocateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *SyncInitialRequest) Marshal() (dAtA []byte, err error) { func (m *SyncRequest) 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])
@ -1078,12 +917,12 @@ func (m *SyncInitialRequest) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *SyncInitialRequest) MarshalTo(dAtA []byte) (int, error) { func (m *SyncRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *SyncInitialRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *SyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -1098,7 +937,7 @@ func (m *SyncInitialRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *SyncInitialResponse) Marshal() (dAtA []byte, err error) { func (m *SyncResponse) 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])
@ -1108,101 +947,12 @@ func (m *SyncInitialResponse) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *SyncInitialResponse) MarshalTo(dAtA []byte) (int, error) { func (m *SyncResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *SyncInitialResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *SyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.ChainID) > 0 {
i -= len(m.ChainID)
copy(dAtA[i:], m.ChainID)
i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainID)))
i--
dAtA[i] = 0x22
}
if len(m.Address) > 0 {
i -= len(m.Address)
copy(dAtA[i:], m.Address)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Address)))
i--
dAtA[i] = 0x1a
}
if m.Schema != nil {
{
size, err := m.Schema.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintQuery(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.Success {
i--
if m.Success {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *SyncCurrentRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *SyncCurrentRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SyncCurrentRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Macaroon) > 0 {
i -= len(m.Macaroon)
copy(dAtA[i:], m.Macaroon)
i = encodeVarintQuery(dAtA, i, uint64(len(m.Macaroon)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *SyncCurrentResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *SyncCurrentResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SyncCurrentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -1345,7 +1095,7 @@ func (m *AllocateResponse) Size() (n int) {
return n return n
} }
func (m *SyncInitialRequest) Size() (n int) { func (m *SyncRequest) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -1358,44 +1108,7 @@ func (m *SyncInitialRequest) Size() (n int) {
return n return n
} }
func (m *SyncInitialResponse) Size() (n int) { func (m *SyncResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.Success {
n += 2
}
if m.Schema != nil {
l = m.Schema.Size()
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.Address)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
l = len(m.ChainID)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *SyncCurrentRequest) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Macaroon)
if l > 0 {
n += 1 + l + sovQuery(uint64(l))
}
return n
}
func (m *SyncCurrentResponse) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -1996,7 +1709,7 @@ func (m *AllocateResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *SyncInitialRequest) Unmarshal(dAtA []byte) error { func (m *SyncRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -2019,10 +1732,10 @@ func (m *SyncInitialRequest) 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: SyncInitialRequest: wiretype end group for non-group") return fmt.Errorf("proto: SyncRequest: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: SyncInitialRequest: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: SyncRequest: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -2078,7 +1791,7 @@ func (m *SyncInitialRequest) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *SyncInitialResponse) Unmarshal(dAtA []byte) error { func (m *SyncResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -2101,262 +1814,10 @@ func (m *SyncInitialResponse) 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: SyncInitialResponse: wiretype end group for non-group") return fmt.Errorf("proto: SyncResponse: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: SyncInitialResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: SyncResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Success = bool(v != 0)
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthQuery
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthQuery
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Schema == nil {
m.Schema = &Schema{}
}
if err := m.Schema.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ChainID", 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.ChainID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *SyncCurrentRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: SyncCurrentRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SyncCurrentRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Macaroon", 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.Macaroon = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipQuery(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthQuery
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *SyncCurrentResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowQuery
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: SyncCurrentResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SyncCurrentResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:

View File

@ -69,19 +69,37 @@ func local_request_Query_Schema_0(ctx context.Context, marshaler runtime.Marshal
} }
var (
filter_Query_Allocate_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
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 AllocateRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { var (
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) val string
ok bool
err error
_ = err
)
val, ok = pathParams["origin"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Allocate_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 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))
@ -93,11 +111,33 @@ func local_request_Query_Allocate_0(ctx context.Context, marshaler runtime.Marsh
var protoReq AllocateRequest var protoReq AllocateRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { var (
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) val string
ok bool
err error
_ = err
)
val, ok = pathParams["origin"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "origin")
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Allocate_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) 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)
@ -106,73 +146,37 @@ func local_request_Query_Allocate_0(ctx context.Context, marshaler runtime.Marsh
} }
var ( var (
filter_Query_SyncInitial_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} filter_Query_Sync_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
) )
func request_Query_SyncInitial_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 SyncInitialRequest var protoReq SyncRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SyncInitial_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Sync_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.SyncInitial(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.Sync(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Query_SyncInitial_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 SyncInitialRequest var protoReq SyncRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SyncInitial_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Sync_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.SyncInitial(ctx, &protoReq) msg, err := server.Sync(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_SyncCurrent_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Query_SyncCurrent_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SyncCurrentRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SyncCurrent_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.SyncCurrent(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_SyncCurrent_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq SyncCurrentRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SyncCurrent_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.SyncCurrent(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
@ -229,7 +233,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("POST", pattern_Query_Allocate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_Allocate_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
@ -252,7 +256,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("POST", pattern_Query_SyncInitial_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("POST", 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
@ -263,7 +267,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_Query_SyncInitial_0(rctx, inboundMarshaler, server, req, pathParams) resp, md, err := local_request_Query_Sync_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
@ -271,30 +275,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
return return
} }
forward_Query_SyncInitial_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Query_Sync_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Query_SyncCurrent_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_SyncCurrent_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_SyncCurrent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -379,7 +360,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("POST", pattern_Query_Allocate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_Allocate_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)
@ -399,7 +380,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("POST", pattern_Query_SyncInitial_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("POST", 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,34 +389,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_Query_SyncInitial_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Query_Sync_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Query_SyncInitial_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Query_Sync_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Query_SyncCurrent_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_SyncCurrent_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_SyncCurrent_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -447,11 +408,9 @@ 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}, []string{"vault", "v1", "allocate"}, "", 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_SyncInitial_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)))
pattern_Query_SyncCurrent_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "sync-current"}, "", runtime.AssumeColonVerbOpt(false)))
) )
var ( var (
@ -461,7 +420,5 @@ var (
forward_Query_Allocate_0 = runtime.ForwardResponseMessage forward_Query_Allocate_0 = runtime.ForwardResponseMessage
forward_Query_SyncInitial_0 = runtime.ForwardResponseMessage forward_Query_Sync_0 = runtime.ForwardResponseMessage
forward_Query_SyncCurrent_0 = runtime.ForwardResponseMessage
) )

View File

@ -31,144 +31,6 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// MsgAllocateVault is the message type for the AllocateVault RPC.
type MsgAllocateVault struct {
// authority is the address of the service account.
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
// subject is a unique human-defined identifier to associate with the vault.
Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
// origin is the origin of the request in wildcard form.
Origin string `protobuf:"bytes,3,opt,name=origin,proto3" json:"origin,omitempty"`
}
func (m *MsgAllocateVault) Reset() { *m = MsgAllocateVault{} }
func (m *MsgAllocateVault) String() string { return proto.CompactTextString(m) }
func (*MsgAllocateVault) ProtoMessage() {}
func (*MsgAllocateVault) Descriptor() ([]byte, []int) {
return fileDescriptor_311d0123a4881c5c, []int{0}
}
func (m *MsgAllocateVault) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAllocateVault) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAllocateVault.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAllocateVault) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAllocateVault.Merge(m, src)
}
func (m *MsgAllocateVault) XXX_Size() int {
return m.Size()
}
func (m *MsgAllocateVault) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAllocateVault.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAllocateVault proto.InternalMessageInfo
func (m *MsgAllocateVault) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
func (m *MsgAllocateVault) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *MsgAllocateVault) GetOrigin() string {
if m != nil {
return m.Origin
}
return ""
}
// MsgAllocateVaultResponse is the response type for the AllocateVault RPC.
type MsgAllocateVaultResponse struct {
// CID is the content identifier of the vault.
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
// ExpiryBlock is the block number at which the vault will expire.
ExpiryBlock int64 `protobuf:"varint,2,opt,name=expiry_block,json=expiryBlock,proto3" json:"expiry_block,omitempty"`
// RegistrationOptions is a json string of the
// PublicKeyCredentialCreationOptions for WebAuthn
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
// IsLocalhost is a flag to indicate if the vault is localhost
Localhost bool `protobuf:"varint,4,opt,name=localhost,proto3" json:"localhost,omitempty"`
}
func (m *MsgAllocateVaultResponse) Reset() { *m = MsgAllocateVaultResponse{} }
func (m *MsgAllocateVaultResponse) String() string { return proto.CompactTextString(m) }
func (*MsgAllocateVaultResponse) ProtoMessage() {}
func (*MsgAllocateVaultResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_311d0123a4881c5c, []int{1}
}
func (m *MsgAllocateVaultResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgAllocateVaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgAllocateVaultResponse.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *MsgAllocateVaultResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgAllocateVaultResponse.Merge(m, src)
}
func (m *MsgAllocateVaultResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgAllocateVaultResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgAllocateVaultResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgAllocateVaultResponse proto.InternalMessageInfo
func (m *MsgAllocateVaultResponse) GetCid() string {
if m != nil {
return m.Cid
}
return ""
}
func (m *MsgAllocateVaultResponse) GetExpiryBlock() int64 {
if m != nil {
return m.ExpiryBlock
}
return 0
}
func (m *MsgAllocateVaultResponse) GetToken() string {
if m != nil {
return m.Token
}
return ""
}
func (m *MsgAllocateVaultResponse) GetLocalhost() bool {
if m != nil {
return m.Localhost
}
return false
}
// MsgUpdateParams is the Msg/UpdateParams request type. // MsgUpdateParams is the Msg/UpdateParams request type.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
@ -185,7 +47,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} }
func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) ProtoMessage() {}
func (*MsgUpdateParams) Descriptor() ([]byte, []int) { func (*MsgUpdateParams) Descriptor() ([]byte, []int) {
return fileDescriptor_311d0123a4881c5c, []int{2} return fileDescriptor_311d0123a4881c5c, []int{0}
} }
func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -239,7 +101,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse
func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) }
func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) ProtoMessage() {}
func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_311d0123a4881c5c, []int{3} return fileDescriptor_311d0123a4881c5c, []int{1}
} }
func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
@ -269,8 +131,6 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*MsgAllocateVault)(nil), "vault.v1.MsgAllocateVault")
proto.RegisterType((*MsgAllocateVaultResponse)(nil), "vault.v1.MsgAllocateVaultResponse")
proto.RegisterType((*MsgUpdateParams)(nil), "vault.v1.MsgUpdateParams") proto.RegisterType((*MsgUpdateParams)(nil), "vault.v1.MsgUpdateParams")
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "vault.v1.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "vault.v1.MsgUpdateParamsResponse")
} }
@ -278,38 +138,29 @@ func init() {
func init() { proto.RegisterFile("vault/v1/tx.proto", fileDescriptor_311d0123a4881c5c) } func init() { proto.RegisterFile("vault/v1/tx.proto", fileDescriptor_311d0123a4881c5c) }
var fileDescriptor_311d0123a4881c5c = []byte{ var fileDescriptor_311d0123a4881c5c = []byte{
// 491 bytes of a gzipped FileDescriptorProto // 338 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4f, 0x6b, 0x13, 0x41, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x50, 0x4d, 0x4b, 0x02, 0x41,
0x1c, 0xcd, 0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,
0xab, 0xa9, 0x83, 0x7e, 0x4f, 0x1d, 0xf4, 0x79, 0xe6, 0x54, 0xae, 0x66, 0x4e, 0xe5, 0xe7, 0xcc,
0xa9, 0xbc, 0x7d, 0x24, 0xa4, 0xe9, 0x0f, 0xbb, 0x5e, 0x00, 0x11, 0x05, 0xa5, 0x41, 0x25, 0x34,
0xfb, 0x8c, 0x8b, 0x68, 0x66, 0x12, 0x73, 0xdd, 0xad, 0x65, 0x8f, 0xf9, 0xc9, 0xdf, 0x00, 0x00,
0x00, 0xff, 0xff, 0xc3, 0x77, 0xd8, 0x9e, 0x6b, 0x03, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -324,10 +175,6 @@ const _ = grpc.SupportPackageIsVersion4
// //
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type MsgClient interface { type MsgClient interface {
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error)
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
@ -342,15 +189,6 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient {
return &msgClient{cc} return &msgClient{cc}
} }
func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) {
out := new(MsgAllocateVaultResponse)
err := c.cc.Invoke(ctx, "/vault.v1.Msg/AllocateVault", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse) out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, "/vault.v1.Msg/UpdateParams", in, out, opts...) err := c.cc.Invoke(ctx, "/vault.v1.Msg/UpdateParams", in, out, opts...)
@ -362,10 +200,6 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
type MsgServer interface { type MsgServer interface {
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error)
// UpdateParams defines a governance operation for updating the parameters. // UpdateParams defines a governance operation for updating the parameters.
// //
// Since: cosmos-sdk 0.47 // Since: cosmos-sdk 0.47
@ -376,9 +210,6 @@ type MsgServer interface {
type UnimplementedMsgServer struct { type UnimplementedMsgServer struct {
} }
func (*UnimplementedMsgServer) AllocateVault(ctx context.Context, req *MsgAllocateVault) (*MsgAllocateVaultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented")
}
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
} }
@ -387,24 +218,6 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv) s.RegisterService(&_Msg_serviceDesc, srv)
} }
func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAllocateVault)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AllocateVault(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/vault.v1.Msg/AllocateVault",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams) in := new(MsgUpdateParams)
if err := dec(in); err != nil { if err := dec(in); err != nil {
@ -427,10 +240,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "vault.v1.Msg", ServiceName: "vault.v1.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{
MethodName: "AllocateVault",
Handler: _Msg_AllocateVault_Handler,
},
{ {
MethodName: "UpdateParams", MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler, Handler: _Msg_UpdateParams_Handler,
@ -440,102 +249,6 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
Metadata: "vault/v1/tx.proto", Metadata: "vault/v1/tx.proto",
} }
func (m *MsgAllocateVault) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAllocateVault) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAllocateVault) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Origin) > 0 {
i -= len(m.Origin)
copy(dAtA[i:], m.Origin)
i = encodeVarintTx(dAtA, i, uint64(len(m.Origin)))
i--
dAtA[i] = 0x1a
}
if len(m.Subject) > 0 {
i -= len(m.Subject)
copy(dAtA[i:], m.Subject)
i = encodeVarintTx(dAtA, i, uint64(len(m.Subject)))
i--
dAtA[i] = 0x12
}
if len(m.Authority) > 0 {
i -= len(m.Authority)
copy(dAtA[i:], m.Authority)
i = encodeVarintTx(dAtA, i, uint64(len(m.Authority)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgAllocateVaultResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *MsgAllocateVaultResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgAllocateVaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.Localhost {
i--
if m.Localhost {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
if len(m.Token) > 0 {
i -= len(m.Token)
copy(dAtA[i:], m.Token)
i = encodeVarintTx(dAtA, i, uint64(len(m.Token)))
i--
dAtA[i] = 0x1a
}
if m.ExpiryBlock != 0 {
i = encodeVarintTx(dAtA, i, uint64(m.ExpiryBlock))
i--
dAtA[i] = 0x10
}
if len(m.Cid) > 0 {
i -= len(m.Cid)
copy(dAtA[i:], m.Cid)
i = encodeVarintTx(dAtA, i, uint64(len(m.Cid)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
@ -610,50 +323,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return base return base
} }
func (m *MsgAllocateVault) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Authority)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Subject)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
l = len(m.Origin)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n
}
func (m *MsgAllocateVaultResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Cid)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.ExpiryBlock != 0 {
n += 1 + sovTx(uint64(m.ExpiryBlock))
}
l = len(m.Token)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if m.Localhost {
n += 2
}
return n
}
func (m *MsgUpdateParams) Size() (n int) { func (m *MsgUpdateParams) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
@ -684,305 +353,6 @@ func sovTx(x uint64) (n int) {
func sozTx(x uint64) (n int) { func sozTx(x uint64) (n int) {
return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63))))
} }
func (m *MsgAllocateVault) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAllocateVault: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAllocateVault: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Authority = 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 ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Subject = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
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 ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Origin = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgAllocateVaultResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: MsgAllocateVaultResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgAllocateVaultResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Cid = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExpiryBlock", wireType)
}
m.ExpiryBlock = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ExpiryBlock |= int64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
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 ErrInvalidLengthTx
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Token = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Localhost", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
m.Localhost = bool(v != 0)
default:
iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTx
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0

View File

@ -1,171 +0,0 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: vault/v1/tx.proto
/*
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package types
import (
"context"
"io"
"net/http"
"github.com/golang/protobuf/descriptor"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
)
// Suppress "imported and not used" errors
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = descriptor.ForMessage
var _ = metadata.Join
var (
filter_Msg_AllocateVault_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Msg_AllocateVault_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgAllocateVault
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_AllocateVault_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.AllocateVault(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Msg_AllocateVault_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq MsgAllocateVault
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_AllocateVault_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.AllocateVault(ctx, &protoReq)
return msg, metadata, err
}
// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux".
// UnaryRPC :call MsgServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead.
func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error {
mux.Handle("POST", pattern_Msg_AllocateVault_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Msg_AllocateVault_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_AllocateVault_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMsgHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterMsgHandler(ctx, mux, conn)
}
// RegisterMsgHandler registers the http handlers for service Msg to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn))
}
// RegisterMsgHandlerClient registers the http handlers for service Msg
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "MsgClient" to call the correct interceptors.
func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error {
mux.Handle("POST", pattern_Msg_AllocateVault_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Msg_AllocateVault_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Msg_AllocateVault_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_Msg_AllocateVault_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"vault", "v1", "allocate"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Msg_AllocateVault_0 = runtime.ForwardResponseMessage
)